]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: monitoring menu entry should indicate firing alerts
authorVolker Theile <vtheile@suse.com>
Fri, 24 Apr 2020 10:18:25 +0000 (12:18 +0200)
committerVolker Theile <vtheile@suse.com>
Mon, 27 Apr 2020 07:43:25 +0000 (09:43 +0200)
Fixes: https://tracker.ceph.com/issues/43081
Signed-off-by: Volker Theile <vtheile@suse.com>
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.html
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.scss
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/core/navigation/navigation/navigation.component.ts

index d05e2669925f551134b09ff869e004834db45cd9..5a3d4ccb8911952d482a230bb2fc29e56352470c 100644 (file)
             class="tc_submenuitem tc_submenuitem_monitoring"
             *ngIf="permissions.prometheus.read">
           <a i18n
-             routerLink="/monitoring">Monitoring</a>
+             routerLink="/monitoring">
+            <ng-container i18n>Monitoring</ng-container>
+            <small *ngIf="prometheusAlertService.alerts.length > 0"
+                   class="badge badge-danger">{{ prometheusAlertService.alerts.length }}</small>
+          </a>
         </li>
       </ul>
     </li>
index b1d8e0e25d8de95111d547af1fce3db07e495c10..0000dd3337edefed0ed907a6e1f896bdf107ef7c 100644 (file)
@@ -190,6 +190,10 @@ $sidebar-width: 200px;
           background: $color-primary;
         }
 
+        & > .badge {
+          margin-left: 5px;
+        }
+
         text-decoration: none;
       }
 
index fe4dec40e2b982f5cbfd45734f3811df6c61a93b..8fa84bf65ae7dc65a65bdf77ff2b3d131925ed07 100644 (file)
@@ -12,6 +12,7 @@ import {
   FeatureTogglesMap,
   FeatureTogglesService
 } from '../../../shared/services/feature-toggles.service';
+import { PrometheusAlertService } from '../../../shared/services/prometheus-alert.service';
 import { SummaryService } from '../../../shared/services/summary.service';
 import { NavigationModule } from '../navigation.module';
 import { NavigationComponent } from './navigation.component';
@@ -61,7 +62,8 @@ describe('NavigationComponent', () => {
           }
         },
         { provide: SummaryService, useValue: { subscribe: jest.fn() } },
-        { provide: FeatureTogglesService, useValue: { get: jest.fn() } }
+        { provide: FeatureTogglesService, useValue: { get: jest.fn() } },
+        { provide: PrometheusAlertService, useValue: { alerts: [] } }
       ]
     });
   });
index b8310fb7351f70e39a95713abfc65a9abb775657..e21c9eeb0887c1c5304aca834eb8a8724366760f 100644 (file)
@@ -9,6 +9,7 @@ import {
   FeatureTogglesMap$,
   FeatureTogglesService
 } from '../../../shared/services/feature-toggles.service';
+import { PrometheusAlertService } from '../../../shared/services/prometheus-alert.service';
 import { SummaryService } from '../../../shared/services/summary.service';
 
 @Component({
@@ -36,7 +37,8 @@ export class NavigationComponent implements OnInit, OnDestroy {
   constructor(
     private authStorageService: AuthStorageService,
     private summaryService: SummaryService,
-    private featureToggles: FeatureTogglesService
+    private featureToggles: FeatureTogglesService,
+    public prometheusAlertService: PrometheusAlertService
   ) {
     this.permissions = this.authStorageService.getPermissions();
     this.enabledFeature$ = this.featureToggles.get();