From e7596a66752a25f02a958acb6c0a053592498a2c 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 (cherry picked from commit b2b42a1e6e161125519380900ed14737d51dae01) Conflicts: src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.html src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.ts src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.html src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts - Fixed some minor conflicts due to frontend code divergence in master vs. octopus; --- .../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 70a0d0ef50e1a..f246411486c4b 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 8ef14bc6d7686..360aac4cea540 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 @@ -43,6 +43,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 da0f1a541a140..d70c70ecd2ea4 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 @@ -16,6 +16,7 @@ export class InventoryComponent implements OnChanges, OnInit { icons = Icons; hasOrchestrator = false; + showDocPanel = false; devices: Array = []; @@ -24,6 +25,7 @@ export class InventoryComponent implements OnChanges, OnInit { ngOnInit() { this.orchService.status().subscribe((status) => { this.hasOrchestrator = status.available; + this.showDocPanel = !status.available; if (status.available) { this.getInventory(); } 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 078ac04d42ed0..025ae8ac84e06 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(() => {})); 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 43cf10de322ac..a08181d2a1d7c 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; @@ -125,6 +126,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 11174d3849d04..db3bd8548ea88 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(() => {})); 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 8890ff5531ed1..ecccb9031e2b4 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 @@ -28,6 +28,7 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI @Input() hiddenColumns: string[] = []; permissions: Permissions; + showDocPanel = false; checkingOrchestrator = true; hasOrchestrator = false; @@ -93,6 +94,7 @@ export class ServicesComponent extends ListWithDetails implements OnChanges, OnI this.orchService.status().subscribe((status) => { this.hasOrchestrator = status.available; + this.showDocPanel = !status.available; }); } -- 2.39.5