From: Kiefer Chang Date: Wed, 8 Jan 2020 07:51:07 +0000 (+0800) Subject: mgr/dashboard: Use column filtering feature for Configuration page X-Git-Tag: v15.1.0~90^2~1 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=d99402a6c0125f976de186eb177137a5e1ca3ee2;p=ceph.git mgr/dashboard: Use column filtering feature for Configuration page Signed-off-by: Kiefer Chang --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.html index 36e65bd619bb..f4b6401a2466 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.html @@ -1,6 +1,7 @@ - -
-
- - -
- -
- -
-
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts index 00f67a2b231a..712d0d8a064c 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/configuration/configuration.component.ts @@ -25,14 +25,13 @@ export class ConfigurationComponent implements OnInit { icons = Icons; columns: CdTableColumn[]; selection = new CdTableSelection(); - filters = [ + filters: CdTableColumn[] = [ { - label: this.i18n('Level'), + name: this.i18n('Level'), prop: 'level', - initValue: 'basic', - value: 'basic', - options: ['basic', 'advanced', 'dev'], - applyFilter: (row, value) => { + filterOptions: ['basic', 'advanced', 'dev'], + filterInitValue: 'basic', + filterPredicate: (row, value) => { enum Level { basic = 0, advanced = 1, @@ -45,34 +44,21 @@ export class ConfigurationComponent implements OnInit { } }, { - label: this.i18n('Service'), + name: this.i18n('Service'), prop: 'services', - initValue: 'any', - value: 'any', - options: ['any', 'mon', 'mgr', 'osd', 'mds', 'common', 'mds_client', 'rgw'], - applyFilter: (row, value) => { - if (value === 'any') { - return true; - } - + filterOptions: ['mon', 'mgr', 'osd', 'mds', 'common', 'mds_client', 'rgw'], + filterPredicate: (row, value) => { return row.services.includes(value); } }, { - label: this.i18n('Source'), + name: this.i18n('Source'), prop: 'source', - initValue: 'any', - value: 'any', - options: ['any', 'mon'], - applyFilter: (row, value) => { - if (value === 'any') { - return true; - } - + filterOptions: ['mon'], + filterPredicate: (row, value) => { if (!row.hasOwnProperty('source')) { return false; } - return row.source.includes(value); } } @@ -138,17 +124,6 @@ export class ConfigurationComponent implements OnInit { ); } - updateFilter() { - this.data = [...this.data]; - } - - resetFilter() { - this.filters.forEach((item) => { - item.value = item.initValue; - }); - this.data = [...this.data]; - } - isEditable(selection: CdTableSelection): boolean { if (selection.selected.length !== 1) { return false;