Skip to content

Commit dbcd888

Browse files
authored
Merge pull request ceph#59220 from ivoalmeida/carbon-datatable-cleanups
mgr/dashboard: carbon datatables impr and cleanups Reviewed-by: Nizamudeen A <[email protected]>
2 parents 489919e + 8f226fd commit dbcd888

File tree

4 files changed

+31
-30
lines changed

4 files changed

+31
-30
lines changed

src/pybind/mgr/dashboard/frontend/src/app/ceph/rgw/rgw-multisite-details/rgw-multisite-details.component.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@
114114
*ngIf="metadata">
115115
<legend>{{ metadataTitle }}</legend>
116116
<div>
117-
<cd-table-key-value cdTableDetail
117+
<cd-table-key-value *cdTableDetail
118118
[data]="metadata">
119119
</cd-table-key-value>
120120
</div>

src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/crud-table/crud-table.component.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929
[tableActions]="meta.actions">
3030
</cd-table-actions>
3131
</div>
32-
<ng-container [ngIf]="expandedRow && meta.detail_columns.length > 0"
33-
*cdTableDetail>
34-
<table class="table table-striped table-bordered">
32+
<ng-container *ngIf="expandedRow && meta.detail_columns.length > 0">
33+
<table *cdTableDetail
34+
class="table table-striped table-bordered">
3535
<tbody>
3636
<tr *ngFor="let column of meta.detail_columns">
3737
<td i18n

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

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -363,6 +363,29 @@ export class TableComponent implements AfterViewInit, OnInit, OnChanges, OnDestr
363363
}
364364
];
365365
}
366+
367+
const tableHeadersSubscription = this._tableHeaders
368+
.pipe(
369+
map((values: CdTableColumn[]) =>
370+
values.map(
371+
(col: CdTableColumn) =>
372+
new TableHeaderItem({
373+
data: col?.headerTemplate ? { ...col } : col.name,
374+
title: col.name,
375+
template: col?.headerTemplate,
376+
// if cellClass is a function it cannot be called here as it requires table data to execute
377+
// instead if cellClass is a function it will be called and applied while parsing the data
378+
className: _.isString(col?.cellClass) ? col?.cellClass : col?.className,
379+
visible: !col.isHidden,
380+
sortable: _.isNil(col.sortable) ? true : col.sortable
381+
})
382+
)
383+
)
384+
)
385+
.subscribe({
386+
next: (values: TableHeaderItem[]) => (this.model.header = values)
387+
});
388+
366389
const datasetSubscription = this._dataset
367390
.pipe(
368391
filter((values: any[]) => {
@@ -419,28 +442,6 @@ export class TableComponent implements AfterViewInit, OnInit, OnChanges, OnDestr
419442
}
420443
});
421444

422-
const tableHeadersSubscription = this._tableHeaders
423-
.pipe(
424-
map((values: CdTableColumn[]) =>
425-
values.map(
426-
(col: CdTableColumn) =>
427-
new TableHeaderItem({
428-
data: col?.headerTemplate ? { ...col } : col.name,
429-
title: col.name,
430-
template: col?.headerTemplate,
431-
// if cellClass is a function it cannot be called here as it requires table data to execute
432-
// instead if cellClass is a function it will be called and applied while parsing the data
433-
className: _.isString(col?.cellClass) ? col?.cellClass : col?.className,
434-
visible: !col.isHidden,
435-
sortable: _.isNil(col.sortable) ? true : col.sortable
436-
})
437-
)
438-
)
439-
)
440-
.subscribe({
441-
next: (values: TableHeaderItem[]) => (this.model.header = values)
442-
});
443-
444445
const rowsExpandedSubscription = this.model.rowsExpandedChange.subscribe({
445446
next: (index: number) => {
446447
if (this.model.rowsExpanded.every((x) => !x)) {
@@ -454,9 +455,9 @@ export class TableComponent implements AfterViewInit, OnInit, OnChanges, OnDestr
454455
}
455456
});
456457

458+
this._subscriptions.add(tableHeadersSubscription);
457459
this._subscriptions.add(datasetSubscription);
458460
this._subscriptions.add(rowsExpandedSubscription);
459-
this._subscriptions.add(tableHeadersSubscription);
460461
}
461462

462463
ngOnInit() {

src/pybind/mgr/dashboard/frontend/src/styles/themes/_content.scss

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,10 @@ $content-theme: map-merge(
2828
focus-inverse: lighten(vv.$primary, 25%),
2929
text-inverse: vv.$dark,
3030
support-info: vv.$info,
31-
layer-01: vv.$secondary,
32-
layer-hover-01: vv.$gray-600,
31+
layer-01: vv.$light,
32+
layer-hover-01: colors.$gray-20,
3333
text-primary: vv.$dark,
34-
text-secondary: vv.$body-bg-alt,
34+
text-secondary: vv.$dark,
3535
text-disabled: vv.$gray-500,
3636
icon-secondary: vv.$body-bg-alt
3737
)

0 commit comments

Comments
 (0)