From 446b41a74e4c3c7b81f7c6f5ab4ca906c4ead8ae Mon Sep 17 00:00:00 2001 From: Manuel Tauber Date: Mon, 26 Feb 2024 12:11:41 +0100 Subject: [PATCH] redirect / Done --- frontend/src/app/data.service.ts | 10 +++++++++- frontend/src/app/ntt-gantt/ntt-gantt.component.ts | 8 ++++++-- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/data.service.ts b/frontend/src/app/data.service.ts index d9371b1..30f537b 100644 --- a/frontend/src/app/data.service.ts +++ b/frontend/src/app/data.service.ts @@ -4,6 +4,7 @@ import { Injectable } from '@angular/core'; import { ResourceFields } from '@syncfusion/ej2-angular-gantt'; import { LanguageService } from './language.service'; import { ErrorService } from './error.service'; +import { Location } from '@angular/common'; interface Preset { id: string; @@ -35,6 +36,7 @@ export class DataService { private totalSize: number = null; private user: string = null; public userSupportGroup: string; + public authUrl = 'https://itsm-dev-neu-rsso.asfinag.at/rsso/start?bypass-auth=true&tenant=itsm-dev-neu&goto=https://itsm-dev-neu.asfinag.at/arsys/calendar'; //public selectedLanguage: string = 'DE'; @@ -43,7 +45,7 @@ export class DataService { * @param languageService injection of the languageService * @param http representation of the HttpClient */ - constructor(public languageService: LanguageService, private http: HttpClient, public errorService: ErrorService) { + constructor(public languageService: LanguageService, private http: HttpClient, public errorService: ErrorService, private location: Location) { this.getUser().then((res: any )=>{ this.user = res.userId; }); @@ -66,6 +68,10 @@ export class DataService { }); } + public redirectToAuthUrl() { + window.location.href = this.authUrl; + } + /** * the function getStates * @returns an array of states and possible states per state @@ -150,6 +156,8 @@ export class DataService { res = response; resolve(res); },(error=>{ + console.log("\n#############################\n"); + this.redirectToAuthUrl(); this.errorService.handleRssoError(error); })) }) diff --git a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts index 70f485a..b9750ea 100644 --- a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts +++ b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts @@ -19,6 +19,8 @@ import { MAT_DATE_FORMATS } from '@angular/material/core'; import { RenamePresetDialogComponent } from '../rename-preset-dialog/rename-preset-dialog.component'; import { DeletePresetDialogComponent } from '../delete-preset-dialog/delete-preset-dialog.component'; import { SavePresetUnderDialogComponent } from '../save-preset-under-dialog/save-preset-under-dialog.component'; +import { Location } from '@angular/common'; + export const MY_DATE_FORMATS = { parse: { @@ -134,6 +136,7 @@ export class NttGanttComponent implements OnInit { public planTimes : any[] = []; public sortSelectorName: any; + public presets : any[] = []; public selectedPreset: Preset = {id: 'test', name : 'test', presetType: 'test', definition: {}}; public presetControl: FormControl = new FormControl('');; @@ -179,7 +182,7 @@ export class NttGanttComponent implements OnInit { * @param dataService injects the dataService for data management and backend communication * @param matDialog injects the matDialog */ - constructor(public languageService: LanguageService, public dataService: DataService, public matDialog : MatDialog, private _snackBar: MatSnackBar, public errorService: ErrorService ) { + constructor(public languageService: LanguageService, public dataService: DataService, public matDialog : MatDialog, private _snackBar: MatSnackBar, public errorService: ErrorService, private location: Location ) { this.initLanguge(true); } @@ -201,6 +204,7 @@ export class NttGanttComponent implements OnInit { this.userId = res.userId; if(res.userId == null){ this.errorService.handleCostumError("RSSO Fehler", "Melden Sie sich erneut an", "USER ID = NULL", "rsso"); + this.dataService.redirectToAuthUrl(); } }); @@ -269,7 +273,7 @@ export class NttGanttComponent implements OnInit { { field: 'supportGroup', headerText: 'Gewählte Support Gruppe' }, { field: 'StartDate', headerText: 'Geplantes Start-Datum', format : {type:'date', format:'dd.MM.yyyy'}}, { field: 'plantime', headerText: 'Planzeit in H', width: 100 }, - { field: 'changeNr', headerText: 'Change Nummer', width: 140 } + { field: 'changeNr', headerText: 'Change Nummer', width: 200 } ]; this.timelineSettings = {topTier: {unit: 'Month'}, bottomTier: {format: 'WW', unit: 'Week', count: 1}};