From 7bd61853343b49f25ea035d55264ece2e57a813d Mon Sep 17 00:00:00 2001 From: Roland Schneider Date: Mon, 27 Sep 2021 21:57:22 +0200 Subject: [PATCH] improve deployment - customer angular app: add base-href and deploy url - botond_daily.sh : allow daily scripts --- botond_daily.sh | 2 +- customer/app/package.json | 2 +- customer/app/src/app/app.module.ts | 12 ++++++++++-- .../app/src/app/pages/login/login.component.html | 8 ++++---- customer/app/src/app/pages/login/login.component.ts | 6 ++++-- customer/app/src/styles.scss | 2 +- customer/app/src/styles/fonts.scss | 4 ++-- 7 files changed, 23 insertions(+), 13 deletions(-) diff --git a/botond_daily.sh b/botond_daily.sh index 83491a0..3cebaf0 100644 --- a/botond_daily.sh +++ b/botond_daily.sh @@ -1,4 +1,4 @@ #!/usr/bin/env bash php /home/fitnessa/public_html/fitness-web/yii ticket/index -#php /home/fitnessa/public_html/fitness-web/yii ticket/daily +php /home/fitnessa/public_html/fitness-web/yii ticket/daily diff --git a/customer/app/package.json b/customer/app/package.json index 3445aa7..7872653 100644 --- a/customer/app/package.json +++ b/customer/app/package.json @@ -7,7 +7,7 @@ "build": "ng build", "build:prod": "ng build --configuration production", "build:prod-cutler-gyor": "ng build --configuration cutler-gyor", - "build:prod-cutler-movar": "ng build --configuration cutler-movar --base-href group-training", + "build:prod-cutler-movar": "ng build --configuration cutler-movar --base-href /group-training/ --deploy-url /group-training/", "test": "ng test", "lint": "ng lint", "e2e": "ng e2e" diff --git a/customer/app/src/app/app.module.ts b/customer/app/src/app/app.module.ts index d1e674c..fe301ba 100644 --- a/customer/app/src/app/app.module.ts +++ b/customer/app/src/app/app.module.ts @@ -17,7 +17,7 @@ import {ReactiveFormsModule} from "@angular/forms"; import { EventsComponent } from './pages/events/events.component'; import { FitEventTypesComponent } from './components/fit-event-types/fit-event-types.component'; -import { registerLocaleData } from '@angular/common'; +import {APP_BASE_HREF, PlatformLocation, registerLocaleData} from '@angular/common'; import localeHu from '@angular/common/locales/hu'; import {FontAwesomeModule} from "@fortawesome/angular-fontawesome"; import { library } from '@fortawesome/fontawesome-svg-core'; @@ -90,7 +90,11 @@ registerLocaleData(localeHu, 'hu'); { provide: LOCALE_ID, useValue: "hu-hu" }, { provide: HTTP_INTERCEPTORS, useClass: JwtInterceptor, multi: true }, { provide: HTTP_INTERCEPTORS, useClass: ErrorInterceptor, multi: true }, - + { + provide: APP_BASE_HREF, + useFactory: getBaseHref, + deps: [PlatformLocation] + } // provider used to create fake backend // fakeBackendProvider ], @@ -103,3 +107,7 @@ export class AppModule { } } + +export function getBaseHref(platformLocation: PlatformLocation): string { + return platformLocation.getBaseHrefFromDOM(); +} diff --git a/customer/app/src/app/pages/login/login.component.html b/customer/app/src/app/pages/login/login.component.html index 99fb7a7..48761e5 100644 --- a/customer/app/src/app/pages/login/login.component.html +++ b/customer/app/src/app/pages/login/login.component.html @@ -2,7 +2,7 @@
- +

Bejelentkezés

-
- -
+ + +
{{error}}
diff --git a/customer/app/src/app/pages/login/login.component.ts b/customer/app/src/app/pages/login/login.component.ts index 039b822..148955d 100644 --- a/customer/app/src/app/pages/login/login.component.ts +++ b/customer/app/src/app/pages/login/login.component.ts @@ -1,9 +1,10 @@ -import { Component, OnInit } from '@angular/core'; +import {Component, Inject, OnInit} from '@angular/core'; import {FormBuilder, FormGroup, Validators} from "@angular/forms"; import {ActivatedRoute, Router} from "@angular/router"; import {AuthenticationService} from "../../services/authentication.service"; import { first } from 'rxjs/operators'; import {ToastrService} from "ngx-toastr"; +import {APP_BASE_HREF} from "@angular/common"; @Component({ selector: 'app-login', @@ -22,7 +23,8 @@ export class LoginComponent implements OnInit { private route: ActivatedRoute, private router: Router, private authenticationService: AuthenticationService, - private toastr: ToastrService + private toastr: ToastrService, + @Inject(APP_BASE_HREF) public baseHref:string ) { } ngOnInit() { diff --git a/customer/app/src/styles.scss b/customer/app/src/styles.scss index 4ae94f2..11cf200 100644 --- a/customer/app/src/styles.scss +++ b/customer/app/src/styles.scss @@ -61,7 +61,7 @@ html{ body{ min-height: 100%; height: 100%; - background: url("/assets/images/cutlercross-background.jpg"); + background: url("~/assets/images/cutlercross-background.jpg"); background-repeat: repeat-y; } diff --git a/customer/app/src/styles/fonts.scss b/customer/app/src/styles/fonts.scss index cd5df5e..d8fc002 100644 --- a/customer/app/src/styles/fonts.scss +++ b/customer/app/src/styles/fonts.scss @@ -1,12 +1,12 @@ @font-face { font-family: "Roboto"; - src: url("/assets/fonts/RobotoMono-VariableFont_wght.ttf") format("truetype"); + src: url("~/assets/fonts/RobotoMono-VariableFont_wght.ttf") format("truetype"); } @font-face { font-family: "dcc"; - src: url("/assets/fonts/dcc_sharp_distress_black_by_dccanim.otf") format("truetype"); + src: url("~/assets/fonts/dcc_sharp_distress_black_by_dccanim.otf") format("truetype"); //font-weight: $font-weight-normal; //font-style: normal; }