From 95d56459df5cec51710d9e54c80698e6f43d113d Mon Sep 17 00:00:00 2001 From: Volker Theile Date: Thu, 15 Feb 2018 17:14:56 +0100 Subject: [PATCH] mgr/dashboard_v2: Create links to perf counters - Display links to the services in the Hosts data table - Add missing MDS performance counter backend Signed-off-by: Volker Theile --- .../dashboard_v2/controllers/perf_counters.py | 1 + .../src/app/ceph/cluster/cluster.module.ts | 7 +++--- .../ceph/cluster/hosts/hosts.component.html | 5 ++++ .../cluster/hosts/hosts.component.spec.ts | 11 +++----- .../app/ceph/cluster/hosts/hosts.component.ts | 25 +++++++++++-------- .../ceph/cluster/service-list.pipe.spec.ts | 8 ------ .../src/app/ceph/cluster/service-list.pipe.ts | 14 ----------- .../performance-counter.component.html | 12 +-------- .../performance-counter.component.ts | 7 +----- 9 files changed, 30 insertions(+), 60 deletions(-) delete mode 100644 src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/service-list.pipe.spec.ts delete mode 100644 src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/service-list.pipe.ts diff --git a/src/pybind/mgr/dashboard_v2/controllers/perf_counters.py b/src/pybind/mgr/dashboard_v2/controllers/perf_counters.py index 276b7e318ef..ee957a20d9d 100644 --- a/src/pybind/mgr/dashboard_v2/controllers/perf_counters.py +++ b/src/pybind/mgr/dashboard_v2/controllers/perf_counters.py @@ -53,6 +53,7 @@ class PerfCounter(RESTController): @AuthRequired() class PerfCounters(RESTController): def __init__(self): + self.mds = PerfCounter('mds', self.mgr) self.mon = PerfCounter('mon', self.mgr) self.osd = PerfCounter('osd', self.mgr) self.rgw = PerfCounter('rgw', self.mgr) diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/cluster.module.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/cluster.module.ts index 463f0106b8c..9992bfac456 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/cluster.module.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/cluster.module.ts @@ -1,26 +1,25 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; import { ComponentsModule } from '../../shared/components/components.module'; import { SharedModule } from '../../shared/shared.module'; import { HostsComponent } from './hosts/hosts.component'; import { MonitorService } from './monitor.service'; import { MonitorComponent } from './monitor/monitor.component'; -import { ServiceListPipe } from './service-list.pipe'; @NgModule({ imports: [ CommonModule, ComponentsModule, - SharedModule + SharedModule, + RouterModule ], declarations: [ HostsComponent, - ServiceListPipe, MonitorComponent, ], providers: [ - ServiceListPipe, MonitorService ] }) diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.html b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.html index de0524977ce..93e1a8ffd9a 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.html +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.html @@ -10,4 +10,9 @@ [toolHeader]="false" [footer]="false" [limit]="0"> + + + {{ service.type }}.{{ service.id }}{{ !isLast ? ", " : "" }} + + diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts index 7a950786c74..6bf9a2d763b 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts @@ -1,9 +1,9 @@ import { HttpClientTestingModule } from '@angular/common/http/testing'; import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; import { ComponentsModule } from '../../../shared/components/components.module'; import { SharedModule } from '../../../shared/shared.module'; -import { ServiceListPipe } from '../service-list.pipe'; import { HostsComponent } from './hosts.component'; describe('HostsComponent', () => { @@ -15,14 +15,11 @@ describe('HostsComponent', () => { imports: [ SharedModule, HttpClientTestingModule, - ComponentsModule + ComponentsModule, + RouterTestingModule ], declarations: [ - HostsComponent, - ServiceListPipe - ], - providers: [ - ServiceListPipe + HostsComponent ] }) .compileComponents(); diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.ts index 9b3d498597a..2c6f1b1cadc 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/hosts/hosts.component.ts @@ -1,6 +1,4 @@ -import { Component, OnInit } from '@angular/core'; - -import { ServiceListPipe } from '../service-list.pipe'; +import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe'; import { HostService } from '../../../shared/services/host.service'; @@ -15,9 +13,12 @@ export class HostsComponent implements OnInit { columns: Array = []; hosts: Array = []; + @ViewChild('servicesTpl') public servicesTpl: TemplateRef; + constructor(private hostService: HostService, - cephShortVersionPipe: CephShortVersionPipe, - serviceListPipe: ServiceListPipe) { + private cephShortVersionPipe: CephShortVersionPipe) { } + + ngOnInit() { this.columns = [ { name: 'Hostname', @@ -28,19 +29,23 @@ export class HostsComponent implements OnInit { name: 'Services', prop: 'services', flexGrow: 3, - pipe: serviceListPipe + cellTemplate: this.servicesTpl }, { name: 'Version', prop: 'ceph_version', flexGrow: 1, - pipe: cephShortVersionPipe + pipe: this.cephShortVersionPipe } ]; - } - - ngOnInit() { this.hostService.list().then((resp) => { + resp.map((host) => { + host.services.map((service) => { + service.cdLink = `/perf_counters/${service.type}/${service.id}`; + return service; + }); + return host; + }); this.hosts = resp; }); } diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/service-list.pipe.spec.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/service-list.pipe.spec.ts deleted file mode 100644 index 6edc89d8178..00000000000 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/service-list.pipe.spec.ts +++ /dev/null @@ -1,8 +0,0 @@ -import { ServiceListPipe } from './service-list.pipe'; - -describe('ServiceListPipe', () => { - it('create an instance', () => { - const pipe = new ServiceListPipe(); - expect(pipe).toBeTruthy(); - }); -}); diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/service-list.pipe.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/service-list.pipe.ts deleted file mode 100644 index aa66a139a75..00000000000 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/cluster/service-list.pipe.ts +++ /dev/null @@ -1,14 +0,0 @@ -import { Pipe, PipeTransform } from '@angular/core'; - -@Pipe({ - name: 'serviceList' -}) -export class ServiceListPipe implements PipeTransform { - transform(value: any, args?: any): any { - const strings = []; - value.forEach((server) => { - strings.push(server.type + '.' + server.id); - }); - return strings.join(', '); - } -} diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.html b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.html index 6fac5602672..98b7d7b3484 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.html +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.html @@ -1,16 +1,6 @@ - -
Performance Counters - +

{{ serviceType }}.{{ serviceId }}

diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.ts index 0877ee56a3b..60549afa800 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.ts @@ -1,8 +1,6 @@ import { Component, OnDestroy, OnInit } from '@angular/core'; import { ActivatedRoute } from '@angular/router'; -import { TablePerformanceCounterService } from '../services/table-performance-counter.service'; - @Component({ selector: 'cd-performance-counter', templateUrl: './performance-counter.component.html', @@ -13,10 +11,7 @@ export class PerformanceCounterComponent implements OnInit, OnDestroy { serviceType: string; routeParamsSubscribe: any; - constructor( - private route: ActivatedRoute, - private performanceCounterService: TablePerformanceCounterService - ) {} + constructor(private route: ActivatedRoute) { } ngOnInit() { this.routeParamsSubscribe = this.route.params.subscribe(