Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 | 6x 6x 6x 6x 6x 6x 6x 6x 1x 1x 1x 1x 1x 6x 1x 6x 6x | import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core';
import { I18n } from '@ngx-translate/i18n-polyfill';
import { CellTemplate } from '../../../../shared/enum/cell-template.enum';
import { CdTableColumn } from '../../../../shared/models/cd-table-column';
import { CdTableSelection } from '../../../../shared/models/cd-table-selection';
import { CdDatePipe } from '../../../../shared/pipes/cd-date.pipe';
import { PrometheusAlertService } from '../../../../shared/services/prometheus-alert.service';
@Component({
selector: 'cd-prometheus-list',
template: require('./prometheus-list.component.html'),
styles: []
})
export class PrometheusListComponent implements OnInit {
@ViewChild('externalLinkTpl')
externalLinkTpl: TemplateRef<any>;
columns: CdTableColumn[];
selection = new CdTableSelection();
customCss = {
'label label-danger': 'active',
'label label-warning': 'unprocessed',
'label label-info': 'suppressed'
};
constructor(
// NotificationsComponent will refresh all alerts every 5s (No need to do it here as well)
public prometheusAlertService: PrometheusAlertService,
private i18n: I18n,
private cdDatePipe: CdDatePipe
) {}
ngOnInit() {
this.columns = [
{
name: this.i18n('Name'),
prop: 'labels.alertname',
flexGrow: 2
},
{
name: this.i18n('Job'),
prop: 'labels.job',
flexGrow: 2
},
{
name: this.i18n('Severity'),
prop: 'labels.severity'
},
{
name: this.i18n('State'),
prop: 'status.state',
cellTransformation: CellTemplate.classAdding
},
{
name: this.i18n('Started'),
prop: 'startsAt',
pipe: this.cdDatePipe
},
{
name: this.i18n('URL'),
prop: 'generatorURL',
sortable: false,
cellTemplate: this.externalLinkTpl
}
];
}
updateSelection(selection: CdTableSelection) {
this.selection = selection;
}
}
|