]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Hide hostname column of daemon table in host details
authorNizamudeen A <nia@redhat.com>
Thu, 18 Nov 2021 20:31:36 +0000 (02:01 +0530)
committerNizamudeen A <nia@redhat.com>
Thu, 31 Mar 2022 06:46:44 +0000 (12:16 +0530)
Fixes: https://tracker.ceph.com/issues/53355
Signed-off-by: Nizamudeen A <nia@redhat.com>
(cherry picked from commit 05750a975dae4f53d590f76d6325a6934993c0ee)

src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.html
src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts

index cbc900813dc7222522b5e5d0a40b0651780dcd2e..821be43bbab5f5b40d088d2e5cad6d4c33447559 100644 (file)
@@ -17,9 +17,8 @@ export class ServicesPageHelper extends PageHelper {
   };
 
   serviceDetailColumnIndex = {
-    hostname: 1,
-    daemonType: 2,
-    status: 8
+    daemonName: 1,
+    status: 7
   };
 
   check_for_service() {
@@ -114,14 +113,28 @@ export class ServicesPageHelper extends PageHelper {
   }
 
   checkServiceStatus(daemon: string, expectedStatus = 'running') {
-    cy.get('cd-service-daemon-list').within(() => {
-      this.getTableCell(this.serviceDetailColumnIndex.daemonType, daemon)
-        .parent()
-        .find(`datatable-body-cell:nth-child(${this.serviceDetailColumnIndex.status}) .badge`)
-        .should(($ele) => {
-          const status = $ele.toArray().map((v) => v.innerText);
-          expect(status).to.include(expectedStatus);
-        });
+    let daemonNameIndex = this.serviceDetailColumnIndex.daemonName;
+    let statusIndex = this.serviceDetailColumnIndex.status;
+
+    // since hostname row is hidden from the hosts details table,
+    // we'll need to manually override the indexes when this check is being
+    // done for the daemons in host details page. So we'll get the url and
+    // verify if the current page is not the services index page
+    cy.url().then(url => {
+      if (!url.includes(pages.index.url)) {
+        daemonNameIndex = 1;
+        statusIndex = 6;
+      }
+
+      cy.get('cd-service-daemon-list').within(() => {
+        this.getTableCell(daemonNameIndex, daemon, true)
+          .parent()
+          .find(`datatable-body-cell:nth-child(${statusIndex}) .badge`)
+          .should(($ele) => {
+            const status = $ele.toArray().map((v) => v.innerText);
+            expect(status).to.include(expectedStatus);
+          });
+      });
     });
   }
 
index dfd4d3f90f113119087206a2507545602ee32843..a138768c351f4328a71b396ebf63996b0d4cf976 100644 (file)
@@ -24,7 +24,8 @@
          i18n>Daemons</a>
       <ng-template ngbNavContent>
         <cd-service-daemon-list [hostname]="selectedHostname"
-                                flag="hostDetails">
+                                flag="hostDetails"
+                                [hiddenColumns]="['hostname']">
         </cd-service-daemon-list>
       </ng-template>
     </li>
index adb2c1871dfa1c2e7d6ad0e0b485f9c99d702f9d..ba8068b23be17c920d6fdf046ebe80dcfc7a3072 100644 (file)
@@ -56,6 +56,9 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI
   @Input()
   hostname?: string;
 
+  @Input()
+  hiddenColumns: string[] = [];
+
   @Input()
   flag?: string;
 
@@ -216,6 +219,10 @@ export class ServiceDaemonListComponent implements OnInit, OnChanges, AfterViewI
       this.hasOrchestrator = data.available;
       this.showDocPanel = !data.available;
     });
+
+    this.columns = this.columns.filter((col: any) => {
+      return !this.hiddenColumns.includes(col.prop);
+    });
   }
 
   ngOnChanges() {