From 1ebfe082b5fa6527756818dd9400be8cc82a4ba0 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 2 Dec 2020 10:57:25 +0100 Subject: [PATCH 01/12] Add docker action Signed-off-by: trivernis --- .github/workflows/docker.yml | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 .github/workflows/docker.yml diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 0000000..625a195 --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,45 @@ +name: Build Docker Image + +on: + push: + branches: [ main, actions ] + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + steps: + + - name: Copy Repo Files + uses: actions/checkout@master + + - name: Set up QEMU + uses: docker/setup-qemu-action@v1 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v1 + + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.CR_PAT }} + + - name: Login to Portus + uses: docker/login-action@v1 + with: + registry: https://flotte-docker-registry.spdns.org/ + username: ${{ secrets.PORTUS_USERNAME }} + password: ${{ secrets.PORTUS_PASSWORD }} + + - name: Build and push + uses: docker/build-push-action@v2 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm/v7,linux/arm64 + push: true + tags: | + flotte-docker-registry.spdns.org/frontend-server:latest + ghcr.io/flotte-meets-hwr-db/frontend/frontend-server From 46477a47dcdcfdb205da262b3f1f156f331f998c Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 2 Dec 2020 10:58:24 +0100 Subject: [PATCH 02/12] Remove github container registry Signed-off-by: trivernis --- .github/workflows/docker.yml | 8 -------- 1 file changed, 8 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 625a195..8001f3e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -19,13 +19,6 @@ jobs: - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Login to GitHub Container Registry - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.CR_PAT }} - - name: Login to Portus uses: docker/login-action@v1 with: @@ -42,4 +35,3 @@ jobs: push: true tags: | flotte-docker-registry.spdns.org/frontend-server:latest - ghcr.io/flotte-meets-hwr-db/frontend/frontend-server From 7af1efa24fc1052b133c3564d214ba10617717bf Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 2 Dec 2020 11:14:20 +0100 Subject: [PATCH 03/12] Add python setup for node-gyp Signed-off-by: trivernis --- .github/workflows/docker.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 8001f3e..d68c812 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,6 +12,12 @@ jobs: - name: Copy Repo Files uses: actions/checkout@master + - + name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.x' + architecture: 'x64' - name: Set up QEMU uses: docker/setup-qemu-action@v1 From 988b4cf7fb3ce6ebe5b2758395378e7d6797bf2f Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 2 Dec 2020 11:15:23 +0100 Subject: [PATCH 04/12] Fix yaml syntax error Signed-off-by: trivernis --- .github/workflows/docker.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d68c812..a237e61 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -15,9 +15,9 @@ jobs: - name: Set up Python uses: actions/setup-python@v2 - with: - python-version: '3.x' - architecture: 'x64' + with: + python-version: '3.x' + architecture: 'x64' - name: Set up QEMU uses: docker/setup-qemu-action@v1 From 94af6befd0a9bd679c9c162856f1a4b731db99a6 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 2 Dec 2020 11:27:51 +0100 Subject: [PATCH 05/12] Remove multiarch and add python to Dockerfile Signed-off-by: trivernis --- .github/workflows/docker.yml | 8 +------- Dockerfile | 3 ++- 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a237e61..ed87270 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -12,12 +12,6 @@ jobs: - name: Copy Repo Files uses: actions/checkout@master - - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: '3.x' - architecture: 'x64' - name: Set up QEMU uses: docker/setup-qemu-action@v1 @@ -37,7 +31,7 @@ jobs: with: context: . file: ./Dockerfile - platforms: linux/amd64,linux/arm/v7,linux/arm64 + platforms: linux/amd64 #,linux/arm/v7,linux/arm64 push: true tags: | flotte-docker-registry.spdns.org/frontend-server:latest diff --git a/Dockerfile b/Dockerfile index a33ada4..9ca613e 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,6 +1,7 @@ FROM node:14.14.0-alpine3.10 AS builder WORKDIR / COPY package.json package-lock.json ./ +RUN apk add --no-cache python3 RUN npm install && npm install -g @angular/cli && mkdir frontend RUN mv node_modules ./frontend WORKDIR /frontend @@ -12,7 +13,7 @@ FROM golang:1.13.4-alpine as builder2 ARG ARCH=amd64 RUN apk add git WORKDIR / -COPY --from=builder /frontend/dist /dist +COPY --from=builder /frontend/dist /dist RUN go get github.com/rakyll/statik RUN statik --src=/dist/flotte-frontend COPY *.go *.sum *.mod / From 63f6104e20746ecc86fa3617d110fccc7f64cfe2 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 2 Dec 2020 11:33:09 +0100 Subject: [PATCH 06/12] Add multiarch again but remove actions push hook Signed-off-by: trivernis --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ed87270..5dc27e0 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,7 +2,7 @@ name: Build Docker Image on: push: - branches: [ main, actions ] + branches: [ main ] workflow_dispatch: jobs: @@ -31,7 +31,7 @@ jobs: with: context: . file: ./Dockerfile - platforms: linux/amd64 #,linux/arm/v7,linux/arm64 + platforms: linux/amd64,linux/arm/v7,linux/arm64 push: true tags: | flotte-docker-registry.spdns.org/frontend-server:latest From 0c5467b3cad30c183747892894d1ad878d13e27c Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 2 Dec 2020 11:34:19 +0100 Subject: [PATCH 07/12] Add status badge to README Signed-off-by: trivernis --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index eadd3e0..e733c3e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # FlotteFrontend -[![Build Status](https://travis-ci.com/fLotte-meets-HWR-DB/frontend.svg?token=YfRmpHAXqyUafCgSEexw&branch=master)](https://travis-ci.com/fLotte-meets-HWR-DB/frontend) +![Build Docker Image](https://github.com/fLotte-meets-HWR-DB/frontend/workflows/Build%20Docker%20Image/badge.svg) This project was generated with [Angular CLI](https://github.com/angular/angular-cli) version 10.0.8. @@ -59,4 +59,4 @@ We can't pass it in an other form, else it would not be possible to pass a value If the backend url changes, it has to be changed in the following files: - ./src/environments/ - ./apollo.config.js for autocompletion when writing queries etc. -- ./codegen.yml for graphQL codegen (to generate schema, types etc.) \ No newline at end of file +- ./codegen.yml for graphQL codegen (to generate schema, types etc.) From 37e2b871a0c6edb2bd72cc6335e843e37a694aff Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 2 Dec 2020 11:35:14 +0100 Subject: [PATCH 08/12] Add master branch to push hooks Signed-off-by: trivernis --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 5dc27e0..d15e50d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -2,7 +2,7 @@ name: Build Docker Image on: push: - branches: [ main ] + branches: [ main, master ] workflow_dispatch: jobs: From d3719acfcf11727a249d35d77485ffe2681b42db Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 2 Dec 2020 11:49:01 +0100 Subject: [PATCH 09/12] Add alpine build-base package to Dockerfile Signed-off-by: trivernis --- Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Dockerfile b/Dockerfile index 9ca613e..a4bc160 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,7 +1,7 @@ FROM node:14.14.0-alpine3.10 AS builder WORKDIR / COPY package.json package-lock.json ./ -RUN apk add --no-cache python3 +RUN apk add --no-cache python3 build-base RUN npm install && npm install -g @angular/cli && mkdir frontend RUN mv node_modules ./frontend WORKDIR /frontend From c35500ba7fc2a5f6276e801cafffb86bd708efc0 Mon Sep 17 00:00:00 2001 From: trivernis Date: Wed, 2 Dec 2020 12:34:50 +0100 Subject: [PATCH 10/12] Remove multiarch Signed-off-by: trivernis --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d15e50d..881ac7f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -31,7 +31,7 @@ jobs: with: context: . file: ./Dockerfile - platforms: linux/amd64,linux/arm/v7,linux/arm64 + platforms: linux/amd64 push: true tags: | flotte-docker-registry.spdns.org/frontend-server:latest From 18f64b1c5506d94e93cad382390fc7cb324b732a Mon Sep 17 00:00:00 2001 From: FlayInAHook Date: Wed, 2 Dec 2020 15:28:07 +0100 Subject: [PATCH 11/12] WIP profile page --- src/app/app-routing.module.ts | 2 + src/app/app.module.ts | 2 + .../sidenav-profile.component.html | 2 +- src/app/pages/profile/profile.component.html | 71 ++++++- src/app/pages/profile/profile.component.scss | 18 ++ src/app/pages/profile/profile.component.ts | 173 ++++-------------- 6 files changed, 126 insertions(+), 142 deletions(-) diff --git a/src/app/app-routing.module.ts b/src/app/app-routing.module.ts index 93302a0..b4c7ed2 100644 --- a/src/app/app-routing.module.ts +++ b/src/app/app-routing.module.ts @@ -12,10 +12,12 @@ import { LendingStationsComponent } from './pages/tables/lending-stations/lendin import { ParticipantsComponent } from './pages/tables/participants/participants.component'; import { TimeFramesComponent } from './pages/tables/time-frames/time-frames.component'; import {AuthGuard} from './helper/auth.guard'; +import { ProfileComponent } from './pages/profile/profile.component'; const routes: Routes = [ { path: 'login', component: LoginComponent }, { path: 'tableOverview', component: TableOverviewComponent, canActivate: [AuthGuard]}, + { path: 'profile', component: ProfileComponent, canActivate: [AuthGuard]}, { path: 'table/bikes', component: BikesComponent, canActivate: [AuthGuard] }, { path: 'bike/:id', component: BikeComponent, canActivate: [AuthGuard] }, { path: 'table/participants', component: ParticipantsComponent, canActivate: [AuthGuard] }, diff --git a/src/app/app.module.ts b/src/app/app.module.ts index 6ab213a..9505330 100644 --- a/src/app/app.module.ts +++ b/src/app/app.module.ts @@ -65,6 +65,7 @@ import { DateRangeCellComponent } from './components/tableComponents/date-range- import { SelectObjectDialogComponent } from './components/select-object-dialog/select-object-dialog.component'; import { AutocompleteSelectComponent } from './components/autocomplete-select/autocomplete-select.component'; import { LendingStationComponent } from './pages/dataPages/lending-station/lending-station.component'; +import { ProfileComponent } from './pages/profile/profile.component'; @@ -94,6 +95,7 @@ import { LendingStationComponent } from './pages/dataPages/lending-station/lendi SelectObjectDialogComponent, AutocompleteSelectComponent, LendingStationComponent, + ProfileComponent, ], imports: [ BrowserModule, diff --git a/src/app/components/sidenav-profile/sidenav-profile.component.html b/src/app/components/sidenav-profile/sidenav-profile.component.html index 832786d..275b3cd 100644 --- a/src/app/components/sidenav-profile/sidenav-profile.component.html +++ b/src/app/components/sidenav-profile/sidenav-profile.component.html @@ -1,4 +1,4 @@ -
+

