cbioportal-frontend

by Rgtemze

GitHub Readme.md

cbioportal-frontend

Join the chat at https://gitter.im/cBioPortal/public-chat

Live demo

Master: http://cbioportal-frontend.herokuapp.com/patient?studyId=prad_fhcrc&caseId=00-090

Rc: http://cbioportal-frontend-rc.herokuapp.com/patient?studyId=prad_fhcrc&caseId=00-090

Test status & Code Quality

Branch master rc Status CircleCI CircleCI

codecov

Code Climate

Deployment

Deploy

This is the frontend code for cBioPortal using React, MobX and TypeScript. The frontend for the new patient view is now completely in this repo. The results view page is currently being replaced one tab at a time by mounting certain React components to the results page (JSP) in the backend repo

Make sure you have installed the node version specified in package.json. You might want to use NVM to install the particular version.

Remove old compiled node_modules if exists

rm -rf node_modules

To install all app and dev dependencies

yarn install --frozen-lockfile

To build DLLs in common-dist folder (must be done prior to start of dev server)

yarn run buildDLL:dev

To start dev server with hot reload enabled

# set the environment variables you want based on what branch you're branching
# from
export BRANCH_ENV=master # or rc if branching from rc
# export any custom external API URLs by editing env/custom.sh
yarn run start

Example pages:

To run unit/integration tests (need to have API URL defined in .env)

yarn run test

To run unit/integration tests in watch mode

yarn run test:watch

To run unit/integration tests in watch mode (where specName is a fragment of the name of the spec file (before .spec.))

yarn run test:watch -- --grep=#specName#

To run linting

yarn run lint

precommit hook

There is a precommit hook installed that lint checks the typescript in this project. The hook can be viewed in package.json. You can skip it with

git commit -n

Changing the URL of API

If the version of the desired API URL is the same as the one used to generate the typescipt client, one can change the API_ROOT variable for development in my-index.ejs. If the version is different, make sure the API endpoint works with the checked in client by changing the API URL in package.json and running:

# set the environment variables you want based on what branch you're branching
# from
export BRANCH_ENV=master # or rc if branching from rc
# export any custom external API URLs by editing env/custom.sh
yarn run updateAPI
yarn run test

Check in cBioPortal context

Go to http://cbioportal.org (master branch) or http://cbioportal.org/beta/ (rc branch)

In your browser console set:

localStorage.setItem("localdev",true)

This will use whatever you are running on localhost:3000 to serve the JS (i.e. you need to have the frontend repo running on port 3000). To unset do:

localStorage.setItem("localdev",false)

or clear entire local storage

localStorage.clear()

You can also use a heroku deployed cbioportal-frontend pull request for serving the JS by setting localStorage to:

localStorage.setItem("heroku", "cbioportal-frontend-pr-x")

Change x to the number of your pull request.

Run e2e tests

Install webdriver-manager, which manages standalone Selenium installation:

yarn install -g webdriver-manager

Run updater to get necessary binaries

webdriver-manager update

Start the webdriver-manager

webdriver-manager start

In one terminal run frontend (this will get mounted inside whatever CBIOPORTAL_URL is pointing to)

# set the environment variables you want based on what branch you're branching
# from
export BRANCH_ENV=master # or rc if branching from rc
# export any custom external API URLs by editing env/custom.sh
yarn run start

In another terminal run the e2e tests

# set the environment variables you want based on what branch you're branching
# from
export BRANCH_ENV=master # or rc if branching from rc
# export any custom external API URLs in env/custom.sh
cd end-to-end-tests
yarn install
yarn run test-webdriver-manager