From: Nizamudeen A Date: Fri, 15 Sep 2023 06:40:24 +0000 (+0530) Subject: mgr/dashboard: remove empty popover when there are no health warns X-Git-Tag: v18.2.1~276^2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F53652%2Fhead;p=ceph.git 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) --- 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(); + }); });