ErrorHandlingFrontend/inProgress
parent
51c9c6482f
commit
41719e15c5
|
|
@ -175,10 +175,9 @@ export class DataService {
|
||||||
this.http.post('http://localhost:8080/api/updateState', dataJson).subscribe((response:any)=>{
|
this.http.post('http://localhost:8080/api/updateState', dataJson).subscribe((response:any)=>{
|
||||||
resolve(response);
|
resolve(response);
|
||||||
},(error:any)=>{
|
},(error:any)=>{
|
||||||
console.log(error);
|
|
||||||
resolve(error);
|
resolve(error);
|
||||||
});
|
});
|
||||||
})
|
});
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
}
|
}
|
||||||
|
|
@ -230,9 +229,10 @@ export class DataService {
|
||||||
this.http.post('http://localhost:8080/api/updateApproval', dataJson).subscribe((response:any)=>{
|
this.http.post('http://localhost:8080/api/updateApproval', dataJson).subscribe((response:any)=>{
|
||||||
resolve(response);
|
resolve(response);
|
||||||
},(error:any)=>{
|
},(error:any)=>{
|
||||||
console.log(error);
|
|
||||||
resolve(error);
|
resolve(error);
|
||||||
});
|
});
|
||||||
|
}).catch((error)=>{
|
||||||
|
throw(error);
|
||||||
})
|
})
|
||||||
|
|
||||||
return promise;
|
return promise;
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,6 @@ export class StateDialogComponent implements OnInit {
|
||||||
this.dataService.updateStatePerChange(modifiedChange).then((res: any)=>{
|
this.dataService.updateStatePerChange(modifiedChange).then((res: any)=>{
|
||||||
this.diasbled = true;
|
this.diasbled = true;
|
||||||
this.bdiasbled = true;
|
this.bdiasbled = true;
|
||||||
console.log(res);
|
|
||||||
if(res.status == 200){
|
if(res.status == 200){
|
||||||
counter++;
|
counter++;
|
||||||
this.progress = (counter/this.data.changes.length)*100;
|
this.progress = (counter/this.data.changes.length)*100;
|
||||||
|
|
@ -114,13 +113,13 @@ export class StateDialogComponent implements OnInit {
|
||||||
let msg;
|
let msg;
|
||||||
let action;
|
let action;
|
||||||
if(this.dataService.selectedLanguage == 'DE'){
|
if(this.dataService.selectedLanguage == 'DE'){
|
||||||
msg = 'Statusübergang fehlgeschlagen';
|
msg = 'Statusübergang fehlgeschlagen:';
|
||||||
action ='Schließen';
|
action = 'Schließen';
|
||||||
}else{
|
}else{
|
||||||
msg = 'State Transition failed';
|
msg = 'State Transition failed';
|
||||||
action ='close';
|
action ='close';
|
||||||
}
|
}
|
||||||
this._snackBar.open(msg, action, {
|
this._snackBar.open(msg + res.error.message, action, {
|
||||||
horizontalPosition: this.horizontalPosition,
|
horizontalPosition: this.horizontalPosition,
|
||||||
verticalPosition: this.verticalPosition,
|
verticalPosition: this.verticalPosition,
|
||||||
panelClass: ['mat-primary']
|
panelClass: ['mat-primary']
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,8 @@ export class NttGanttComponent implements OnInit {
|
||||||
public showNoResultsError: boolean = false;
|
public showNoResultsError: boolean = false;
|
||||||
public languages: string[] = ['DE', 'EN'];
|
public languages: string[] = ['DE', 'EN'];
|
||||||
public language: string = 'DE';
|
public language: string = 'DE';
|
||||||
|
public horizontalPosition: MatSnackBarHorizontalPosition = 'end';
|
||||||
|
public verticalPosition: MatSnackBarVerticalPosition = 'bottom';
|
||||||
|
|
||||||
public deMap : Map<string, string> = new Map<string, string>()
|
public deMap : Map<string, string> = new Map<string, string>()
|
||||||
public enMap : Map<string, string> = new Map<string, string>()
|
public enMap : Map<string, string> = new Map<string, string>()
|
||||||
|
|
@ -853,23 +855,75 @@ public logg(args){
|
||||||
}
|
}
|
||||||
|
|
||||||
if(args.item.text === "Genehmigen" || args.item.text === "Approve"){
|
if(args.item.text === "Genehmigen" || args.item.text === "Approve"){
|
||||||
|
|
||||||
for (const selectedRescourceId of this.selectedRescourceIds) {
|
for (const selectedRescourceId of this.selectedRescourceIds) {
|
||||||
for (const change of this.resources) {
|
for (const change of this.resources) {
|
||||||
if(change.resourceId == selectedRescourceId){
|
if(change.resourceId == selectedRescourceId){
|
||||||
this.dataService.updateApproval(change, 1);
|
this.dataService.updateApproval(change, 1).then((res: any)=>{
|
||||||
|
if(res.status == 200){
|
||||||
|
this._snackBar.open("Genehmigung erfolgreich", 'Schließen', {
|
||||||
|
horizontalPosition: this.horizontalPosition,
|
||||||
|
verticalPosition: this.verticalPosition,
|
||||||
|
panelClass: ['mat-primary']
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
this._snackBar.open(res.HttpErrorResponse.message, 'Schließen', {
|
||||||
|
horizontalPosition: this.horizontalPosition,
|
||||||
|
verticalPosition: this.verticalPosition,
|
||||||
|
panelClass: ['mat-primary']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.refreshData();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//this.ganttDefault.refresh();
|
//this.ganttDefault.refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(args.item.text === "Zur Genehmigung" || args.item.text === "Permit"){
|
||||||
|
let data = {changes: [], states: this.states};
|
||||||
|
for (const selectedRescourceId of this.selectedRescourceIds) {
|
||||||
|
for (const iterator of this.resources) {
|
||||||
|
if(iterator.resourceId == selectedRescourceId){
|
||||||
|
data.changes.push({resourceId: iterator.resourceId, changeNr: iterator.changeNr, currentState: iterator.state});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
let dialogRef = StateDialogComponent;
|
||||||
|
this.matDialog.open(dialogRef,
|
||||||
|
{
|
||||||
|
data : data,
|
||||||
|
}).afterClosed().subscribe((res)=>{
|
||||||
|
if(res.status == 200){
|
||||||
|
this.refreshData();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if(args.item.text === "ablehnen" || args.item.text === "Reject"){
|
|
||||||
|
if(args.item.text === "Ablehnen" || args.item.text === "Reject"){
|
||||||
for (const selectedRescourceId of this.selectedRescourceIds) {
|
for (const selectedRescourceId of this.selectedRescourceIds) {
|
||||||
for (const change of this.resources) {
|
for (const change of this.resources) {
|
||||||
if(change.resourceId == selectedRescourceId){
|
if(change.resourceId == selectedRescourceId){
|
||||||
this.dataService.updateApproval(change, 2);
|
this.dataService.updateApproval(change, 2).then((res: any)=>{
|
||||||
|
if(res.status == 200){
|
||||||
|
this._snackBar.open("Ablehnen erfolgreich", 'Schließen', {
|
||||||
|
horizontalPosition: this.horizontalPosition,
|
||||||
|
verticalPosition: this.verticalPosition,
|
||||||
|
panelClass: ['mat-primary']
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
this._snackBar.open(res.HttpErrorResponse.message, 'Schließen', {
|
||||||
|
horizontalPosition: this.horizontalPosition,
|
||||||
|
verticalPosition: this.verticalPosition,
|
||||||
|
panelClass: ['mat-primary']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.refreshData();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -880,7 +934,22 @@ public logg(args){
|
||||||
for (const selectedRescourceId of this.selectedRescourceIds) {
|
for (const selectedRescourceId of this.selectedRescourceIds) {
|
||||||
for (const change of this.resources) {
|
for (const change of this.resources) {
|
||||||
if(change.resourceId == selectedRescourceId){
|
if(change.resourceId == selectedRescourceId){
|
||||||
this.dataService.updateApproval(change, 3);
|
this.dataService.updateApproval(change, 3).then((res: any)=>{
|
||||||
|
if(res.status == 200){
|
||||||
|
this._snackBar.open("Stornieren erfolgreich", 'Schließen', {
|
||||||
|
horizontalPosition: this.horizontalPosition,
|
||||||
|
verticalPosition: this.verticalPosition,
|
||||||
|
panelClass: ['mat-primary']
|
||||||
|
});
|
||||||
|
}else{
|
||||||
|
this._snackBar.open(res.HttpErrorResponse.message, 'Schließen', {
|
||||||
|
horizontalPosition: this.horizontalPosition,
|
||||||
|
verticalPosition: this.verticalPosition,
|
||||||
|
panelClass: ['mat-primary']
|
||||||
|
});
|
||||||
|
}
|
||||||
|
this.refreshData();
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue