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>
-<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">
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();
icons = Icons;
orchStatus: OrchestratorStatus;
+ showDocPanel = false;
devices: Array<InventoryDevice> = [];
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.
-<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"
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();
+ });
});
columns: CdTableColumn[] = [];
hasOrchestrator = false;
+ showDocPanel = false;
private daemonsTable: TableComponent;
private daemonsTableTplsSub: Subscription;
this.orchService.status().subscribe((data: { available: boolean }) => {
this.hasOrchestrator = data.available;
+ this.showDocPanel = !data.available;
});
}
-<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"
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();
+ });
});
permissions: Permissions;
tableActions: CdTableAction[];
+ showDocPanel = false;
orchStatus: OrchestratorStatus;
actionOrchFeatures = {
this.orchService.status().subscribe((status: OrchestratorStatus) => {
this.orchStatus = status;
+ this.showDocPanel = !status.available;
});
}