The frontend for the internal ONS users to administer collection exercises, messages to and from respondents, etc
Install pipenv
pip install pipenvUse pipenv to create a virtualenv and install dependencies
pipenv installAnd run the application using
pipenv run python run.pyAlternatively run with gunicorn
pipenv run gunicorn -b 0.0.0.0:8085 response_operations_ui:app -w=4Alternatively run with Make
This command will build all the requirements
make buildThis command will run the application
make startWhen the application is running and you are required to sign-in, you will need an authenticated account, but for now the username and password are 'user' and 'pass'
make load-design-system-templates
This command will take the version number defined in the .design-system-version file and download the templates for that version of the Design System. It will also be automatically run when running make start.
To update to a different version of the Design System:
- update the version number in the
.design-system-versionfile - run
make load-design-system-templatesscript
Styling and frontend scripts are implemented using scss and javascript. You can find the minimised files in the static folder and the working files in the assets folder.
Each of these working files are minimised into respective css and js files which are loaded when the application is run.
The scss files are minimised into one file, all.css and the js files are minimised into two files, main.js.min and
selected_ci_functions.min.js
It is a manual step to minimise the JavaScript and scss.
Ensure you have Node.js version >=24 installed. The recommended way to do this is to use Creationix Node Version Manager, which works on Linux and MacOSX systems:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bashAfter this, run
nvm installto select the version specified in .nvmrc
Then to install the necessary node packages and minify files, run:
npm install
make minifyEnsure dev dependencies have been installed
pipenv install --devRun tests with coverage
pipenv run python run_tests.pyRun linting (the travis build sets a custom max line length)
pipenv check --style . --max-line-length 120Run tests with Make
make testor if you wish to generate an HTML report viewable at htmlcov/index.html
make test-htmlIf you get a Too many open files error, then run the following to fix it
ulimit -Sn 10000If isort is making GitHub Actions fail with incorrectly sorted imports, check if a folder called flask session was created. Delete this and run the linting process again with
make lintThis app seems to have a problem working locally in incognito mode and through selenium tests. The problem can be traced to Talisman, disabling talisman allows the app to run locally in incognito and also allows acceptance tests to run without strange errors.
The helm chart makes test.enabled available which does the following:
- disables WTF csrf
- disables Flask Talisman
- disables the restriction on not being able to create collection exercise dates in the past By default this config is set to False giving us the full security that Talisman and CSRFProtect offers. NB. the issue with testing only appears when running on a local setup, there is no such issue in preprod. It doesn't seem to work locally even if you change your /etc/hosts to simulate a FQDN with a standard TLD.
The combination of this config change for testing allows us to run the app for local development and also allows us to run acceptance tests through selenium.