]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: switch the columns on and off correctly. 45725/head
authorDaniel Persson <mailto.woden@gmail.com>
Sun, 6 Mar 2022 13:02:13 +0000 (14:02 +0100)
committerNizamudeen A <nia@redhat.com>
Thu, 31 Mar 2022 07:11:40 +0000 (12:41 +0530)
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 <mailto.woden@gmail.com>
(cherry picked from commit 7ea0eb723676b3670c9dad90a3cdd1650a5b710a)

src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts

index 7ec2eca915cc5dc0597f38bc0814fde59bba1f70..a2b7f7ec3dec5253979f7c0aac702eba87b73936 100644 (file)
@@ -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;
+          }
+        }
       });
     }
   }