{{name}}

{{email}}

diff --git a/src/app/pages/profile/profile.component.html b/src/app/pages/profile/profile.component.html index ecca39d..c6d690f 100644 --- a/src/app/pages/profile/profile.component.html +++ b/src/app/pages/profile/profile.component.html @@ -1,4 +1,71 @@ - +

Profil aktualisieren

+ + + Aktuelles Passwort + + + Bitte geben Sie Ihr Passwort ein. + + + + + + + E-Mail-Adresse eingeben + + + Bitte geben Sie eine E-Mail-Adresse ein. + + + Bitte geben Sie eine valide E-Mail-Adresse ein. + + + + + Passwort eingeben + + + Bitte geben Sie Ihr Passwort ein. + + + + + + +
+ + + + diff --git a/src/app/pages/profile/profile.component.scss b/src/app/pages/profile/profile.component.scss index e69de29..5e33d01 100644 --- a/src/app/pages/profile/profile.component.scss +++ b/src/app/pages/profile/profile.component.scss @@ -0,0 +1,18 @@ +#login-form { + display: flex; + flex-direction: column; + max-width: 32em; + min-width: 5em; + margin: auto; + margin-top: 3em; + padding: 1em; + .mat-form-field { + margin: 0.5em 0; + } + #loading-bar { + margin-bottom: 1em; + } + .login-error-message { + margin-top: 0.5em; + } +} \ No newline at end of file diff --git a/src/app/pages/profile/profile.component.ts b/src/app/pages/profile/profile.component.ts index b970ac6..c1c3250 100644 --- a/src/app/pages/profile/profile.component.ts +++ b/src/app/pages/profile/profile.component.ts @@ -1,4 +1,7 @@ import { Component, OnInit } from '@angular/core'; +import { FormControl, Validators } from '@angular/forms'; +import { ActivatedRoute, Router } from '@angular/router'; +import { AuthService } from 'src/app/services/auth.service'; import { BikesService } from '../../services/bikes.service'; @Component({ @@ -7,149 +10,41 @@ import { BikesService } from '../../services/bikes.service'; styleUrls: ['./profile.component.scss'], }) export class ProfileComponent implements OnInit { - columnInfo = [ - { - dataPath: 'name', - translation: 'Name', - sticky: true, - link: (row: any) => { - return '/bike/' + row.id; - }, - }, - { dataPath: 'id', translation: 'ID', readonly: true }, - { dataPath: 'group', translation: 'Gruppe' }, - { dataPath: 'modelName', translation: 'Modell' }, - { - dataPath: 'insuranceData.billing', - translation: 'Versicherung Abrechnung', - }, - { dataPath: 'insuranceData.hasFixedRate', translation: 'Pauschale j/n' }, - { dataPath: 'insuranceData.fixedRate', translation: 'Pauschale Betrag' }, - { dataPath: 'insuranceData.name', translation: 'Versicherer' }, - { dataPath: 'insuranceData.benefactor', translation: 'Kostenträger' }, - { dataPath: 'insuranceData.noPnP', translation: 'Nr. P&P' }, - { - dataPath: 'insuranceData.maintenanceResponsible', - translation: 'Wartung zuständig', - }, - { - dataPath: 'insuranceData.maintenanceBenefactor', - translation: 'Wartung Kostenträger', - }, - { - dataPath: 'insuranceData.maintenanceAgreement', - translation: 'Wartungsvereinbarung', - }, - { - dataPath: 'insuranceData.projectAllowance', - translation: 'Projektzuschuss', - }, - { dataPath: 'insuranceData.notes', translation: 'Sonstiges' }, - { dataPath: 'dimensionsAndLoad.bikeLength', translation: 'Länge' }, - { dataPath: 'dimensionsAndLoad.bikeWeight', translation: 'Gewicht' }, - { dataPath: 'dimensionsAndLoad.bikeHeight', translation: 'Höhe' }, - { dataPath: 'dimensionsAndLoad.bikeWidth', translation: 'Breite' }, - { dataPath: 'dimensionsAndLoad.boxHeightRange', translation: 'Boxhöhe' }, - { dataPath: 'dimensionsAndLoad.boxLengthRange', translation: 'Boxlänge' }, - { dataPath: 'dimensionsAndLoad.boxWidthRange', translation: 'Boxbreite' }, - { - dataPath: 'dimensionsAndLoad.hasCoverBox', - translation: 'Boxabdeckung j/n', - }, - { dataPath: 'dimensionsAndLoad.lockable', translation: 'Box abschließbar' }, - { - dataPath: 'dimensionsAndLoad.maxWeightBox', - translation: 'max Zuladung Box', - }, - { - dataPath: 'dimensionsAndLoad.maxWeightLuggageRack', - translation: 'max Zuladung Gepäckträger', - }, - { - dataPath: 'dimensionsAndLoad.maxWeightTotal', - translation: 'max Gesamtgewicht', - }, - { dataPath: 'numberOfChildren', translation: 'Anzahl Kinder' }, - { dataPath: 'numberOfWheels', translation: 'Anzahl Räder' }, - { dataPath: 'forCargo', translation: 'für Lasten j/n' }, - { dataPath: 'forChildren', translation: 'für Kinder j/n' }, - { dataPath: 'security.frameNumber', translation: 'Rahmennummer' }, - { dataPath: 'security.adfcCoding', translation: 'ADFC Codierung' }, - { - dataPath: 'security.keyNumberAXAChain', - translation: 'Schlüsselnrummer Rahmenschloss', - }, - { - dataPath: 'security.keyNumberFrameLock', - translation: 'Schlüsselnrummer AXA-Kette', - }, - { dataPath: 'security.policeCoding', translation: 'Polizei Codierung' }, - { dataPath: 'technicalEquipment.bicycleShift', translation: 'Schaltung' }, - { dataPath: 'technicalEquipment.isEBike', translation: 'E-Bike j/n' }, - { - dataPath: 'technicalEquipment.hasLightSystem', - translation: 'Lichtanlage j/n', - }, - { - dataPath: 'technicalEquipment.specialFeatures', - translation: 'Besonderheiten', - }, - { dataPath: 'stickerBikeNameState', translation: 'Aufkleber Status' }, - { dataPath: 'note', translation: 'Aufkleber Kommentar' }, - { dataPath: 'taxes.costCenter', translation: 'Steuern Kostenstelle' }, - { - dataPath: 'taxes.organisationArea', - translation: 'Steuern Vereinsbereich', - }, - { dataPath: 'provider.id', translation: '' }, - { dataPath: 'provider.formName', translation: '' }, - { dataPath: 'provider.privatePerson.id', translation: '' }, - { dataPath: 'provider.privatePerson.person.id', translation: '' }, - { dataPath: 'provider.privatePerson.person.name', translation: '' }, - { dataPath: 'provider.privatePerson.person.firstName', translation: '' }, - { - dataPath: 'provider.privatePerson.person.contactInformation.email', - translation: '', - }, - { dataPath: 'lendingStation.id', translation: '' }, - { dataPath: 'lendingStation.name', translation: '' }, - { dataPath: 'lendingStation.address.number', translation: '' }, - { dataPath: 'lendingStation.address.street', translation: '' }, - { dataPath: 'lendingStation.address.zip', translation: '' }, - ]; + email = new FormControl('', [Validators.required, Validators.email]); + password = new FormControl('', [Validators.required]); + hide = true; + loading = false; + errorOccurred = false; + errorMessage = ''; - dataService: any; + returnUrl : string; - tableDataGQLType: string = 'CargoBike'; - tableDataGQLCreateInputType: string = 'CargoBikeCreateInput'; - tableDataGQLUpdateInputType: string = 'CargoBikeUpdateInput'; + constructor(private authService: AuthService, private router: Router, private route: ActivatedRoute) {} - headline = 'Lastenräder'; - - loadingRowIds: string[] = []; - constructor(private bikesService: BikesService) {} - - ngOnInit() { - this.dataService = this.bikesService; - } - - create(object: { currentId: string; row: any }) { - this.bikesService.createBike(object.currentId, { bike: object.row }); - } - - lock(row: any) { - this.bikesService.lockBike({ id: row.id }); - } - - save(row: any) { - this.bikesService.updateBike({ bike: row }); - } - - cancel(row: any) { - this.bikesService.unlockBike({ id: row.id }); + ngOnInit(): void { + this.returnUrl = this.route.snapshot.queryParams['returnUrl'] || '/tableOverview'; } - delete(row: any) { - this.bikesService.deleteBike({ id: row.id }); + login() { + this.errorMessage = ''; + this.errorOccurred = false; + if (this.email.invalid || this.password.invalid) { + return; + } + this.loading = true; + this.authService + .login(this.email.value, this.password.value) + .subscribe( + () => this.router.navigateByUrl(this.returnUrl), + (error) => { + this.errorOccurred = true; + this.errorMessage = + error.error.message || + 'Ein Fehler bei Einloggen ist aufgetreten. Überprüfen Sie Ihre Internetverbindung oder versuchen Sie es später erneut.'; + } + ) + .add(() => { + this.loading = false; + }); } } From f86973818ff001f4d0e6175a82c59c0674d8c370 Mon Sep 17 00:00:00 2001 From: FlayInAHook Date: Wed, 2 Dec 2020 16:39:34 +0100 Subject: [PATCH 12/12] profile validators --- src/app/pages/profile/profile.component.html | 45 +++++++++++++++----- src/app/pages/profile/profile.component.scss | 9 ++++ src/app/pages/profile/profile.component.ts | 28 ++++++++++-- 3 files changed, 69 insertions(+), 13 deletions(-) diff --git a/src/app/pages/profile/profile.component.html b/src/app/pages/profile/profile.component.html index c6d690f..1199841 100644 --- a/src/app/pages/profile/profile.component.html +++ b/src/app/pages/profile/profile.component.html @@ -1,7 +1,7 @@

Profil aktualisieren

- + Aktuelles Passwort - - + - - Passwort eingeben + + Neues Passwort - - Bitte geben Sie Ihr Passwort ein. + + Bitte geben Sie Ihr neues Passwort ein. + + + Das Passwort muss mindestens aus {{minPw}} Zeichen bestehen + + + + + Passwort wiederholen + + + Bitte wiederholen sie ihr Passwort + + + Das Passwort stimmt nicht überein