Blaise Dashboard for accessing active surveys and CATI dashboard.
This project is a React application which when build is rendered by a Node.js express server.
To run Telephone Operations Blaise Interface locally, you'll need to have Node installed, as
well as yarn. NOTE: On linux there is an issue where It
may install the wrong tool (cmdtest
for some reason) which there is
a solution.
To have the list of instruments load on the page, you'll need to have Blaise Rest API running locally (On a Windows machine), or you can create an IAP tunnel from a GCP Compute Instance running the rest API in a sandbox.
gcloud compute start-iap-tunnel restapi-1 80 --local-host-port=localhost:5011 --zone europe-west2-a
Clone the Repo
git clone https://github.com/ONSdigital/telephone-operations-blaise-interface.git
Create a new .env file and add the following variables.
Variable | Description | Var Example |
---|---|---|
PORT | Optional variable, specify the Port for express server to run on. If not passed in this is set as 5000 by default. It's best not to set this as the react project will try and use the variable as well and conflict. By default React project locally runs on port 3000. |
5009 |
VM_EXTERNAL_WEB_URL | External Url used for CATI dashboard and survey links. | tel-client-server.uk |
VM_EXTERNAL_CLIENT_URL | External link to connect to Blaise remotely through Blaise Server Manager. | tel-web-server.uk |
BLAISE_API_URL | Url that the Blaise Rest API is running on to send calls to. | localhost:90 |
BIMS_API_URL | Url that the Blaise Information Metadata Services is running on to send calls to. | https://bims.com |
The .env
file should be setup as below
VM_EXTERNAL_WEB_URL='tel-client-server.uk'
VM_EXTERNAL_CLIENT_URL='tel-web-server.uk'
BLAISE_API_URL='http://localhost:5011'
BIMS_API_URL='https://bims-url'
Install required modules
yarn
The following run commands are available, these are all setup in the package.json
under scripts
.
Command | Description |
---|---|
yarn start-server |
Start the express server, Note: For the website to be rendered the React Project will need to be built. |
yarn start-react |
Starts react project in local development setup with quick reloading on making changes. Note: For instruments to be shown the server needs to be running. |
yarn build-react |
Compiles build project ready to be served by express. The build in outputted to the the build directory which express points to with the var buildFolder in server/server.js . |
yarn test |
Runs all tests for server and React Components and outputs coverage statistics. |
Setup express project that handles the requests to the Blaise Rest API. By default, will be running on PORT 5000.
yarn start-server
Next to make sure the React project make requests the express server make sure the proxy option is set to the right port in the 'package.json'
"proxy": "http://localhost:5000",
Run the React project for local development. By default, this will be running on http://localhost:3000/
yarn start-react
To test express sever serving the React project, you need to compile the React project, then you can see it running at http://localhost:5000/
yarn build-react
The Jest testing framework has been set up in this project, all tests currently reside in
the tests
directory. This currently only running tests on the health check endpoint, haven't got the hang of mocking
Axios yet.
To run all tests run
yarn test
Running yarn or yarn install will install the required modules specified in the yarn.lock file.
The versions of theses modules are fixed in the yarn.lock files, so to avoid unwanted upgrades or instability caused by incorrect modifications, DO NOT DELETE THE LOCK FILE.
More information about yarn (https://confluence.ons.gov.uk/x/zdwACQ)
To deploy the locally edited service to app engine in your environment, you can run trigger the cloudbuild trigger with the following line, changing the environment variables as needed.
gcloud builds submit --substitutions=_PROJECT_ID=ons-blaise-v2-dev-matt-54,_VM_INTERNAL_URL=test,_VM_EXTERNAL_WEB_URL=test,_VM_EXTERNAL_CLIENT_URL=test,_BLAISE_API_URL=/
Copyright (c) 2021 Crown Copyright (Government Digital Service)