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';
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({
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
--- /dev/null
+<nav aria-label="breadcrumb">
+ <ol class="breadcrumb">
+ <li class="breadcrumb-item">Cluster</li>
+ <li class="breadcrumb-item active">
+ <a [routerLink]="['/monitor']">Monitors</a>
+ </li>
+ <li class="breadcrumb-item active">{{ serviceType }}.{{ serviceId }} </li>
+ </ol>
+</nav>
+
+<fieldset>
+ <legend>Performance Counters</legend>
+
+ <cd-table-performance-counter [serviceType]="serviceType"
+ [serviceId]="serviceId">
+ </cd-table-performance-counter>
+</fieldset>
--- /dev/null
+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<PerformanceCounterComponent>;
+
+ 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();
+ });
+});
--- /dev/null
+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();
+ }
+}