From b2b42a1e6e161125519380900ed14737d51dae01 Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Thu, 3 Dec 2020 18:14:04 +0530 Subject: [PATCH] mgr/dashboard: Fix for misleading "Orchestrator is not available" error When switching between options, in the Services and Inventory page sometimes it shows "Orchestrator not available" error which appears for 2-3 second and then disappears and shows the normal page. This commit fixes that. Fixes: https://tracker.ceph.com/issues/48448 Signed-off-by: Nizamudeen A --- .../src/app/ceph/cluster/inventory/inventory.component.html | 2 +- .../app/ceph/cluster/inventory/inventory.component.spec.ts | 4 ++++ .../src/app/ceph/cluster/inventory/inventory.component.ts | 2 ++ .../service-daemon-list/service-daemon-list.component.html | 2 +- .../service-daemon-list/service-daemon-list.component.spec.ts | 4 ++++ .../service-daemon-list/service-daemon-list.component.ts | 2 ++ .../src/app/ceph/cluster/services/services.component.html | 2 +- .../src/app/ceph/cluster/services/services.component.spec.ts | 4 ++++ .../src/app/ceph/cluster/services/services.component.ts | 2 ++ 9 files changed, 21 insertions(+), 3 deletions(-) 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 e05f6dc59e1..122aab2ed6d 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,4 +1,4 @@ - + Devices
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts index 48edbaec598..05f67edf7c5 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.spec.ts @@ -42,6 +42,10 @@ describe('InventoryComponent', () => { expect(component).toBeTruthy(); }); + it('should not display doc panel if orchestrator is available', () => { + expect(component.showDocPanel).toBeFalsy(); + }); + describe('after ngOnInit', () => { it('should load devices', () => { fixture.detectChanges(); 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 edf7f61e107..4fa280494f4 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 @@ -23,6 +23,7 @@ export class InventoryComponent implements OnChanges, OnInit, OnDestroy { icons = Icons; orchStatus: OrchestratorStatus; + showDocPanel = false; devices: Array = []; @@ -31,6 +32,7 @@ export class InventoryComponent implements OnChanges, OnInit, OnDestroy { ngOnInit() { this.orchService.status().subscribe((status) => { this.orchStatus = status; + this.showDocPanel = !status.available; if (status.available) { // Create a timer to get cached inventory from the orchestrator. // Do not ask the orchestrator frequently to refresh its cache data because it's expensive. diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.html index f649726a3fe..a9691e04234 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.html @@ -1,4 +1,4 @@ - + { component.getDaemons(new CdTableFetchDataContext(() => undefined)); expect(component.daemons.length).toBe(3); }); + + it('should not display doc panel if orchestrator is available', () => { + expect(component.showDocPanel).toBeFalsy(); + }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts index 95795f62285..c6d0a0a0561 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts @@ -46,6 +46,7 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI columns: CdTableColumn[] = []; hasOrchestrator = false; + showDocPanel = false; private daemonsTable: TableComponent; private daemonsTableTplsSub: Subscription; @@ -126,6 +127,7 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI this.orchService.status().subscribe((data: { available: boolean }) => { this.hasOrchestrator = data.available; + this.showDocPanel = !data.available; }); } 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 1db551591f5..49903e1a9cc 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,4 +1,4 @@ - + { component.getServices(new CdTableFetchDataContext(() => undefined)); expect(component.services.length).toBe(2); }); + + it('should not display doc panel if orchestrator is available', () => { + expect(component.showDocPanel).toBeFalsy(); + }); }); diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts index db4f51c56d5..32d27bc1f4f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts @@ -45,6 +45,7 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI permissions: Permissions; tableActions: CdTableAction[]; + showDocPanel = false; orchStatus: OrchestratorStatus; actionOrchFeatures = { @@ -139,6 +140,7 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI this.orchService.status().subscribe((status: OrchestratorStatus) => { this.orchStatus = status; + this.showDocPanel = !status.available; }); } -- 2.39.5