From dd06c75e3fe429be496f886aac54831dd7685e5e Mon Sep 17 00:00:00 2001 From: Naman Munet Date: Thu, 28 Aug 2025 14:42:00 +0530 Subject: [PATCH] mgr/dashboard: add customizations to table-actions https://tracker.ceph.com/issues/72764 Signed-off-by: Naman Munet --- .../osd/osd-list/osd-list.component.html | 3 +- .../rgw-multisite-details.component.html | 50 +++++++------------ .../rgw-multisite-details.component.scss | 6 +++ .../rgw-multisite-details.component.ts | 35 ++++++------- .../app/shared/datatable/datatable.module.ts | 4 +- .../table-actions.component.html | 15 +++--- .../table-actions.component.scss | 10 ++++ .../table-actions/table-actions.component.ts | 5 +- .../src/app/shared/enum/icons.enum.ts | 1 + 9 files changed, 66 insertions(+), 63 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html index 7a7fc9b01e801..72cebe8c03f96 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cluster/osd/osd-list/osd-list.component.html @@ -26,7 +26,8 @@ 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 1b07fb463dc05..68018154d53ed 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 @@ -18,37 +18,25 @@ routerLink="/services"> Cluster->Services - - - - - - - - - - +
+ + + + + + +
this.openModal('realm') + click: () => this.openModal('realm'), + visible: () => !this.showMigrateAndReplicationActions }, { permission: 'create', icon: Icons.add, name: this.actionLabels.CREATE + ' Zone Group', click: () => this.openModal('zonegroup'), - disable: () => this.getDisable() + disable: () => this.getDisable(), + visible: () => !this.showMigrateAndReplicationActions }, { permission: 'create', icon: Icons.add, name: this.actionLabels.CREATE + ' Zone', - click: () => this.openModal('zone') - } - ]; - this.migrateTableAction = [ - { - permission: 'create', - icon: Icons.wrench, - name: this.actionLabels.MIGRATE, - click: () => this.openMigrateModal() - } - ]; - this.importAction = [ + click: () => this.openModal('zone'), + visible: () => !this.showMigrateAndReplicationActions + }, { permission: 'create', icon: Icons.download, name: this.actionLabels.IMPORT, click: () => this.openImportModal(), disable: () => this.getDisableImport() - } - ]; - this.exportAction = [ + }, { permission: 'create', icon: Icons.upload, @@ -278,6 +267,14 @@ export class RgwMultisiteDetailsComponent implements OnDestroy, OnInit { disable: () => this.getDisableExport() } ]; + this.migrateTableAction = [ + { + permission: 'create', + icon: Icons.wrench, + name: this.actionLabels.MIGRATE, + click: () => this.openMigrateModal() + } + ]; this.multisiteReplicationActions = [ { permission: 'create', diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/datatable.module.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/datatable.module.ts index c29fed2f35004..072c66220f020 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/datatable.module.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/datatable.module.ts @@ -25,6 +25,7 @@ import CheckIcon from '@carbon/icons/es/checkmark/16'; import CloseIcon from '@carbon/icons/es/close/16'; import MaximizeIcon from '@carbon/icons/es/maximize/16'; import ArrowDown from '@carbon/icons/es/caret--down/16'; +import ChevronDwon from '@carbon/icons/es/chevron--down/16'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { FormlyModule } from '@ngx-formly/core'; @@ -136,7 +137,8 @@ export class DataTableModule { CheckIcon, CloseIcon, MaximizeIcon, - ArrowDown + ArrowDown, + ChevronDwon ]); } } diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.html b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.html index 0e3f73a0c3e5f..a4e9f0c22b69a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.html @@ -21,8 +21,7 @@ [cdsOverflowMenu]="overflowMenuTpl" data-testid="table-action-btn"> + [cdsIcon]="icons.chevronDown"> @@ -47,15 +46,14 @@ @@ -76,10 +74,9 @@ - diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.scss b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.scss index 6b0a82d130fcf..65fd93ec0c1b6 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.scss +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.scss @@ -32,3 +32,13 @@ button.dropdown-item:hover { justify-content: center; width: 3rem; } + +// https://github.com/carbon-design-system/carbon-components-angular/blob/v5.56.2/src/dialog/overflow-menu/overflow-menu.component.ts#52 +// Its always applying .cds--btn--icon-only which is making position static and svg color fill to var(--cds-icon-primary, #f8f9fa) +.override-position-static.cds--btn__icon { + position: absolute; +} + +.cds--overflow-menu-options__option { + min-width: fit-content; +} diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.ts index 51120f623f209..3e6ac0f7050d3 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table-actions/table-actions.component.ts @@ -20,8 +20,9 @@ export class TableActionsComponent implements OnChanges, OnInit { @Input() tableActions: CdTableAction[]; @Input() - btnColor = 'accent'; - + dropDownOnlyBtnColor = 'primary'; + @Input() + dropDownOnlyOffset = { x: 105, y: 0 }; // Use this if you just want to display a drop down button, // labeled with the given text, with all actions in it. // This disables the main action button. diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/icons.enum.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/icons.enum.ts index 73d2acd39524c..c6656ff89cabb 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/icons.enum.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/enum/icons.enum.ts @@ -85,6 +85,7 @@ export enum Icons { dataTable = 'data-table', idea = 'idea', userAccessLocked = 'user--access-locked', // User access locked + chevronDown = 'chevron--down', /* Icons for special effect */ size16 = '16', size20 = '20', -- 2.39.5