]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/blob
ee5f3a0e49bd9c5bd1d539f25e96b45560ad5d9b
[ceph.git] /
1 import { Component, Input, OnInit } from '@angular/core';
2
3 import { I18n } from '@ngx-translate/i18n-polyfill';
4
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';
9
10 @Component({
11   selector: 'cd-rules-list',
12   templateUrl: './rules-list.component.html',
13   styleUrls: ['./rules-list.component.scss']
14 })
15 export class RulesListComponent extends ListWithDetails implements OnInit {
16   @Input()
17   data: any;
18   columns: CdTableColumn[];
19   expandedRow: PrometheusRule;
20
21   /**
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'.
25    */
26   hideKeys = ['alerts', 'type'];
27
28   constructor(private i18n: I18n) {
29     super();
30   }
31
32   ngOnInit() {
33     this.columns = [
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') }
40     ];
41   }
42 }