]> 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
Import ceph 15.2.8
[ceph.git] / ceph / src / pybind / mgr / dashboard / frontend / src / app / ceph / block / rbd-snapshot-list / rbd-snapshot-actions.model.ts
index 3086a1a5a2acfd72da79b1ea180d737e93b8cfd4..f2ac418ac85a93d1186fa378f92df585ef80fb0c 100644 (file)
@@ -49,11 +49,7 @@ export class RbdSnapshotActionsModel {
     this.clone = {
       permission: 'create',
       canBePrimary: (selection: CdTableSelection) => selection.hasSingleSelection,
-      disable: (selection: CdTableSelection) =>
-        !selection.hasSingleSelection ||
-        selection.first().cdExecuting ||
-        !_.isUndefined(this.getCloneDisableDesc(featuresName)),
-      disableDesc: () => this.getCloneDisableDesc(featuresName),
+      disable: (selection: CdTableSelection) => this.getCloneDisableDesc(selection, featuresName),
       icon: Icons.clone,
       name: actionLabels.CLONE
     };
@@ -92,11 +88,15 @@ export class RbdSnapshotActionsModel {
     ];
   }
 
-  getCloneDisableDesc(featuresName: string[]): string | undefined {
-    if (!featuresName.includes('layering')) {
-      return this.i18n('Parent image must support Layering');
+  getCloneDisableDesc(selection: CdTableSelection, featuresName: string[]): boolean | string {
+    if (selection && selection.hasSingleSelection && !selection.first().cdExecuting) {
+      if (!_.includes(featuresName, 'layering')) {
+        return this.i18n('Parent image must support Layering');
+      }
+
+      return false;
     }
 
-    return undefined;
+    return true;
   }
 }