]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/pybind/mgr/dashboard/frontend/src/app/ceph/block/rbd-snapshot-list/rbd-snapshot-actions.model.ts
update ceph source to reef 18.2.1
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / block / rbd-snapshot-list / rbd-snapshot-actions.model.ts
index 8b40111b8c8cb655586b4ea90c863ada4af02ea0..9b3b7d1d6cdd0d1ce849876c58076c57da9e03f3 100644 (file)
@@ -44,7 +44,9 @@ export class RbdSnapshotActionsModel {
       visible: (selection: CdTableSelection) =>
         selection.hasSingleSelection && !selection.first().is_protected,
       name: actionLabels.PROTECT,
-      disable: (selection: CdTableSelection) => this.disableForMirrorSnapshot(selection)
+      disable: (selection: CdTableSelection) =>
+        this.disableForMirrorSnapshot(selection) ||
+        this.getProtectDisableDesc(selection, this.featuresName)
     };
     this.unprotect = {
       permission: 'update',
@@ -58,8 +60,7 @@ export class RbdSnapshotActionsModel {
       permission: 'create',
       canBePrimary: (selection: CdTableSelection) => selection.hasSingleSelection,
       disable: (selection: CdTableSelection) =>
-        this.getCloneDisableDesc(selection, this.featuresName) ||
-        this.disableForMirrorSnapshot(selection),
+        this.getCloneDisableDesc(selection) || this.disableForMirrorSnapshot(selection),
       icon: Icons.clone,
       name: actionLabels.CLONE
     };
@@ -107,19 +108,23 @@ export class RbdSnapshotActionsModel {
     ];
   }
 
-  getCloneDisableDesc(selection: CdTableSelection, featuresName: string[]): boolean | string {
+  getProtectDisableDesc(selection: CdTableSelection, featuresName: string[]): boolean | string {
     if (selection.hasSingleSelection && !selection.first().cdExecuting) {
       if (!featuresName?.includes('layering')) {
-        return $localize`Parent image must support Layering`;
+        return $localize`The layering feature needs to be enabled on parent image`;
       }
+      return false;
+    }
+    return true;
+  }
 
+  getCloneDisableDesc(selection: CdTableSelection): boolean | string {
+    if (selection.hasSingleSelection && !selection.first().cdExecuting) {
       if (this.cloneFormatVersion === 1 && !selection.first().is_protected) {
         return $localize`Snapshot must be protected in order to clone.`;
       }
-
       return false;
     }
-
     return true;
   }