Said Gedik 2024-02-05 12:06:32 +01:00
commit 185f66a8a1
4 changed files with 50 additions and 0 deletions

View File

@ -95,6 +95,23 @@ public class KalenderRestController {
return state.get(); 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. * Handles GET request to retrieve all support groups.
* *
@ -304,6 +321,8 @@ public class KalenderRestController {
return implementer.get(request); return implementer.get(request);
} }
// Preset HANDLERS
@CrossOrigin("*") @CrossOrigin("*")
@PostMapping("/api/savePreset") @PostMapping("/api/savePreset")
@ResponseBody @ResponseBody

View File

@ -132,6 +132,22 @@ export class DataService {
return this.contracts.find((contract)=> {return contract.id == contractId;}).name; 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 * The function initPresets fetches an array of all presets
* @returns promise for the fetched presets array * @returns promise for the fetched presets array

View File

@ -51,6 +51,10 @@
</mat-optgroup> </mat-optgroup>
</mat-select> </mat-select>
</mat-form-field> </mat-form-field>
<h3 *ngIf="userId" style="font-family: Arial, Helvetica, sans-serif;"><mat-icon style="color: green;">verified_user</mat-icon> RSSO User: {{this.userId}}</h3>
<h3 *ngIf="!userId && !rssoInit" style="font-family: Arial, Helvetica, sans-serif;"><mat-icon style="color: red;">verified_user</mat-icon> RSSO Auth Failed</h3>
<h3 *ngIf="rssoInit" style="font-family: Arial, Helvetica, sans-serif;"><mat-icon style="color: orange;">verified_user</mat-icon> RSSO: initializing</h3>
<button mat-basic-button *ngIf="isUserPreset" class="editButton" (click)="openRenameDialog()" color="" style="" ><mat-icon>edit</mat-icon></button> <button mat-basic-button *ngIf="isUserPreset" class="editButton" (click)="openRenameDialog()" color="" style="" ><mat-icon>edit</mat-icon></button>
<button mat-basic-button *ngIf="isUserPreset" class="deleteButton" (click)="openDeleteDialog()" color="" style="" ><mat-icon>delete_forever</mat-icon></button> <button mat-basic-button *ngIf="isUserPreset" class="deleteButton" (click)="openDeleteDialog()" color="" style="" ><mat-icon>delete_forever</mat-icon></button>
</div> </div>

View File

@ -164,6 +164,9 @@ export class NttGanttComponent implements OnInit {
public showSaveUnderButton: boolean = false; public showSaveUnderButton: boolean = false;
public isUserPreset: boolean = false; public isUserPreset: boolean = false;
public userId : string = null;
public rssoInit: boolean = true;
/**###################################################################### Initial Loading functions ######################################################################*/ /**###################################################################### Initial Loading functions ######################################################################*/
@ -188,6 +191,14 @@ export class NttGanttComponent implements OnInit {
this.sliceStart = 0; this.sliceStart = 0;
this.sliceEnd = 20; 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)=>{ // this.dataService.initPresets().then((res: any)=>{
// this.presets = res.presets; // this.presets = res.presets;
// this.selectedPreset = res.selectedPreset; // this.selectedPreset = res.selectedPreset;