Skip to content

LREN-CHUV/portal-frontend

Repository files navigation

CHUV License DockerHub Codacy Badge CircleCI

MIP portal frontend

Summary

MIP Frontend is the web portal for the Medical Informatics Platform for the Human Brain Project.

The portal runs on React, a JavaScript library for building user interfaces, and embed several libraries, among them are:

Development

This is a minimal setup to do frontend development in this project:

Run the Backend

  • Checkout the master branch of the mip-deployment-infrastructure project, and follow the setup instructions.
  • Create a new line in /etc/hosts, so the backend will be accessible through http://frontend/services
    • sudo sh -c 'echo 127.0.1.1 frontend >> /etc/hosts'
  • Launch ./run.sh. You will have the MIP frontend running on your computer at http://frontend

React

This project was bootstrapped with Create React App.

You can find the most recent version of the Create React App guide here.

  • Install nodejs
  • Install yarn
  • create a .env file
    • echo REACT_APP_BACKEND_URL = \"http://frontend\" | tee .env
  • yarn install
  • yarn watch
  • Browse to http://localhost:3000

Tests

Local

You can generate models and experiments by running the tests:

  • yarn test

Test live installations

You can use the mip-frontend test suite against any live installation, either locally

echo REACT_APP_BACKEND_URL = "https://qa.mip.chuv.ch" | tee .env &&
echo REACT_APP_TOKEN = "xxx" | tee -a .env &&
echo REACT_APP_JSESSIONID = "xxx" | tee -a .env &&
echo REACT_APP_AUTHORIZATION = "xxx" | tee -a .env
yarn test

or as a standalone docker

docker build . -f Dockerfile-test -t hbpmip/portal-frontend-tests
docker run -it \
-e BACKEND_URL="https://qa.mip.chuv.ch" \
-e TOKEN="c900a5c9-452e-4514-b8a8-c5dda02d03b6" \
-e JSESSIONID="2B5967D0870A33E2A55F5C9B641518FB" \
-e AUTHORIZATION="Basic c2dhMXJldmlld2VyczpIQlBzZ2Ex" \
--rm hbpmip/portal-frontend-tests:latest

Samples tests queries

hbpmip/portal-frontend-tests test

Tests run with Jest, see the jest cli doc for more details

Build (produce a local docker container)

Run: ./build.sh

Publish on Docker Hub

Run: ./publish.sh

License

Copyright © 2016-2019 LREN CHUV

Licensed under the GNU Affero General Public License, Version 3.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at https://www.gnu.org/licenses/agpl-3.0.html

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Acknowledgements

This work has been funded by the European Union Seventh Framework Program (FP7/2007­2013) under grant agreement no. 604102 (HBP)

This work is part of SP8 of the Human Brain Project (SGA1).