From faa9fe0d71921cdac587fa848c3175680c4d4622 Mon Sep 17 00:00:00 2001 From: Manuel Tauber Date: Fri, 26 Jan 2024 13:20:57 +0100 Subject: [PATCH 1/2] RSSO User anzeigen --- .../calender/api/KalenderRestController.java | 19 +++++++++++++++++++ frontend/src/app/data.service.ts | 16 ++++++++++++++++ .../app/ntt-gantt/ntt-gantt.component.html | 2 ++ .../src/app/ntt-gantt/ntt-gantt.component.ts | 7 +++++++ 4 files changed, 44 insertions(+) diff --git a/backend/src/main/java/com/nttdata/calender/api/KalenderRestController.java b/backend/src/main/java/com/nttdata/calender/api/KalenderRestController.java index 6b7c5a7..6275787 100644 --- a/backend/src/main/java/com/nttdata/calender/api/KalenderRestController.java +++ b/backend/src/main/java/com/nttdata/calender/api/KalenderRestController.java @@ -95,6 +95,23 @@ public class KalenderRestController { return state.get(); } + + /** + * Handles GET request to retrieve all the states and their actual and possible + * states and results a JSON array. + * + * @return JSON Array of states with actualState, possibleStates, stateNameEN, + * stateNameDE + * @throws JsonProcessingException if an exception occurs during JSON processing + */ + @CrossOrigin("*") + @GetMapping("/api/getUser") + @ResponseBody + public String getUserId() { + String jsonString = "{\"userId\": \""+this.javaAPI.getUser()+"\"}"; + return jsonString; + } + /** * Handles GET request to retrieve all support groups. * @@ -304,6 +321,8 @@ public class KalenderRestController { return implementer.get(request); } + + // Preset HANDLERS @CrossOrigin("*") @PostMapping("/api/savePreset") @ResponseBody diff --git a/frontend/src/app/data.service.ts b/frontend/src/app/data.service.ts index e9e1c6d..cb2e820 100644 --- a/frontend/src/app/data.service.ts +++ b/frontend/src/app/data.service.ts @@ -132,6 +132,22 @@ export class DataService { return this.contracts.find((contract)=> {return contract.id == contractId;}).name; } + /** + * The function fetchStates fetches an array from the possible statuses per state + * @returns promise for the fetched Status Array + */ + public async getUser(){ + const promise = new Promise(resolve=>{ + let res : any; + this.http.get('http://localhost:8080/api/getUser') + .subscribe((response: any)=>{ + res = response; + resolve(res); + }) + }) + return promise; + } + /** * The function initPresets fetches an array of all presets * @returns promise for the fetched presets array diff --git a/frontend/src/app/ntt-gantt/ntt-gantt.component.html b/frontend/src/app/ntt-gantt/ntt-gantt.component.html index 43920ed..d84f12d 100644 --- a/frontend/src/app/ntt-gantt/ntt-gantt.component.html +++ b/frontend/src/app/ntt-gantt/ntt-gantt.component.html @@ -51,6 +51,8 @@ + +

verified_user RSSO User: {{this.userId}}

diff --git a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts index 562e21e..a0caf92 100644 --- a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts +++ b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts @@ -164,6 +164,8 @@ export class NttGanttComponent implements OnInit { public showSaveUnderButton: boolean = false; public isUserPreset: boolean = false; + public userId : string = ""; + /**###################################################################### Initial Loading functions ######################################################################*/ @@ -188,6 +190,11 @@ export class NttGanttComponent implements OnInit { this.sliceStart = 0; this.sliceEnd = 20; + this.dataService.getUser().then((res: any)=>{ + console.log(res); + this.userId = res.userId; + }); + // this.dataService.initPresets().then((res: any)=>{ // this.presets = res.presets; // this.selectedPreset = res.selectedPreset; From fc737ec7c068ef36eecafbb085b865b9789ae008 Mon Sep 17 00:00:00 2001 From: Manuel Tauber Date: Fri, 26 Jan 2024 13:38:26 +0100 Subject: [PATCH 2/2] t --- frontend/src/app/ntt-gantt/ntt-gantt.component.html | 4 +++- frontend/src/app/ntt-gantt/ntt-gantt.component.ts | 6 +++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/frontend/src/app/ntt-gantt/ntt-gantt.component.html b/frontend/src/app/ntt-gantt/ntt-gantt.component.html index d84f12d..898f6ad 100644 --- a/frontend/src/app/ntt-gantt/ntt-gantt.component.html +++ b/frontend/src/app/ntt-gantt/ntt-gantt.component.html @@ -52,7 +52,9 @@ -

verified_user RSSO User: {{this.userId}}

+

verified_user RSSO User: {{this.userId}}

+

verified_user RSSO Auth Failed

+

verified_user RSSO: initializing

diff --git a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts index a0caf92..657d150 100644 --- a/frontend/src/app/ntt-gantt/ntt-gantt.component.ts +++ b/frontend/src/app/ntt-gantt/ntt-gantt.component.ts @@ -164,7 +164,8 @@ export class NttGanttComponent implements OnInit { public showSaveUnderButton: boolean = false; public isUserPreset: boolean = false; - public userId : string = ""; + public userId : string = null; + public rssoInit: boolean = true; /**###################################################################### Initial Loading functions ######################################################################*/ @@ -191,8 +192,11 @@ export class NttGanttComponent implements OnInit { this.sliceEnd = 20; this.dataService.getUser().then((res: any)=>{ + console.log("##################"); console.log(res); + this.rssoInit = false; this.userId = res.userId; + }); // this.dataService.initPresets().then((res: any)=>{