From 8f226fdc770bcbed6d2f5903cc7b7facaa10c6d6 Mon Sep 17 00:00:00 2001 From: Ivo Almeida Date: Wed, 14 Aug 2024 12:15:36 +0100 Subject: [PATCH] mgr/dashboard: carbon datatables impr and cleanups Fixes: https://tracker.ceph.com/issues/67544, https://tracker.ceph.com/issues/67538, https://tracker.ceph.com/issues/67542, https://tracker.ceph.com/issues/67545, https://tracker.ceph.com/issues/67546 Signed-off-by: Ivo Almeida --- .../rgw-multisite-details.component.html | 2 +- .../crud-table/crud-table.component.html | 6 +-- .../shared/datatable/table/table.component.ts | 47 ++++++++++--------- .../frontend/src/styles/themes/_content.scss | 6 +-- 4 files changed, 31 insertions(+), 30 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html index 5890ea45bdc..d0b2c2105d1 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html @@ -114,7 +114,7 @@ *ngIf="metadata"> {{ metadataTitle }}
-
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/crud-table/crud-table.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/crud-table/crud-table.component.html index e47cdee4a5d..73e4a307cfc 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/crud-table/crud-table.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/crud-table/crud-table.component.html @@ -29,9 +29,9 @@ [tableActions]="meta.actions"> - - + +
+ values.map( + (col: CdTableColumn) => + new TableHeaderItem({ + data: col?.headerTemplate ? { ...col } : col.name, + title: col.name, + template: col?.headerTemplate, + // if cellClass is a function it cannot be called here as it requires table data to execute + // instead if cellClass is a function it will be called and applied while parsing the data + className: _.isString(col?.cellClass) ? col?.cellClass : col?.className, + visible: !col.isHidden, + sortable: _.isNil(col.sortable) ? true : col.sortable + }) + ) + ) + ) + .subscribe({ + next: (values: TableHeaderItem[]) => (this.model.header = values) + }); + const datasetSubscription = this._dataset .pipe( filter((values: any[]) => { @@ -419,28 +442,6 @@ export class TableComponent implements AfterViewInit, OnInit, OnChanges, OnDestr } }); - const tableHeadersSubscription = this._tableHeaders - .pipe( - map((values: CdTableColumn[]) => - values.map( - (col: CdTableColumn) => - new TableHeaderItem({ - data: col?.headerTemplate ? { ...col } : col.name, - title: col.name, - template: col?.headerTemplate, - // if cellClass is a function it cannot be called here as it requires table data to execute - // instead if cellClass is a function it will be called and applied while parsing the data - className: _.isString(col?.cellClass) ? col?.cellClass : col?.className, - visible: !col.isHidden, - sortable: _.isNil(col.sortable) ? true : col.sortable - }) - ) - ) - ) - .subscribe({ - next: (values: TableHeaderItem[]) => (this.model.header = values) - }); - const rowsExpandedSubscription = this.model.rowsExpandedChange.subscribe({ next: (index: number) => { if (this.model.rowsExpanded.every((x) => !x)) { @@ -454,9 +455,9 @@ export class TableComponent implements AfterViewInit, OnInit, OnChanges, OnDestr } }); + this._subscriptions.add(tableHeadersSubscription); this._subscriptions.add(datasetSubscription); this._subscriptions.add(rowsExpandedSubscription); - this._subscriptions.add(tableHeadersSubscription); } ngOnInit() { diff --git a/src/pybind/mgr/dashboard/frontend/src/styles/themes/_content.scss b/src/pybind/mgr/dashboard/frontend/src/styles/themes/_content.scss index e436feed150..35e35f03b9f 100644 --- a/src/pybind/mgr/dashboard/frontend/src/styles/themes/_content.scss +++ b/src/pybind/mgr/dashboard/frontend/src/styles/themes/_content.scss @@ -28,10 +28,10 @@ $content-theme: map-merge( focus-inverse: lighten(vv.$primary, 25%), text-inverse: vv.$dark, support-info: vv.$info, - layer-01: vv.$secondary, - layer-hover-01: vv.$gray-600, + layer-01: vv.$light, + layer-hover-01: colors.$gray-20, text-primary: vv.$dark, - text-secondary: vv.$body-bg-alt, + text-secondary: vv.$dark, text-disabled: vv.$gray-500, icon-secondary: vv.$body-bg-alt ) -- 2.39.5