From 48eb0a336b7ecedf61d365b9cf5edf76626ed795 Mon Sep 17 00:00:00 2001 From: Ricardo Marques Date: Wed, 17 Oct 2018 14:10:46 +0100 Subject: [PATCH] mgr/dashboard: Fix RBD actions disable Fixes: https://tracker.ceph.com/issues/36403 Signed-off-by: Ricardo Marques --- .../app/ceph/block/rbd-list/rbd-list.component.ts | 5 ++--- .../rbd-snapshot-actions.model.ts | 15 ++++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts index 5db4a6a67e2d..aabb3e767de7 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts @@ -103,7 +103,8 @@ export class RbdListComponent implements OnInit { const copyAction: CdTableAction = { permission: 'create', buttonCondition: (selection: CdTableSelection) => selection.hasSingleSelection, - disable: (selection: CdTableSelection) => !selection.hasSingleSelection, + disable: (selection: CdTableSelection) => + !selection.hasSingleSelection || selection.first().cdExecuting, icon: 'fa-copy', routerLink: () => `/block/rbd/copy/${getImageUri()}`, name: 'Copy' @@ -118,8 +119,6 @@ export class RbdListComponent implements OnInit { }; const moveAction: CdTableAction = { permission: 'delete', - disable: (selection: CdTableSelection) => - !selection.hasSingleSelection || selection.first().cdExecuting, icon: 'fa-trash-o', click: () => this.trashRbdModal(), name: 'Move to Trash' diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts index 7b6907e24be2..0aeb84283770 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts @@ -5,7 +5,6 @@ export class RbdSnapshotActionsModel { create: CdTableAction = { permission: 'create', icon: 'fa-plus', - buttonCondition: (selection: CdTableSelection) => !selection.hasSingleSelection, name: 'Create' }; rename: CdTableAction = { @@ -30,29 +29,31 @@ export class RbdSnapshotActionsModel { clone: CdTableAction = { permission: 'create', buttonCondition: (selection: CdTableSelection) => selection.hasSingleSelection, - disable: (selection: CdTableSelection) => !selection.hasSingleSelection, + disable: (selection: CdTableSelection) => + !selection.hasSingleSelection || selection.first().cdExecuting, icon: 'fa-clone', name: 'Clone' }; copy: CdTableAction = { permission: 'create', buttonCondition: (selection: CdTableSelection) => selection.hasSingleSelection, - disable: (selection: CdTableSelection) => !selection.hasSingleSelection, + disable: (selection: CdTableSelection) => + !selection.hasSingleSelection || selection.first().cdExecuting, icon: 'fa-copy', name: 'Copy' }; rollback: CdTableAction = { permission: 'update', - disable: (selection: CdTableSelection) => - selection.hasSingleSelection && !selection.first().parent, icon: 'fa-undo', name: 'Rollback' }; deleteSnap: CdTableAction = { permission: 'delete', icon: 'fa-times', - disable: (selection: CdTableSelection) => - selection.hasSingleSelection && !selection.first().is_protected, + disable: (selection: CdTableSelection) => { + const first = selection.first(); + return !selection.hasSingleSelection || first.cdExecuting || first.is_protected; + }, name: 'Delete' }; ordering = [ -- 2.47.3