]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
mgr/dashboard: disable promote on mirroring not enabled
authorPedro Gonzalez Gomez <pegonzal@redhat.com>
Tue, 30 May 2023 11:49:17 +0000 (13:49 +0200)
committerNizamudeen A <nia@redhat.com>
Wed, 19 Jul 2023 10:32:06 +0000 (16:02 +0530)
Fixes: https://tracker.ceph.com/issues/61507
Signed-off-by: Pedro Gonzalez Gomez <pegonzal@redhat.com>
(cherry picked from commit 999ce877b5fc7da69275d37e7a2b8509effd2c3a)

src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-list/rbd-list.component.ts

index 10230035d29887709f4fffd7e0f7eeec28fb0d93..1c1d79eba0014cd30b64f9d4b74c70c25a3405e8 100644 (file)
@@ -214,14 +214,22 @@ export class RbdListComponent extends ListWithDetails implements OnInit {
       icon: Icons.edit,
       click: () => this.actionPrimary(true),
       name: this.actionLabels.PROMOTE,
-      visible: () => this.selection.first() != null && !this.selection.first().primary
+      visible: () => this.selection.first() != null && !this.selection.first().primary,
+      disable: () =>
+        this.selection.first().mirror_mode === 'Disabled'
+          ? 'Mirroring needs to be enabled on the image to perform this action'
+          : ''
     };
     const demoteAction: CdTableAction = {
       permission: 'update',
       icon: Icons.edit,
       click: () => this.actionPrimary(false),
       name: this.actionLabels.DEMOTE,
-      visible: () => this.selection.first() != null && this.selection.first().primary
+      visible: () => this.selection.first() != null && this.selection.first().primary,
+      disable: () =>
+        this.selection.first().mirror_mode === 'Disabled'
+          ? 'Mirroring needs to be enabled on the image to perform this action'
+          : ''
     };
     this.tableActions = [
       addAction,