Sensitivity Calculator UI

The Sensitivity Calculator is an application for calculating the sensitivity of the SKA Mid-Frequency Aperture Array.

This Project was generated with Angular CLI version 13.

## Development server

Run npm start for a dev server. Navigate to http://localhost:4200/sensitivity-calculator. The app will automatically reload if you change any of the source files.

The necessary steps are:

  1. Install Git if you don’t already have it.

To find if Git is installed on your computer, type in a terminal: git –version. The output will either say which version of Git is installed, or that git is an unknown command.

If Git is not there, point your browser to https://git-scm.com/book/en/v2/Getting-Started-Installing-Git and follow the instructions for installation.

  1. Clone the sensitivity calculator from the SKA Git repository by moving to the destination directory on your machine, and typing: git clone https://gitlab.com/ska-telescope/ost/ska-ost-senscalc-ui.git.

  2. Run npm start for a dev server. Navigate to http://localhost:4200/sensitivity-calculator.

Enter the code directory with: cd ska-ost-senscalc-ui ## Code scaffolding

Run ng generate component component-name to generate a new component. You can also use ng generate directive|pipe|service|class|guard|interface|enum|module.

## Build

Run ng build to build the project. The build artifacts will be stored in the dist/ directory.

## Running unit tests

Run make test to execute the unit tests.

## Running static code analysis

Run make lint to lint the code.

## Installing project dependencies

Run make install_dependencies to install latest project dependencies from package.json and package-lock.json

### Deploying to Kubernetes

Makefiles with common targets are available in the submodule. To build the Docker image run the following

` make oci-build-all `

The umbrella Helm chart can then be deployed with

` make k8s-install-chart `

and uninstalled with ` make k8s-uninstall-chart `

Once installed, the UI should then be available externally at http://<HOST_IP>/<KUBE_NAMESPACE>/sensitivity-calculator/. If using minikube, run minikube ip to find the host IP. KUBE_NAMESPACE is set to ska-ost-senscalc-ui by default. The backend component will also be deployed to a separate pod, which the web application will make requests to.

## Running integration (Cypress) tests

Run npm run cypress:run to execute integration tests locally. This requires the application to be running. Note that this also requires the SC back-end to be running and available at the location defined in the [runtime-configuration.json file](./src/ska_ost_senscalc_ui/assets/runtime-configuration.json).

To run integration tests in Kubernetes:

  1. Deploy the application to k8s (see above)

  2. Set the baseUrl in cypress.json to point to http://<HOST_IP>/<KUBE_NAMESPACE>/sensitivity-calculator/

  3. Run tests with npm run cypress:run

## Deploying to Review Environment

The review environment is specific for each MR and is hosted on STFC and is live for two hours after it’s deployed.

There are two review jobs:
  • deploy_review_ui: This only deploys the frontend and API_BACKEND_URL must be set correctly when triggering the job otherwise the frontend won’t be able to talk to the backend. The backend is deployed similarly from its own repository.

  • deploy_review_umbrella: This job deploys both the frontend and backend to the same namespace. The backend used is defined in the chart and a published image in contrast to the above so it’s easier to review just the frontend.

The review jobs are automatically run for every push for a branch and can be accessed as https://k8s.stfc.skao.int/<BRANCH_NAME>. They can be stopped by triggering the stop_review job manually from the pipeline.

## Deploying to Staging Environment

The staging environment is a long living deployment in STFC and can be controlled from the manual jobs from the master branch.

There are two environments similar to review environments for only frontend and both frontend and backend. Only difference is with the umbrella chart, API_BACKEND_URL is set automatically to the staging backend service.

## Deploying to Production environment

Master branch chart can be deployed to production at any time by using the pipeline jobs in deploy stage by triggering a deploy job. Similarly, the existing deployment can be stopped using the stop jobs or GitLab’s environment page by following here: https://gitlab.com/ska-telescope/ost/ska-ost-senscalc/-/environments/11337767

The deployment is done against a AWS cluster where the access is restricted.

### Restrictions

The production environment is called production-ska-ost-senscalc in GitLab’s UI and can be seen from here: https://gitlab.com/ska-telescope/ost/ska-ost-senscalc/-/environments/11337767 Only the maintainers can make a deployment and all deployments should be approved from the above interface when a new job is triggered for deployment. These settings can be changed by the project owner or the team-system if needed.

## Documentation

Documentation and a User Guide can be found in the docs folder

## Further help

[![Documentation Status](https://readthedocs.org/projects/ska-telescope-ska-ost-senscalc/badge/?version=latest)](https://developer.skao.int/projects/ska-ost-senscalc/en/latest/?badge=latest)

To get more help on the Angular CLI use ng help or go check out the [Angular CLI Overview and Command Reference](https://angular.io/cli) page.