Uweheuerfrontend: Difference between revisions
| Line 19: | Line 19: | ||
* via npm | * via npm | ||
npm run build:local_docker // see package.json | npm run build:local_docker // see package.json | ||
npm run build:local_dev // see package.json | |||
** calls | ** calls | ||
ng build --configuration=local_docker // see angular.json | ng build --configuration=local_docker // see angular.json | ||
Revision as of 22:18, 4 March 2023
Documentation
- see
C:\Uwes\owncloud\documents\Software_Development\MyDevelopments\uweheuer.drawio
Installation
Raspberry
- Git installation
- Node.js installation
- Angular installation
- Clone repositories
uwe@raspberrypi4:~/SoftwareProjects/eclipse-workspace $ gh repo clone UweHeuer/uweheuer-frontend uwe@raspberrypi4:~/SoftwareProjects/uweheuer-frontend $ npm install uwe@raspberrypi4:~/SoftwareProjects/uweheuer-frontend $ npm audit fix
API
Build
Development Laptop
- via npm
npm run build:local_docker // see package.json npm run build:local_dev // see package.json
- calls
ng build --configuration=local_docker // see angular.json
- access
frontend
Raspberry
uwe@raspberrypi4:~/SoftwareProjects/uweheuer-frontend $ git pull uwe@raspberrypi4:~/SoftwareProjects/uweheuer-frontend $ ng build --configuration=local_docker --base-href /fwdtest/ // base-ref is needed for running behind the Raspberry 3B proxy
Docker
docker build --tag uweheuerfrontend .
nginx.conf
- copy a standard nginx.conf from a running container to get a start
docker cp uweheuer-backend-frontend-1:/etc/nginx/nginx.conf nginx.conf copy nginx.conf uweheuer-frontend-nginx.conf del nginx.conf docker cp uweheuer-backend-frontend-1:/etc/nginx/conf.d/default.conf default.conf
Run
Local
- see
angular.json
ng serve --configuration local_docker ng serve --configuration local_dev
Docker
docker run --name uweheuerfrontendcontainer -d -p 82:80 uweheuerfrontend
Docker Compose
- see UweHeuer Backend
Application State
/services/application-state.ts- manages the application state as BehaviorSubject, a sub-type of Observable and expose the state as Observable
/services/application-state.service.ts- in ctor:
- subscribe to Angular SWUpdate service
- setup regular SW version check
- in ctor:
- for communication with the side area and content there is a dedicated service in
sidenav.service.ts:- offers a toggle method for the side area which is called in the header burger menu
- definition in
app.component.html - in corresponding ts code:
- set the DOM object '#mysidenav' side area in the sidenav service