]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Do not show notifications for HTTP 409 errors.
authorVolker Theile <vtheile@suse.com>
Thu, 19 Apr 2018 08:24:17 +0000 (10:24 +0200)
committerVolker Theile <vtheile@suse.com>
Thu, 19 Apr 2018 14:39:29 +0000 (16:39 +0200)
Signed-off-by: Volker Theile <vtheile@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/shared/services/api-interceptor.service.ts

index d412119bbc28995dcccb4b41d1b052fb57679cbc..ed5ea8fac94660c7658189d214e78ac4a56909bd 100644 (file)
@@ -26,6 +26,7 @@ export class ApiInterceptorService implements HttpInterceptor {
   intercept(request: HttpRequest<any>, next: HttpHandler): Observable<HttpEvent<any>> {
     return next.handle(request).catch(resp => {
       if (resp instanceof HttpErrorResponse) {
+        let showNotification = true;
         switch (resp.status) {
           case 401:
             this.authStorageService.remove();
@@ -34,11 +35,15 @@ export class ApiInterceptorService implements HttpInterceptor {
           case 404:
             this.router.navigate(['/404']);
             break;
+          case 409:
+            showNotification = false;
+            break;
+        }
+        if (showNotification) {
+          this.notificationService.show(NotificationType.error,
+            resp.error.detail || '',
+            `${resp.status} - ${resp.statusText}`);
         }
-        this.notificationService.show(
-          NotificationType.error,
-          resp.error.detail || '',
-          `${resp.status} - ${resp.statusText}`);
       }
       // Return the error to the method that called it.
       return Observable.throw(resp);