From: Kanika Murarka Date: Thu, 4 Oct 2018 15:53:22 +0000 (+0530) Subject: mgr/dashboard: Adding Grafana componenets to views X-Git-Tag: v14.0.1~104^2~3 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=81ffe2bf5b5d5081a04c77ce3b854e33072af216;p=ceph.git mgr/dashboard: Adding Grafana componenets to views Fixes: https://tracker.ceph.com/issues/24999 Signed-off-by: Kanika Murarka --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.html index f3129cd0fb2bc..974068b972b2a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.html @@ -40,6 +40,12 @@ *ngIf="clientsSelect"> + + + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts index 8d28ce298825b..e536e455037d5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-detail/cephfs-detail.component.ts @@ -30,6 +30,7 @@ export class CephfsDetailComponent implements OnChanges, OnInit { standbys = []; clientCount: number; mdsCounters = {}; + grafanaId: any; objectValues = Object.values; clientsSelect = false; @@ -43,6 +44,8 @@ export class CephfsDetailComponent implements OnChanges, OnInit { ngOnChanges() { if (this.selection.hasSelection) { this.selectedItem = this.selection.first(); + const mdsInfo: any[] = this.selectedItem.mdsmap.info; + this.grafanaId = Object.values(mdsInfo)[0].name; if (this.id !== this.selectedItem.id) { this.id = this.selectedItem.id; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts index 3893de00e6799..357c8062a4a39 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/cluster.module.ts @@ -10,6 +10,7 @@ import { TabsModule } from 'ngx-bootstrap/tabs'; import { SharedModule } from '../../shared/shared.module'; import { PerformanceCounterModule } from '../performance-counter/performance-counter.module'; import { ConfigurationComponent } from './configuration/configuration.component'; +import { HostDetailsComponent } from './hosts/host-details/host-details.component'; import { HostsComponent } from './hosts/hosts.component'; import { MonitorComponent } from './monitor/monitor.component'; import { OsdDetailsComponent } from './osd/osd-details/osd-details.component'; @@ -39,7 +40,8 @@ import { OsdScrubModalComponent } from './osd/osd-scrub-modal/osd-scrub-modal.co OsdDetailsComponent, OsdPerformanceHistogramComponent, OsdScrubModalComponent, - OsdFlagsModalComponent + OsdFlagsModalComponent, + HostDetailsComponent ] }) export class ClusterModule {} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.html new file mode 100644 index 0000000000000..2f26bf7d46f39 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.html @@ -0,0 +1,8 @@ + + + + + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.scss new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts new file mode 100644 index 0000000000000..b4ae12f9957ab --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.spec.ts @@ -0,0 +1,38 @@ +import { HttpClientTestingModule } from '@angular/common/http/testing'; +import { ComponentFixture, TestBed } from '@angular/core/testing'; + +import { BsDropdownModule } from 'ngx-bootstrap'; +import { TabsModule } from 'ngx-bootstrap/tabs'; + +import { configureTestBed } from '../../../../../testing/unit-test-helper'; +import { CdTableSelection } from '../../../../shared/models/cd-table-selection'; +import { SharedModule } from '../../../../shared/shared.module'; +import { HostDetailsComponent } from './host-details.component'; + +describe('HostDetailsComponent', () => { + let component: HostDetailsComponent; + let fixture: ComponentFixture; + + configureTestBed({ + imports: [ + HttpClientTestingModule, + TabsModule.forRoot(), + BsDropdownModule.forRoot(), + SharedModule + ], + declarations: [HostDetailsComponent] + }); + + beforeEach(() => { + fixture = TestBed.createComponent(HostDetailsComponent); + component = fixture.componentInstance; + + component.selection = new CdTableSelection(); + + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.ts new file mode 100644 index 0000000000000..f72b7b2b95947 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.ts @@ -0,0 +1,22 @@ +import { Component, Input, OnChanges } from '@angular/core'; + +import { CdTableSelection } from '../../../../shared/models/cd-table-selection'; + +@Component({ + selector: 'cd-host-details', + templateUrl: './host-details.component.html', + styleUrls: ['./host-details.component.scss'] +}) +export class HostDetailsComponent implements OnChanges { + @Input() + selection: CdTableSelection; + host: any; + + constructor() {} + + ngOnChanges() { + if (this.selection.hasSelection) { + this.host = this.selection.first(); + } + } +} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.html index 4f71cad08cbe9..614f172cc8bc9 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.html @@ -1,14 +1,33 @@ - - - - {{ service.type }}.{{ service.id }} - {{ service.type }}.{{ service.id }} - {{ !isLast ? ", " : "" }} - - - + + + + + + {{ service.type }}.{{ service.id }} + + + {{ service.type }}.{{ service.id }} + + {{ !isLast ? ", " : "" }} + + + + + + + + + + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts index ba23b2d332774..2f800c6767b05 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.spec.ts @@ -3,12 +3,14 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { RouterTestingModule } from '@angular/router/testing'; import { BsDropdownModule } from 'ngx-bootstrap'; +import { TabsModule } from 'ngx-bootstrap/tabs'; import { configureTestBed } from '../../../../testing/unit-test-helper'; import { ComponentsModule } from '../../../shared/components/components.module'; import { Permissions } from '../../../shared/models/permissions'; import { AuthStorageService } from '../../../shared/services/auth-storage.service'; import { SharedModule } from '../../../shared/shared.module'; +import { HostDetailsComponent } from './host-details/host-details.component'; import { HostsComponent } from './hosts.component'; describe('HostsComponent', () => { @@ -25,12 +27,13 @@ describe('HostsComponent', () => { imports: [ SharedModule, HttpClientTestingModule, + TabsModule.forRoot(), ComponentsModule, BsDropdownModule.forRoot(), RouterTestingModule ], providers: [{ provide: AuthStorageService, useValue: fakeAuthStorageService }], - declarations: [HostsComponent] + declarations: [HostsComponent, HostDetailsComponent] }); beforeEach(() => { diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts index 3009e8a6cfa1e..86aa28d38d218 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts @@ -3,6 +3,7 @@ import { Component, OnInit, TemplateRef, ViewChild } from '@angular/core'; import { HostService } from '../../../shared/api/host.service'; import { CdTableColumn } from '../../../shared/models/cd-table-column'; import { CdTableFetchDataContext } from '../../../shared/models/cd-table-fetch-data-context'; +import { CdTableSelection } from '../../../shared/models/cd-table-selection'; import { Permissions } from '../../../shared/models/permissions'; import { CephShortVersionPipe } from '../../../shared/pipes/ceph-short-version.pipe'; import { AuthStorageService } from '../../../shared/services/auth-storage.service'; @@ -18,6 +19,7 @@ export class HostsComponent implements OnInit { hosts: Array = []; isLoadingHosts = false; cdParams = { fromLink: '/hosts' }; + selection = new CdTableSelection(); @ViewChild('servicesTpl') public servicesTpl: TemplateRef; @@ -52,6 +54,10 @@ export class HostsComponent implements OnInit { ]; } + updateSelection(selection: CdTableSelection) { + this.selection = selection; + } + getHosts(context: CdTableFetchDataContext) { if (this.isLoadingHosts) { return; diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html index d5773faf44631..35b057bee7a9f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-details/osd-details.component.html @@ -34,4 +34,10 @@ + + + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html index 71d6fec3e3858..3c031b4cc10c0 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html @@ -1,45 +1,57 @@ - -
- - + + + +
+ + - -
+ +
- - -
+ + + - - - - {{ state }} - -   - - + + + + {{ state }} + +   + + - - - + + + + + + + + + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.html index 440c4caf1bd16..c3595fdaa6726 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-list/pool-list.component.html @@ -1,14 +1,31 @@ - - - - - - - - + + + + + + + + + + + + + + + + + + + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.html index 81c5919db6971..2881e958c1c42 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-details/rgw-daemon-details.component.html @@ -11,4 +11,10 @@ [serviceId]="serviceId"> + + + + diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.html index 35cdf214951d8..73fbc0f233a8c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-daemon-list/rgw-daemon-list.component.html @@ -1,10 +1,20 @@ - - - - + + + + + + + + + + + + +