redirect / Done

main
Manuel Tauber 2024-02-26 12:11:41 +01:00
parent 7fc16dc967
commit 446b41a74e
2 changed files with 15 additions and 3 deletions

View File

@ -4,6 +4,7 @@ import { Injectable } from '@angular/core';
import { ResourceFields } from '@syncfusion/ej2-angular-gantt'; import { ResourceFields } from '@syncfusion/ej2-angular-gantt';
import { LanguageService } from './language.service'; import { LanguageService } from './language.service';
import { ErrorService } from './error.service'; import { ErrorService } from './error.service';
import { Location } from '@angular/common';
interface Preset { interface Preset {
id: string; id: string;
@ -35,6 +36,7 @@ export class DataService {
private totalSize: number = null; private totalSize: number = null;
private user: string = null; private user: string = null;
public userSupportGroup: string; 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'; //public selectedLanguage: string = 'DE';
@ -43,7 +45,7 @@ export class DataService {
* @param languageService injection of the languageService * @param languageService injection of the languageService
* @param http representation of the HttpClient * @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.getUser().then((res: any )=>{
this.user = res.userId; this.user = res.userId;
}); });
@ -66,6 +68,10 @@ export class DataService {
}); });
} }
public redirectToAuthUrl() {
window.location.href = this.authUrl;
}
/** /**
* the function getStates * the function getStates
* @returns an array of states and possible states per state * @returns an array of states and possible states per state
@ -150,6 +156,8 @@ export class DataService {
res = response; res = response;
resolve(res); resolve(res);
},(error=>{ },(error=>{
console.log("\n#############################\n");
this.redirectToAuthUrl();
this.errorService.handleRssoError(error); this.errorService.handleRssoError(error);
})) }))
}) })

View File

@ -19,6 +19,8 @@ import { MAT_DATE_FORMATS } from '@angular/material/core';
import { RenamePresetDialogComponent } from '../rename-preset-dialog/rename-preset-dialog.component'; import { RenamePresetDialogComponent } from '../rename-preset-dialog/rename-preset-dialog.component';
import { DeletePresetDialogComponent } from '../delete-preset-dialog/delete-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 { SavePresetUnderDialogComponent } from '../save-preset-under-dialog/save-preset-under-dialog.component';
import { Location } from '@angular/common';
export const MY_DATE_FORMATS = { export const MY_DATE_FORMATS = {
parse: { parse: {
@ -134,6 +136,7 @@ export class NttGanttComponent implements OnInit {
public planTimes : any[] = []; public planTimes : any[] = [];
public sortSelectorName: any; public sortSelectorName: any;
public presets : any[] = []; public presets : any[] = [];
public selectedPreset: Preset = {id: 'test', name : 'test', presetType: 'test', definition: {}}; public selectedPreset: Preset = {id: 'test', name : 'test', presetType: 'test', definition: {}};
public presetControl: FormControl = new FormControl('');; 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 dataService injects the dataService for data management and backend communication
* @param matDialog injects the matDialog * @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); this.initLanguge(true);
} }
@ -201,6 +204,7 @@ export class NttGanttComponent implements OnInit {
this.userId = res.userId; this.userId = res.userId;
if(res.userId == null){ if(res.userId == null){
this.errorService.handleCostumError("RSSO Fehler", "Melden Sie sich erneut an", "USER ID = NULL", "rsso"); 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: 'supportGroup', headerText: 'Gewählte Support Gruppe' },
{ field: 'StartDate', headerText: 'Geplantes Start-Datum', format : {type:'date', format:'dd.MM.yyyy'}}, { field: 'StartDate', headerText: 'Geplantes Start-Datum', format : {type:'date', format:'dd.MM.yyyy'}},
{ field: 'plantime', headerText: 'Planzeit in H', width: 100 }, { 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}}; this.timelineSettings = {topTier: {unit: 'Month'}, bottomTier: {format: 'WW', unit: 'Week', count: 1}};