Skip to content

Commit

Permalink
Make wait dialog go away in case of errors
Browse files Browse the repository at this point in the history
Signed-off-by: Sebastian Kaupe <[email protected]>
  • Loading branch information
snkaupe committed Dec 3, 2024
1 parent a4a8496 commit e2eac07
Showing 1 changed file with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export class IncidentDetailsViewComponent implements OnInit {
// Why? Because we can now quickly check if in the UI if
// an impact or update is pending by calling the Set.has
// method on the appropriate set. Furthermore, we can create
// an overall array for iteration in the UI by using the
// an overall array for iteration in the UI by using the
// spread operator.
pendingImpacts: Set<ComponentId> = new Set();
pendingUpdates: Set<number> = new Set();
Expand Down Expand Up @@ -159,7 +159,7 @@ export class IncidentDetailsViewComponent implements OnInit {
this.router.navigate(["notfound"]);
return;
}

this.incidentCopy = {
displayName: this.incident.displayName,
description: this.incident.description,
Expand Down Expand Up @@ -289,6 +289,7 @@ export class IncidentDetailsViewComponent implements OnInit {
console.error("Error occured while creating new incident");
console.error(err);
this.toastr.error("An error occured while processing your request", "Creation failed");
this.abortSave();
}
})
} else {
Expand All @@ -303,6 +304,7 @@ export class IncidentDetailsViewComponent implements OnInit {
console.error(`Request to update incident ${this.incidentId} error'ed out`);
console.error(err);
this.toastr.error("An error occured while processing your request", "Update failed");
this.abortSave();
}
});
}
Expand All @@ -323,16 +325,17 @@ export class IncidentDetailsViewComponent implements OnInit {
console.error("Request to add or delete incident update error'ed out.")
console.error(err);
this.toastr.error("An error occured while processing your request", "Update failed");
this.abortSave();
},
complete: () => {
this.finishSave();
}
});
} else {
this.finishSave();
this.finishSave();
}
}

private finishSave(): void {
this.waitState = WS_RELOADING;
this.data.reload();
Expand All @@ -348,6 +351,10 @@ export class IncidentDetailsViewComponent implements OnInit {
});
}

private abortSave(): void {
this.waitState = WS_NONE;
}

private discardChanges(): void {
this.clearPending();
this.incident.displayName = this.incidentCopy.displayName;
Expand Down

0 comments on commit e2eac07

Please sign in to comment.