From: Kiefer Chang Date: Mon, 23 Dec 2019 08:20:37 +0000 (+0800) Subject: mgr/dashboard: cleanup codes X-Git-Tag: v15.1.1~14^2~2 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=ff364fa02214437d29bdf9f61ff907f315c73795;p=ceph-ci.git mgr/dashboard: cleanup codes Remove redundant codes for detecting Orchestrator. Signed-off-by: Kiefer Chang --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.html index de8a1145bd2..70a0d0ef50e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.html @@ -1,11 +1,5 @@ -Please consult the - documentation on how to - configure and enable the orchestrator functionality. - - + + Devices
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.ts index 2d5fd4ac5a1..a529924d93e 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.ts @@ -2,8 +2,6 @@ import { Component, Input, OnChanges, OnInit } from '@angular/core'; import { OrchestratorService } from '../../../shared/api/orchestrator.service'; import { Icons } from '../../../shared/enum/icons.enum'; -import { CephReleaseNamePipe } from '../../../shared/pipes/ceph-release-name.pipe'; -import { SummaryService } from '../../../shared/services/summary.service'; import { InventoryDevice } from './inventory-devices/inventory-device.model'; @Component({ @@ -17,41 +15,24 @@ export class InventoryComponent implements OnChanges, OnInit { icons = Icons; - checkingOrchestrator = true; - orchestratorExist = false; + hasOrchestrator = false; docsUrl: string; devices: Array = []; - constructor( - private cephReleaseNamePipe: CephReleaseNamePipe, - private orchService: OrchestratorService, - private summaryService: SummaryService - ) {} + constructor(private orchService: OrchestratorService) {} ngOnInit() { - // duplicated code with grafana - const subs = this.summaryService.subscribe((summary: any) => { - if (!summary) { - return; + this.orchService.status().subscribe((status) => { + this.hasOrchestrator = status.available; + if (status.available) { + this.getInventory(); } - - const releaseName = this.cephReleaseNamePipe.transform(summary.version); - this.docsUrl = `http://docs.ceph.com/docs/${releaseName}/mgr/orchestrator/`; - - setTimeout(() => { - subs.unsubscribe(); - }, 0); - }); - - this.orchService.status().subscribe((data: { available: boolean }) => { - this.orchestratorExist = data.available; - this.checkingOrchestrator = false; }); } ngOnChanges() { - if (this.orchestratorExist) { + if (this.hasOrchestrator) { this.devices = []; this.getInventory(); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.html index 132795dd52b..f2dc381c5c2 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-form/osd-form.component.html @@ -1,13 +1,6 @@ -Loading... -Please consult the - documentation on how to - configure and enable the orchestrator functionality. +
+ *ngIf="!loading && hasOrchestrator">
{ - if (!summary) { - return; - } - - const releaseName = this.cephReleaseNamePipe.transform(summary.version); - this.docsUrl = `http://docs.ceph.com/docs/${releaseName}/mgr/orchestrator/`; - - setTimeout(() => { - subs.unsubscribe(); - }, 0); - }); - - this.orchService.status().subscribe((data: { available: boolean }) => { - this.orchestratorExist = data.available; - this.checkingOrchestrator = false; - if (this.orchestratorExist) { + this.orchService.status().subscribe((status) => { + this.hasOrchestrator = status.available; + if (this.hasOrchestrator) { this.getDataDevices(); } }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.html index ce3e72bceab..5749d89d065 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.html @@ -1,11 +1,5 @@ -Please consult the - documentation on how to - configure and enable the orchestrator functionality. - - + + = []; @@ -40,11 +39,9 @@ export class ServicesComponent implements OnChanges, OnInit { constructor( private authStorageService: AuthStorageService, - private cephReleaseNamePipe: CephReleaseNamePipe, private i18n: I18n, private orchService: OrchestratorService, - private cephServiceService: CephServiceService, - private summaryService: SummaryService + private cephServiceService: CephServiceService ) { this.permissions = this.authStorageService.getPermissions(); } @@ -87,23 +84,8 @@ export class ServicesComponent implements OnChanges, OnInit { return !this.hiddenColumns.includes(col.prop); }); - // duplicated code with grafana - const subs = this.summaryService.subscribe((summary: any) => { - if (!summary) { - return; - } - - const releaseName = this.cephReleaseNamePipe.transform(summary.version); - this.docsUrl = `http://docs.ceph.com/docs/${releaseName}/mgr/orchestrator/`; - - setTimeout(() => { - subs.unsubscribe(); - }, 0); - }); - - this.orchService.status().subscribe((data: { available: boolean }) => { - this.orchestratorExist = data.available; - this.checkingOrchestrator = false; + this.orchService.status().subscribe((status) => { + this.hasOrchestrator = status.available; }); }