Skip to content

OS2agora/Agora-Internal-UI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 

Repository files navigation

OS2AGORA - Hearing Portal Internal UI

This repository contains the internal UI for the Hearing Portal. The repository is part of the overall solution, which also consists of another frontend and a backend.

Hearing Portal Public UI is located here: Github Hearing Portal API is located here: Github

Technologies

The following technologies have been used to build the solution.

Required tools

The following tools are required to run and work with the solution.

Getting Started

The solution can be run locally both inside a Docker container and in regular fashion using Node. For local development, it is recommended that the solution is executed using Node. Both guides assume that the tools from the Required tools section are installed on the machine.

Configuration

The application requires a minimum of configuration before it runs. Configuration is done using environment variables. Due to the nature of how webpack handles process.env, some functionality exists to push some environment variables to the browser. The general rule is that variables named with a prefix REACT_APP_EXT are delivered to the browser in window.__ENV. This functionality relies on the npm package @beam-australia/react-env.

Configuring docker images

Provide the variable REACT_APP_EXT_BASE_API_URL to the container once it starts. This has to point to the base api address, for instance https://dhp-intern.balk.dk/api.

Configuring for local development

The @beam-australia/react-env is based on converting .env files, so it looks for these and picks up any environment variables it sees. To provide for the application during development, create a .env.local file in the app folder with the following content.

REACT_APP_EXT_BASE_API_URL=https://localhost:5001/api
REACT_APP_EXT_TARGET_ENV=development
REACT_APP_EXT_X_API_HEADER=<KEY_HERE>

Note that this assumes the api is running on https://localhost:5001 which is only the case if it runs from Visual Studio. Further, only the base api url is strictly necessary. The remaining variables are for file download functionality if not going through the proxy provided by docker.

Running locally using Node

  1. Download solution from Github

  2. In the /app folder, run one of the following commands to install the required dependencies

    yarn 
    yarn install

NB if step 2 fails, with a node-gyp error, you might need to install a different version of node for it to work, and some other things. See the section about fixing node-gyp errors below.

  1. From the project root, navigate to /docker/environments/ and add the required environment variables to docker_development.env. The environment variables can be found in /docker/environments/example.env

  2. Start the application using the following command

    yarn start
  3. Using a browser, navigate to http://localhost:4000 and validate that the site is up and running

Fixing node-gyp errors

  • Uninstall chocolatey (deleting the folder C:\ProgramData\chocolatey)
  • Resetting config (only if you've made changes like:npm config set <something> eg: npm config set python C:\Python27\python.exe)
    • npm config edit brings up a text file in which you can delete the config changes you've made followed by saving the file and closing it.
  • Uninstall Node
  • Remove any npm/node folders in %AppData% (press windows button and type %AppData% followed by "Enter")
    • Check all 3 AppData folders (Local, LocalLow and Roaming)
  • Install Node 4.17.6 (https://nodejs.org/en/blog/release/v14.17.6/) with dependencies for node (ticked on during install)
  • Having VS Build Tools 2017 installed
    • Got installed by running npm install --global windows-build-tools
    • Initially this command hung, but the installer was fetched and placed in C:\Users\<username>\.windows-build-tools named vs_BuildTools.exe.

Running locally using Docker

  1. Download solution from Github

  2. From the project root, navigate to /docker/environments/ and add required the environments variables to docker_development.env. The environment variables can be found in /docker/environments/example.env

  3. In the /docker folder, run the following command to build a docker image of the solution

    $ docker-compose -f docker-compose.development.yml build

    *Starting this solution in Docker requires the backend project to be up and running, as this uses a shared network that is defined in the backend Docker setup.

  4. In the /docker folder, run the following command in WSL2 to start the docker container of the solution

    $ docker-compose -f docker-compose.development.yml up
  5. Using a browser, navigate to http://localhost:4000 and validate that the site is up and running

  6. If your API is running in Docker you will need to alter a file called bootstrapSlice.js. It is located in src/features. You need to change the baseUrlConfiguration.development url to use port 8080, if you have the api proxy running on port 8080.


Official Create-react-app documentation

This project was bootstrapped with Create React App, using the Redux and Redux Toolkit template.

Available Scripts

In the project directory, you can run:

yarn start

Runs the app in the development mode.
Open http://localhost:4000 to view it in the browser.

The page will reload if you make edits.
You will also see any lint errors in the console.

yarn test

Launches the test runner in the interactive watch mode.
See the section about running tests for more information.

yarn build

Builds the app for production to the build folder.
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.
Your app is ready to be deployed!

See the section about deployment for more information.

yarn eject

Note: this is a one-way operation. Once you eject, you can’t go back!

If you aren’t satisfied with the build tool and configuration choices, you can eject at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (Webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except eject will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use eject. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

Learn More

You can learn more in the Create React App documentation.

To learn React, check out the React documentation.

Code Splitting

This section has moved here: https://facebook.github.io/create-react-app/docs/code-splitting

Analyzing the Bundle Size

This section has moved here: https://facebook.github.io/create-react-app/docs/analyzing-the-bundle-size

Making a Progressive Web App

This section has moved here: https://facebook.github.io/create-react-app/docs/making-a-progressive-web-app

Advanced Configuration

This section has moved here: https://facebook.github.io/create-react-app/docs/advanced-configuration

Deployment

This section has moved here: https://facebook.github.io/create-react-app/docs/deployment

yarn build fails to minify

This section has moved here: https://facebook.github.io/create-react-app/docs/troubleshooting#npm-run-build-fails-to-minify

About

Internal UI for the OS2Agora solution

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages