]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: add popover list of managers in landing page
authorAvan Thakkar <athakkar@redhat.com>
Tue, 25 Feb 2020 08:49:10 +0000 (14:19 +0530)
committerroot <root@localhost.localdomain>
Thu, 12 Mar 2020 09:07:39 +0000 (14:37 +0530)
Fixes: https://tracker.ceph.com/issues/42979
Signed-off-by: Avan Thakkar <athakkar@redhat.com>
src/pybind/mgr/dashboard/controllers/health.py
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.scss
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/health/health.component.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mds-summary.pipe.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.spec.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/dashboard/mgr-summary.pipe.ts

index 2795d89ce50f404b71a15ea4eec34f8417de2512..35e7b07b216e7a136be14971beaf42ec2dd5ce8f 100644 (file)
@@ -106,7 +106,6 @@ class HealthData(object):
         fs_map = mgr.get('fs_map')
         if self._minimal:
             fs_map = partial_dict(fs_map, ['filesystems', 'standbys'])
-            fs_map['standbys'] = [{}] * len(fs_map['standbys'])
             fs_map['filesystems'] = [partial_dict(item, ['mdsmap']) for
                                      item in fs_map['filesystems']]
             for fs in fs_map['filesystems']:
@@ -114,7 +113,6 @@ class HealthData(object):
                 min_mdsmap_info = dict()
                 for k, v in mdsmap_info.items():
                     min_mdsmap_info[k] = partial_dict(v, ['state'])
-                fs['mdsmap'] = dict(info=min_mdsmap_info)
         return fs_map
 
     def host_count(self):
@@ -135,7 +133,6 @@ class HealthData(object):
         mgr_map = mgr.get('mgr_map')
         if self._minimal:
             mgr_map = partial_dict(mgr_map, ['active_name', 'standbys'])
-            mgr_map['standbys'] = [{}] * len(mgr_map['standbys'])
         return mgr_map
 
     def mon_status(self):
index 8fe797e28c37cfa50e4735121f50116dee46f886..84ce11fb23cbdf1651f6e313d47cd119ff5508ed 100644 (file)
     <cd-info-card cardTitle="Metadata Servers"
                   i18n-cardTitle
                   class="cd-status-card"
-                  *ngIf="(enabledFeature.cephfs && healthData.fs_map | mdsSummary) as transformedResult"
+                  *ngIf="((enabledFeature.cephfs && healthData.fs_map) | mdsSummary) as transformedResult"
                   [contentClass]="(transformedResult.length > 1 ? 'text-area-size-2' : '') + ' content-highlight'">
       <!-- TODO: check text-area-size-2 -->
       <span *ngFor="let result of transformedResult"
-            [ngClass]="result.class">
+            [ngClass]="result.class"
+            [title]="result.titleText != null ? result.titleText : ''">
         {{ result.content }}
       </span>
     </cd-info-card>
index efeb7c56fe6451d11bf5a5d84cfbe1ae537f3d88..9c7684a5c6f69e70c64462c55c892cc121c03f4f 100644 (file)
@@ -39,7 +39,7 @@ cd-info-card {
   white-space: pre;
 }
 
