From 3b2089bcae0a4a5aefdbb24956d77b45c91679ec Mon Sep 17 00:00:00 2001 From: Daniel Persson Date: Sun, 6 Mar 2022 14:02:13 +0100 Subject: [PATCH] mgr/dashboard: switch the columns on and off correctly. Fixing the table model so it we can switch the columns on and off correctly. A bug in the function tranfering the user configured columns made them not tranfer over to the local displayed column list. Fixes: http://tracker.ceph.com/issues/51119 Signed-off-by: Daniel Persson (cherry picked from commit 7ea0eb723676b3670c9dad90a3cdd1650a5b710a) --- .../src/app/shared/datatable/table/table.component.ts | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts index 7ec2eca915cc..a2b7f7ec3dec 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts @@ -325,8 +325,12 @@ export class TableComponent implements AfterContentChecked, OnInit, OnChanges, O if (!this.userConfig.columns) { this.updateUserColumns(); } else { - this.localColumns.forEach((c, i) => { - c.isHidden = this.userConfig.columns[i].isHidden; + this.userConfig.columns.forEach((col) => { + for (let i = 0; i < this.localColumns.length; i++) { + if (this.localColumns[i].prop === col.prop) { + this.localColumns[i].isHidden = col.isHidden; + } + } }); } } -- 2.47.3