1 import { Component, Input, OnInit, TemplateRef, ViewChild } from '@angular/core';
3 import { I18n } from '@ngx-translate/i18n-polyfill';
5 import { PerformanceCounterService } from '../../../shared/api/performance-counter.service';
6 import { CdTableColumn } from '../../../shared/models/cd-table-column';
7 import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context';
10 * Display the specified performance counters in a datatable.
13 selector: 'cd-table-performance-counter',
14 templateUrl: './table-performance-counter.component.html',
15 styleUrls: ['./table-performance-counter.component.scss']
17 export class TablePerformanceCounterComponent implements OnInit {
18 columns: Array<CdTableColumn> = [];
19 counters: Array<object> = [];
21 @ViewChild('valueTpl')
22 public valueTpl: TemplateRef<any>;
25 * The service type, e.g. 'rgw', 'mds', 'mon', 'osd', ...
31 * The service identifier.
36 constructor(private performanceCounterService: PerformanceCounterService, private i18n: I18n) {}
41 name: this.i18n('Name'),
46 name: this.i18n('Description'),
51 name: this.i18n('Value'),
53 cellTemplate: this.valueTpl,
59 getCounters(context: CdTableFetchDataContext) {
60 this.performanceCounterService.get(this.serviceType, this.serviceId).subscribe(
65 if (error.status === 404) {
66 error.preventDefault();