1 import { Component, Input, OnInit } from '@angular/core';
3 import { I18n } from '@ngx-translate/i18n-polyfill';
5 import { ListWithDetails } from '../../../../shared/classes/list-with-details.class';
6 import { CdTableColumn } from '../../../../shared/models/cd-table-column';
7 import { PrometheusRule } from '../../../../shared/models/prometheus-alerts';
8 import { DurationPipe } from '../../../../shared/pipes/duration.pipe';
11 selector: 'cd-rules-list',
12 templateUrl: './rules-list.component.html',
13 styleUrls: ['./rules-list.component.scss']
15 export class RulesListComponent extends ListWithDetails implements OnInit {
18 columns: CdTableColumn[];
19 expandedRow: PrometheusRule;
22 * Hide active alerts in details of alerting rules as they are already shown
23 * in the 'active alerts' table. Also hide the 'type' column as the type is
24 * always supposed to be 'alerting'.
26 hideKeys = ['alerts', 'type'];
28 constructor(private i18n: I18n) {
34 { prop: 'name', name: this.i18n('Name') },
35 { prop: 'labels.severity', name: this.i18n('Severity') },
36 { prop: 'group', name: this.i18n('Group') },
37 { prop: 'duration', name: this.i18n('Duration'), pipe: new DurationPipe() },
38 { prop: 'query', name: this.i18n('Query'), isHidden: true },
39 { prop: 'annotations.description', name: this.i18n('Description') }