From: Tiago Melo Date: Wed, 14 Feb 2018 15:13:35 +0000 (+0000) Subject: mgr/dashboard_v2: add performance counter page X-Git-Tag: v13.0.2~84^2~65 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=0c78d5e0df47230c516e039ec2ee194142f9196a;p=ceph.git mgr/dashboard_v2: add performance counter page Signed-off-by: Tiago Melo --- diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/app-routing.module.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/app-routing.module.ts index 490bce77f89..96afda40669 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/app-routing.module.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/app-routing.module.ts @@ -4,6 +4,9 @@ import { RouterModule, Routes } from '@angular/router'; import { PoolDetailComponent } from './ceph/block/pool-detail/pool-detail.component'; import { HostsComponent } from './ceph/cluster/hosts/hosts.component'; import { DashboardComponent } from './ceph/dashboard/dashboard/dashboard.component'; +import { + PerformanceCounterComponent +} from './ceph/performance-counter/performance-counter/performance-counter.component'; import { RgwDaemonListComponent } from './ceph/rgw/rgw-daemon-list/rgw-daemon-list.component'; import { LoginComponent } from './core/auth/login/login.component'; import { AuthGuardService } from './shared/services/auth-guard.service'; @@ -22,7 +25,12 @@ const routes: Routes = [ component: RgwDaemonListComponent, canActivate: [AuthGuardService] }, - { path: 'block/pool/:name', component: PoolDetailComponent, canActivate: [AuthGuardService] } + { path: 'block/pool/:name', component: PoolDetailComponent, canActivate: [AuthGuardService] }, + { + path: 'perf_counters/:type/:id', + component: PerformanceCounterComponent, + canActivate: [AuthGuardService] + } ]; @NgModule({ diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter.module.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter.module.ts index 18ff9ca891c..f2c20299f4c 100644 --- a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter.module.ts +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter.module.ts @@ -1,17 +1,25 @@ import { CommonModule } from '@angular/common'; import { NgModule } from '@angular/core'; +import { RouterModule } from '@angular/router'; import { SharedModule } from '../../shared/shared.module'; +import { + PerformanceCounterComponent +} from './performance-counter/performance-counter.component'; import { TablePerformanceCounterService } from './services/table-performance-counter.service'; -import { TablePerformanceCounterComponent } from './table-performance-counter/table-performance-counter.component'; // tslint:disable-line +import { + TablePerformanceCounterComponent +} from './table-performance-counter/table-performance-counter.component'; @NgModule({ imports: [ CommonModule, - SharedModule + SharedModule, + RouterModule ], declarations: [ - TablePerformanceCounterComponent + TablePerformanceCounterComponent, + PerformanceCounterComponent ], providers: [ TablePerformanceCounterService 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 new file mode 100644 index 00000000000..6fac5602672 --- /dev/null +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.html @@ -0,0 +1,17 @@ + + +
+ Performance Counters + + + +
diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.scss b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.scss new file mode 100644 index 00000000000..e69de29bb2d diff --git a/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts new file mode 100644 index 00000000000..f2e2daeeef0 --- /dev/null +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.spec.ts @@ -0,0 +1,43 @@ +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; +import { RouterTestingModule } from '@angular/router/testing'; + +import { PerformanceCounterModule } from '../performance-counter.module'; +import { TablePerformanceCounterService } from '../services/table-performance-counter.service'; +import { PerformanceCounterComponent } from './performance-counter.component'; + +describe('PerformanceCounterComponent', () => { + let component: PerformanceCounterComponent; + let fixture: ComponentFixture; + + const fakeService = { + get: (service_type: string, service_id: string) => { + return new Promise(function(resolve, reject) { + return []; + }); + }, + list: () => { + return new Promise(function(resolve, reject) { + return {}; + }); + } + }; + + beforeEach( + async(() => { + TestBed.configureTestingModule({ + imports: [PerformanceCounterModule, RouterTestingModule], + providers: [{ provide: TablePerformanceCounterService, useValue: fakeService }] + }).compileComponents(); + }) + ); + + beforeEach(() => { + fixture = TestBed.createComponent(PerformanceCounterComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); 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 new file mode 100644 index 00000000000..0877ee56a3b --- /dev/null +++ b/src/pybind/mgr/dashboard_v2/frontend/src/app/ceph/performance-counter/performance-counter/performance-counter.component.ts @@ -0,0 +1,33 @@ +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', + styleUrls: ['./performance-counter.component.scss'] +}) +export class PerformanceCounterComponent implements OnInit, OnDestroy { + serviceId: string; + serviceType: string; + routeParamsSubscribe: any; + + constructor( + private route: ActivatedRoute, + private performanceCounterService: TablePerformanceCounterService + ) {} + + ngOnInit() { + this.routeParamsSubscribe = this.route.params.subscribe( + (params: { type: string; id: string }) => { + this.serviceId = params.id; + this.serviceType = params.type; + } + ); + } + + ngOnDestroy() { + this.routeParamsSubscribe.unsubscribe(); + } +}