From 3fe39de706dcefe0a83bac1c2c1bca24a678c176 Mon Sep 17 00:00:00 2001 From: Sarthak0702 Date: Wed, 6 Apr 2022 06:23:35 +0530 Subject: [PATCH] mgr/dashboard: datatable in Cluster Host page hides wrong column on selection Signed-off-by: Sarthak0702 --- .../src/app/ceph/cluster/hosts/hosts.component.ts | 1 - .../app/shared/datatable/table/table.component.spec.ts | 9 +++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts index 36bcf8ec8f046..f7df997c37b0d 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/hosts/hosts.component.ts @@ -474,7 +474,6 @@ export class HostsComponent extends ListWithDetails implements OnDestroy, OnInit } else { // mark host facts columns unavailable for (let column = 4; column < this.columns.length; column++) { - this.columns[column]['prop'] = ''; this.columns[column]['cellTemplate'] = this.orchTmpl; } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts index a2a329ab64564..98ed0bf63a164 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.spec.ts @@ -513,6 +513,15 @@ describe('TableComponent', () => { equalStorageConfig(); }); + it('should toggle on off columns', () => { + for (const column of component.columns) { + component.toggleColumn(column); + expect(column.isHidden).toBeTruthy(); + component.toggleColumn(column); + expect(column.isHidden).toBeFalsy(); + } + }); + afterEach(() => { clearLocalStorage(); }); -- 2.39.5