From: Nizamudeen A Date: Thu, 18 Nov 2021 20:31:36 +0000 (+0530) Subject: mgr/dashboard: Hide hostname column of daemon table in host details X-Git-Tag: v16.2.8~14^2~1 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=8b711c7b593b7c4ec39464e1703e1818a55471f1;p=ceph.git mgr/dashboard: Hide hostname column of daemon table in host details Fixes: https://tracker.ceph.com/issues/53355 Signed-off-by: Nizamudeen A (cherry picked from commit 05750a975dae4f53d590f76d6325a6934993c0ee) --- diff --git a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts index cbc900813dc72..821be43bbab5f 100644 --- a/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts +++ b/src/pybind/mgr/dashboard/frontend/cypress/integration/cluster/services.po.ts @@ -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); + }); + }); }); } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.html index dfd4d3f90f113..a138768c351f4 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/host-details/host-details.component.html @@ -24,7 +24,8 @@ i18n>Daemons + flag="hostDetails" + [hiddenColumns]="['hostname']"> diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts index adb2c1871dfa1..ba8068b23be17 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/services/service-daemon-list/service-daemon-list.component.ts @@ -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() {