-.mgr-active-name:hover {
+.popover-info:hover {
   cursor: pointer;
 }
 
index 17bc30b9f6afeab306f0dda64f09cb7583761673..50a96ee6b51b58da2779cdbbf0a7020cc9eda28f 100644 (file)
@@ -33,7 +33,7 @@ describe('HealthComponent', () => {
     mgr_map: { standbys: [] },
     hosts: 0,
     rgw: 0,
-    fs_map: { filesystems: [] },
+    fs_map: { filesystems: [], standbys: [] },
     iscsi_daemons: 0,
     client_perf: {},
     scrub_status: 'Inactive',
index 159438c7776a797d276e83aeb80cc5a7d290e57b..cc5f9190a919658213de3a3728a960dce244faeb 100644 (file)
@@ -20,13 +20,13 @@ describe('MdsSummaryPipe', () => {
 
   it('transforms with 0 active and 2 standy', () => {
     const payload = {
-      standbys: [0],
+      standbys: [{ name: 'a' }],
       filesystems: [{ mdsmap: { info: [{ state: 'up:standby-replay' }] } }]
     };
     const expected = [
-      { class: '', content: '0 active' },
-      { class: 'card-text-line-break', content: '' },
-      { class: '', content: '2 standby' }
+      { class: 'popover-info', content: '0 active', titleText: '1 standbyReplay' },
+      { class: 'card-text-line-break', content: '', titleText: '' },
+      { class: 'popover-info', content: '2 standby', titleText: 'standby daemons: a' }
     ];
 
     expect(pipe.transform(payload)).toEqual(expected);
@@ -34,13 +34,13 @@ describe('MdsSummaryPipe', () => {
 
   it('transforms with 1 active and 1 standy', () => {
     const payload = {
-      standbys: [0],
-      filesystems: [{ mdsmap: { info: [{ state: 'up:active' }] } }]
+      standbys: [{ name: 'b' }],
+      filesystems: [{ mdsmap: { info: [{ state: 'up:active', name: 'a' }] } }]
     };
     const expected = [
-      { class: '', content: '1 active' },
-      { class: 'card-text-line-break', content: '' },
-      { class: '', content: '1 standby' }
+      { class: 'popover-info', content: '1 active', titleText: 'active daemon: a' },
+      { class: 'card-text-line-break', content: '', titleText: '' },
+      { class: 'popover-info', content: '1 standby', titleText: 'standby daemons: b' }
     ];
     expect(pipe.transform(payload)).toEqual(expected);
   });
@@ -50,17 +50,17 @@ describe('MdsSummaryPipe', () => {
       standbys: [0],
       filesystems: []
     };
-    const expected = [{ class: '', content: 'no filesystems' }];
+    const expected = [{ class: 'popover-info', content: 'no filesystems', titleText: '' }];
 
     expect(pipe.transform(payload)).toEqual(expected);
   });
 
   it('transforms without filesystem', () => {
-    const payload = { standbys: [0] };
+    const payload = { standbys: [{ name: 'a' }] };
     const expected = [
-      { class: '', content: '1 up' },
-      { class: 'card-text-line-break', content: '' },
-      { class: '', content: 'no filesystems' }
+      { class: 'popover-info', content: '1 up', titleText: '' },
+      { class: 'card-text-line-break', content: '', titleText: '' },
+      { class: 'popover-info', content: 'no filesystems', titleText: 'standby daemons: a' }
     ];
 
     expect(pipe.transform(payload)).toEqual(expected);
index 5d43e4244e52c457907a1f65d24de84b200fb734..7bd1014d8de06aa9b3d22a5c0fce2e02156f8b09 100644 (file)
@@ -42,22 +42,39 @@ export class MdsSummaryPipe implements PipeTransform {
       contentLine1 = `${active} ${this.i18n('active')}`;
       contentLine2 = `${standbys + standbyReplay} ${this.i18n('standby')}`;
     }
-
+    const standbyHoverText = value.standbys.map((s: any): string => s.name).join(', ');
+    const standbyTitleText = !standbyHoverText
+      ? ''
+      : `${this.i18n('standby daemons')}: ${standbyHoverText}`;
+    const fsLength = value.filesystems ? value.filesystems.length : 0;
+    const infoObject = fsLength > 0 ? value.filesystems[0].mdsmap.info : {};
+    const activeHoverText = Object.values(infoObject)
+      .map((info: any): string => info.name)
+      .join(', ');
+    let activeTitleText = !activeHoverText
+      ? ''
+      : `${this.i18n('active daemon')}: ${activeHoverText}`;
+    // There is always one standbyreplay to replace active daemon, if active one is down
+    if (!active && fsLength > 0) {
+      activeTitleText = `${standbyReplay} ${this.i18n('standbyReplay')}`;
+    }
     const mgrSummary = [
       {
         content: contentLine1,
-        class: ''
+        class: 'popover-info',
+        titleText: activeTitleText
       }
     ];
-
     if (contentLine2) {
       mgrSummary.push({
         content: '',
-        class: 'card-text-line-break'
+        class: 'card-text-line-break',
+        titleText: ''
       });
       mgrSummary.push({
         content: contentLine2,
-        class: ''
+        class: 'popover-info',
+        titleText: standbyTitleText
       });
     }
 
index ffa58d918768f152344ed69a4befa23d2d8eb93e..51e70d4d8ed6e6a498f66eed08756f61df38d267 100644 (file)
@@ -29,9 +29,9 @@ describe('MgrSummaryPipe', () => {
       standbys: []
     };
     const expected = [
-      { class: 'mgr-active-name', content: 'n/a active', titleText: '' },
+      { class: 'popover-info', content: 'n/a active', titleText: '' },
       { class: 'card-text-line-break', content: '', titleText: '' },
-      { class: '', content: '0 standby', titleText: '' }
+      { class: 'popover-info', content: '0 standby', titleText: '' }
     ];
 
     expect(pipe.transform(payload)).toEqual(expected);
@@ -39,13 +39,13 @@ describe('MgrSummaryPipe', () => {
 
   it('transforms with 1 active and 2 standbys', () => {
     const payload = {
-      active_name: 'a',
-      standbys: ['b', 'c']
+      active_name: 'x',
+      standbys: [{ name: 'y' }, { name: 'z' }]
     };
     const expected = [
-      { class: 'mgr-active-name', content: '1 active', titleText: 'active daemon: a' },
+      { class: 'popover-info', content: '1 active', titleText: 'active daemon: x' },
       { class: 'card-text-line-break', content: '', titleText: '' },
-      { class: '', content: '2 standby', titleText: '' }
+      { class: 'popover-info', content: '2 standby', titleText: 'standby daemons: y, z' }
     ];
 
     expect(pipe.transform(payload)).toEqual(expected);
index b3782ca32c13ce6fa87a356b6b90e48502f5b055..c99cd864635be19d02141292662e8b69e2b23788 100644 (file)
@@ -15,18 +15,23 @@ export class MgrSummaryPipe implements PipeTransform {
     }
 
     let activeCount = this.i18n('n/a');
-    const titleText = _.isUndefined(value.active_name)
+    const activeTitleText = _.isUndefined(value.active_name)
       ? ''
       : `${this.i18n('active daemon')}: ${value.active_name}`;
-    if (titleText.length > 0) {
+    // There is always one standbyreplay to replace active daemon, if active one is down
+    if (activeTitleText.length > 0) {
       activeCount = '1';
     }
+    const standbyHoverText = value.standbys.map((s: any): string => s.name).join(', ');
+    const standbyTitleText = !standbyHoverText
+      ? ''
+      : `${this.i18n('standby daemons')}: ${standbyHoverText}`;
     const standbyCount = value.standbys.length;
     const mgrSummary = [
       {
         content: `${activeCount} ${this.i18n('active')}`,
-        class: 'mgr-active-name',
-        titleText: titleText
+        class: 'popover-info',
+        titleText: activeTitleText
       }
     ];
 
@@ -37,8 +42,8 @@ export class MgrSummaryPipe implements PipeTransform {
     });
     mgrSummary.push({
       content: `${standbyCount} ${this.i18n('standby')}`,
-      class: '',
-      titleText: ''
+      class: 'popover-info',
+      titleText: standbyTitleText
     });
 
     return mgrSummary;