]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: Fix for misleading "Orchestrator is not available" error
authorNizamudeen A <nia@redhat.com>
Thu, 3 Dec 2020 12:44:04 +0000 (18:14 +0530)
committerNizamudeen A <nia@redhat.com>
Thu, 3 Dec 2020 15:43:53 +0000 (21:13 +0530)
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 <nia@redhat.com>
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.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/inventory/inventory.component.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.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.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/services.component.ts

index e05f6dc59e1779c59c66acc499725a753e89835d..122aab2ed6df506708d3fd83b21544e36e2520a7 100644 (file)
@@ -1,4 +1,4 @@
-<cd-orchestrator-doc-panel *ngIf="!orchStatus?.available"></cd-orchestrator-doc-panel>
+<cd-orchestrator-doc-panel *ngIf="showDocPanel"></cd-orchestrator-doc-panel>
 <ng-container *ngIf="orchStatus?.available">
   <legend i18n>Devices</legend>
   <div class="row">
index 48edbaec598a384488f393e362f8ad6cc3f10c28..05f67edf7c5b8e810622f1ef45ca713c92ef3e05 100644 (file)
@@ -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();
index edf7f61e107685363573b9992c7354560838ae1d..4fa280494f464c12a3a36ad3b47d759ed28b464f 100644 (file)
@@ -23,6 +23,7 @@ export class InventoryComponent implements OnChanges, OnInit, OnDestroy {
   icons = Icons;
 
   orchStatus: OrchestratorStatus;
+  showDocPanel = false;
 
   devices: Array<InventoryDevice> = [];
 
@@ -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.
index f649726a3fe76640fdc577af73b9d5fceb13bcdc..a9691e04234e6f3155ef61924cfcd9904c02f6c2 100644 (file)
@@ -1,4 +1,4 @@
-<cd-orchestrator-doc-panel *ngIf="!hasOrchestrator"></cd-orchestrator-doc-panel>
+<cd-orchestrator-doc-panel *ngIf="showDocPanel"></cd-orchestrator-doc-panel>
 <cd-table *ngIf="hasOrchestrator"
           #daemonsTable
           [data]="daemons"
index 184e2e7ef6fa894b13a759fca44d513cfcf5eb43..42c06228d867f273549147603ebfad525e0e2943 100644 (file)
@@ -110,4 +110,8 @@ describe('ServiceDaemonListComponent', () => {
     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();
+  });
 });
index 95795f6228512c62db1205958a70ea9c9337136a..c6d0a0a0561a82bc71846a8cbe163fcd34191924 100644 (file)
@@ -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;
     });
   }
 
index 1db551591f5d5e6a345bfda850b647b84f885dbe..49903e1a9cc3fcfc9473ae0d81aec27ad8ec9fb4 100644 (file)
@@ -1,4 +1,4 @@
-<cd-orchestrator-doc-panel *ngIf="!orchStatus?.available"></cd-orchestrator-doc-panel>
+<cd-orchestrator-doc-panel *ngIf="showDocPanel"></cd-orchestrator-doc-panel>
 <ng-container *ngIf="orchStatus?.available">
   <cd-table [data]="services"
             [columns]="columns"
index a6e56ce2282d7a44555b19d71739c7809c834547..f36f6c3956836d561a8a23cefaa279ccac62b761 100644 (file)
@@ -94,4 +94,8 @@ describe('ServicesComponent', () => {
     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();
+  });
 });
index db4f51c56d56fcdb48984c711eda1dd66caeab52..32d27bc1f4fd804da04b1e59d054a27b80a39579 100644 (file)
@@ -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;
     });
   }