diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..52320c29699cc48505246cd4d72dc423bb4430da --- /dev/null +++ b/Dockerfile @@ -0,0 +1,12 @@ +# --- STAGE 1: Build +FROM node:14.18-alpine AS build +WORKDIR /usr/src/app +COPY package.json package-lock.json ./ +RUN npm install +COPY . . +RUN npm run build + +# ---STAGE 2: Run +FROM nginx:1.17.1-alpine +COPY nginx.conf /etc/nginx/nginx.conf +COPY --from=build /usr/src/app/dist/MainApp /usr/share/nginx/html \ No newline at end of file diff --git a/README.md b/README.md index b0e7002fd79eac7ce9151c5c1702d02b5e9c15a7..fc8928232cab06fadcc52f17c52e9f3c9d7a6d91 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,70 @@ -# MainApp +# Frontend App -This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.9. +## Messages -## Development server +- Public MQTT brocker from [hivemq](https://www.hivemq.com/public-mqtt-broker/). + - `ipos/client/position`: relative position of an agent to a curent root point + - `ipos/client/root`: update a root point. Default is `{"latitude": 51.02545, "longitude": 13.72295}`. +- Messages description: [SimpleSceneIntegration Interface](https://md.inf.tu-dresden.de/IPos_IFSimpleSceneIntegration). -Run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. -## Code scaffolding +## Run +- 1. Install all dependency and run `ng serve` for a dev server. Navigate to `http://localhost:4200/`. The app will automatically reload if you change any of the source files. + - if you don't want to install all dependencies, you can simply run the application in a container. + 1. `docker build -t frontend-osm .` + 2. `docker run -p 4200:80 frontend-osm:latest` + 3. Navigate to `http://localhost:4200/` +- 2. Send messages to a `hivemq` public brocker + - topic `ipos/client/position` + - new positions + - ```json + { + "object": [ + { + "id": "Employee1", + "sensorId": "UWB_1", + "type": "HUMAN", + "sensorType": "UWB", + "position": { + "refSystemId": "ROOT", + "point": { + "x": 13, + "y": 22, + "z": 3 + }, + "accuracy": 1 + }, + "orientation": { + "x": 1, + "y": 0.5, + "z": 1, + "w": 1.5 + }, + "lastPosUpdate": "2021-09-14T09:41:20+00:00" + } + ], + "type": "EntryNotification" + } + ``` + - More objects can be added to the `"object": []` + - There are special colours for objects with id `"Employee1"` - `"Employee4"`. Config: [MarkerColorMap](src/environments/environment.ts) + - topic `ipos/client/root` + - ```json + { + "refSystemId": "ROOT", + "point": { + "latitude": 51.02535, + "longitude": 13.72285 + }, + "accuracy": 1 + } + ``` -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. +## Help +- This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 12.2.9. +- Run `ng build` to build the project. The build artifacts will be stored in the `dist/` directory. +- 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`. +- Validate JSON: [jsonformatter.org](https://jsonformatter.org/) -## Running unit tests - -Run `ng test` to execute the unit tests via [Karma](https://karma-runner.github.io). - -## Running end-to-end tests - -Run `ng e2e` to execute the end-to-end tests via a platform of your choice. To use this command, you need to first add a package that implements end-to-end testing capabilities. - -## Further help - -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. diff --git a/nginx.conf b/nginx.conf new file mode 100644 index 0000000000000000000000000000000000000000..4b93bdca454b130338d4b1b48d33a3b4e683eef3 --- /dev/null +++ b/nginx.conf @@ -0,0 +1,17 @@ +events{} + +http { + + include /etc/nginx/mime.types; + + server { + listen 80; + server_name frontendOSM; + root /usr/share/nginx/html; + index index.html; + + location / { + try_files $uri $uri/ /index.html; + } + } +} diff --git a/src/favicon.ico b/src/favicon.ico index 997406ad22c29aae95893fb3d666c30258a09537..1f6eaacef448b7dd372818e93ab05d15225817c7 100644 Binary files a/src/favicon.ico and b/src/favicon.ico differ