Merge pull request #34729 from votdev/issue_43081_show_prom_alerts_in_navbar

Reviewed-by: Ernesto Puerta <epuertat@redhat.com>
Reviewed-by: Patrick Seidensal <pnawracay@suse.com>
Reviewed-by: Stephan Müller <smueller@suse.com>
This commit is contained in:
Lenz Grimmer 2020-04-29 10:31:47 +02:00 committed by GitHub
commit 4b536f04bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 15 additions and 3 deletions

View File

@ -156,7 +156,11 @@
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>

View File

@ -190,6 +190,10 @@ $sidebar-width: 200px;
background: $color-primary;
}
& > .badge {
margin-left: 5px;
}
text-decoration: none;
}

View 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: [] } }
]
});
});

View 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();