1 import { Component, Input, OnInit, TemplateRef, ViewChild } from '@angular/core';
3 import { PerformanceCounterService } from '~/app/shared/api/performance-counter.service';
4 import { CdTableColumn } from '~/app/shared/models/cd-table-column';
5 import { CdTableFetchDataContext } from '~/app/shared/models/cd-table-fetch-data-context';
8 * Display the specified performance counters in a datatable.
11 selector: 'cd-table-performance-counter',
12 templateUrl: './table-performance-counter.component.html',
13 styleUrls: ['./table-performance-counter.component.scss']
15 export class TablePerformanceCounterComponent implements OnInit {
16 columns: Array<CdTableColumn> = [];
17 counters: Array<object> = [];
19 @ViewChild('valueTpl')
20 public valueTpl: TemplateRef<any>;
23 * The service type, e.g. 'rgw', 'mds', 'mon', 'osd', ...
29 * The service identifier.
34 constructor(private performanceCounterService: PerformanceCounterService) {}
39 name: $localize`Name`,
44 name: $localize`Description`,
49 name: $localize`Value`,
51 cellTemplate: this.valueTpl,
57 getCounters(context: CdTableFetchDataContext) {
58 this.performanceCounterService.get(this.serviceType, this.serviceId).subscribe(
63 if (error.status === 404) {
64 error.preventDefault();