From c53c74316163e4691a7cf617b9c50e1b7016c575 Mon Sep 17 00:00:00 2001 From: Nizamudeen A Date: Fri, 15 Sep 2023 12:10:24 +0530 Subject: [PATCH] mgr/dashboard: remove empty popover when there are no health warns Fixes: https://tracker.ceph.com/issues/62846 Signed-off-by: Nizamudeen A (cherry picked from commit d7d142435863239751fb5e228d80fe4c44490aee) --- .../cluster/upgrade/upgrade.component.html | 7 +++ .../cluster/upgrade/upgrade.component.spec.ts | 48 +++++++++++++++++++ 2 files changed, 55 insertions(+) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.html index e45157455bfe..b1867c3bb0c6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.html @@ -55,6 +55,7 @@ +
+
+ + +
+ {{ healthData.health.status | healthLabel | uppercase }}
+
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.spec.ts index 574d3c8bb4c8..46b1d99204cb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/upgrade/upgrade.component.spec.ts @@ -179,4 +179,52 @@ describe('UpgradeComponent', () => { const loading = fixture.debugElement.nativeElement.querySelector('#upgrade-status-error'); expect(loading.textContent).toContain('Failed to retrieve'); }); + + it('should show popover when health warning is present', () => { + const healthPayload: Record = { + health: { + status: 'HEALTH_WARN', + checks: [ + { + severity: 'HEALTH_WARN', + summary: { message: '1 pool(s) do not have an application enabled', count: 1 }, + detail: [ + { message: "application not enabled on pool 'scbench'" }, + { + message: + "use 'ceph osd pool application enable ', where is 'cephfs', 'rbd', 'rgw', or freeform for custom applications." + } + ], + muted: false, + type: 'POOL_APP_NOT_ENABLED' + } + ], + mutes: [] + } + }; + + getHealthSpy.and.returnValue(of(healthPayload)); + component.ngOnInit(); + fixture.detectChanges(); + + const popover = fixture.debugElement.nativeElement.querySelector( + '.info-card-content-clickable' + ); + expect(popover).not.toBeNull(); + }); + + it('should not show popover when health warning is not present', () => { + const healthPayload: Record = { + health: { + status: 'HEALTH_OK' + } + }; + getHealthSpy.and.returnValue(of(healthPayload)); + component.ngOnInit(); + fixture.detectChanges(); + const popover = fixture.debugElement.nativeElement.querySelector( + '.info-card-content-clickable' + ); + expect(popover).toBeNull(); + }); }); -- 2.47.3