diff --git a/src/component/top-menu/top-menu.ts b/src/component/top-menu/top-menu.ts index 995b302..a9d6d19 100644 --- a/src/component/top-menu/top-menu.ts +++ b/src/component/top-menu/top-menu.ts @@ -71,6 +71,7 @@ export class TopMenuComponent implements OnInit { // remove in every case the subMenu: this.subMenu = undefined; this.subMenuPosition = undefined; + console.log(`request navigate to '${data.navigateTo}'`); this.router.navigate([data.navigateTo]); return; } diff --git a/src/model/environment.ts b/src/model/environment.ts index 19f922d..91466d1 100644 --- a/src/model/environment.ts +++ b/src/model/environment.ts @@ -1,31 +1,13 @@ - -import { Injectable } from "@angular/core"; - - export interface Environment { production: boolean, // URL of development API applName: string, defaultServer: string, - server: Map, + server: { [key: string]: string; }, ssoSite: string, ssoSignIn: string, ssoSignUp: string, ssoSignOut: string, tokenStoredInPermanentStorage: boolean, }; - -@Injectable() -export class EnvironmentService { - public production: boolean; - // URL of development API - public applName: string; - public defaultServer: string; - public server: any; - public ssoSite: string; - public ssoSignIn: string; - public ssoSignUp: string; - public ssoSignOut: string; - public tokenStoredInPermanentStorage: boolean; -}; \ No newline at end of file diff --git a/src/model/index.ts b/src/model/index.ts index 830ebb5..544cad0 100644 --- a/src/model/index.ts +++ b/src/model/index.ts @@ -1,4 +1,4 @@ -import { Environment, EnvironmentService } from './environment'; +import { Environment } from './environment'; import { isMenuItem, isMenuPosition, MenuItem, MenuPosition } from './menu-item'; -export { MenuPosition, isMenuPosition, MenuItem, isMenuItem, Environment, EnvironmentService }; +export { MenuPosition, isMenuPosition, MenuItem, isMenuItem, Environment }; diff --git a/src/service/cookies.ts b/src/service/cookies.ts index 3589860..2e73f80 100644 --- a/src/service/cookies.ts +++ b/src/service/cookies.ts @@ -10,7 +10,9 @@ import { Injectable } from '@angular/core'; providedIn: 'root', }) export class CookiesService { - constructor() { } + constructor() { + console.log("Start CookiesService"); + } set(cname: string, cvalue: string, exdays: number): void { if (this.get(cname) !== '') { diff --git a/src/service/http-wrapper_kjdhqslkjf.ts b/src/service/http-wrapper_kjdhqslkjf.ts index eba910e..3d55fd3 100644 --- a/src/service/http-wrapper_kjdhqslkjf.ts +++ b/src/service/http-wrapper_kjdhqslkjf.ts @@ -10,7 +10,7 @@ import { HttpClient, HttpHeaders, HttpEventType } from '@angular/common/http'; import { SessionService } from './session'; import { isArrayOfs, isBoolean, isNullOrUndefined, isNumber, isString } from '../utils'; -import { EnvironmentService } from '../model/environment'; +import { Environment } from '../model/environment'; export enum HTTPRequestModel { POST = 'POST', @@ -60,9 +60,11 @@ export class HttpWrapperService { private displayReturn: boolean = false; constructor( // https://stackoverflow.com/questions/56883120/angular-service-provide-with-a-default-value - @Inject('ENVIRONMENT') private environment: EnvironmentService, + @Inject('ENVIRONMENT') private environment: Environment, private http: HttpClient, - private session: SessionService) { } + private session: SessionService) { + console.log("Start HttpWrapperService (DEPRECATED)"); + } addTokenIfNeeded(headerOption: any): any { const token = this.session.getToken(); @@ -249,7 +251,7 @@ export class HttpWrapperService { // Deprecated ... createRESTCall(api: string, inputOptions?: any) { - let basePage = this.environment.server.get(this.environment.defaultServer); + let basePage = this.environment.server[this.environment.defaultServer]; let addressServerRest = `${basePage}/`; let options = inputOptions; if (options === undefined) { diff --git a/src/service/local-storage.ts b/src/service/local-storage.ts index e40893b..3423f96 100644 --- a/src/service/local-storage.ts +++ b/src/service/local-storage.ts @@ -5,7 +5,7 @@ */ import { Inject, Injectable } from '@angular/core'; -import { EnvironmentService } from '../model/environment'; +import { Environment } from '../model/environment'; @Injectable({ providedIn: 'root', @@ -14,8 +14,9 @@ export class StorageService { private baseLocalStorageName: string; constructor( - @Inject('ENVIRONMENT') environment: EnvironmentService, + @Inject('ENVIRONMENT') environment: Environment, ) { + console.log("Start StorageService"); this.baseLocalStorageName = environment.applName + '_'; } diff --git a/src/service/notification.ts b/src/service/notification.ts index dd76d57..ad1f89c 100644 --- a/src/service/notification.ts +++ b/src/service/notification.ts @@ -12,7 +12,7 @@ import { Injectable } from '@angular/core'; export class NotificationService { constructor() { - console.log('Start Notification Service'); + console.log('Start NotificationService'); } errorRaw(data: any) { diff --git a/src/service/popin.ts b/src/service/popin.ts index 0b4e5d9..9067437 100644 --- a/src/service/popin.ts +++ b/src/service/popin.ts @@ -13,7 +13,7 @@ export class PopInService { private popinList: any[] = []; constructor() { - console.log('Start PopIn Service'); + console.log('Start PopInService'); } add(_popin: any) { diff --git a/src/service/session.ts b/src/service/session.ts index f64d46a..7dafd26 100644 --- a/src/service/session.ts +++ b/src/service/session.ts @@ -6,7 +6,7 @@ import { Injectable, Output, EventEmitter, Inject } from '@angular/core'; import { Router } from '@angular/router'; -import { EnvironmentService } from '../model/environment'; +import { Environment } from '../model/environment'; import { isNullOrUndefined } from '../utils'; export enum UserRoles222 { @@ -26,10 +26,11 @@ export class SessionService { @Output() change: EventEmitter = new EventEmitter(); - private environment;//: EnvironmentService constructor( - //@Inject('ENVIRONMENT') private environment: EnvironmentService, - ) { } + @Inject('ENVIRONMENT') private environment: Environment, + ) { + console.log("Start SessionService"); + } /** * @brief Create a new session. diff --git a/src/service/sso.ts b/src/service/sso.ts index 8026f33..492920c 100644 --- a/src/service/sso.ts +++ b/src/service/sso.ts @@ -5,7 +5,7 @@ */ import { Inject, Injectable } from '@angular/core'; -import { EnvironmentService } from '../model/environment'; +import { Environment } from '../model/environment'; import { getApplicationLocation, isInArray, isNullOrUndefined } from '../utils'; import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf'; @@ -16,7 +16,7 @@ export class SSOService { signUpEnable?: boolean; constructor( - @Inject('ENVIRONMENT') private environment: EnvironmentService, + @Inject('ENVIRONMENT') private environment: Environment, private http: HttpWrapperService, ) { console.log('Start SSOService'); @@ -95,6 +95,7 @@ export class SSOService { * Request SSO connection */ requestSignIn(name?: string): void { + console.log(`Request sign-in: '${this.environment.ssoSignIn}' + '${this.hashLocalData(name)}'`); window.location.href = this.environment.ssoSignIn + this.hashLocalData(name); } /** diff --git a/src/service/user.ts b/src/service/user.ts index 82d104b..048c86a 100644 --- a/src/service/user.ts +++ b/src/service/user.ts @@ -12,7 +12,7 @@ import { SessionService } from './session'; import { SSOService } from './sso'; import { getApplicationLocation, isNullOrUndefined, sha512 } from '../utils'; import { HttpWrapperService, HTTPRequestModel, HTTPMimeType, ModelResponseHttp } from './http-wrapper_kjdhqslkjf'; -import { EnvironmentService } from '../model/environment'; +import { Environment } from '../model/environment'; @Injectable({ @@ -24,7 +24,7 @@ export class UserService { private cookiesRememberMe = 'remember-me'; private cookiesToken = 'token'; constructor( - @Inject('ENVIRONMENT') private environment: EnvironmentService, + @Inject('ENVIRONMENT') private environment: Environment, private router: Router, private storageService: StorageService, private http: HttpWrapperService,