]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: Cloning subvolume not listing _nogroup subvolumegroup if there are... 59951/head
authorDnyaneshwari <dnyaneshwari@li-9c9fbecc-2d5c-11b2-a85c-e2a7cc8a424f.ibm.com>
Wed, 4 Sep 2024 10:48:08 +0000 (16:18 +0530)
committerDnyaneshwari <dnyaneshwari@li-9c9fbecc-2d5c-11b2-a85c-e2a7cc8a424f.ibm.com>
Tue, 24 Sep 2024 07:33:09 +0000 (13:03 +0530)
Fixes: https://tracker.ceph.com/issues/67891
Signed-off-by: Dnyaneshwari talwekar <dtalweka@redhat.com>
(cherry picked from commit 5c6c4a07d8dcd7bde46057310fbd1c5580a0da2f)

src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-subvolume-snapshots-list/cephfs-subvolume-snapshots-list.component.ts
src/pybind/mgr/dashboard/frontend/src/app/shared/constants/cephfs.ts [new file with mode: 0644]

index 05c93faf1617831466bbee17cb9bc0bbec2ebe38..d0bf2aaa18a832c1ea6e937e9cd216acacb7d1c0 100644 (file)
@@ -26,6 +26,7 @@ import { NotificationType } from '~/app/shared/enum/notification-type.enum';
 import moment from 'moment';
 import { Validators } from '@angular/forms';
 import { CdValidators } from '~/app/shared/forms/cd-validators';
+import { DEFAULT_SUBVOLUME_GROUP } from '~/app/shared/constants/cephfs';
 
 @Component({
   selector: 'cd-cephfs-subvolume-snapshots-list',
@@ -57,6 +58,7 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
   isLoading = true;
 
   observables: any = [];
+  allGroups: any = [];
 
   constructor(
     private cephfsSubvolumeGroupService: CephfsSubvolumeGroupService,
@@ -126,8 +128,14 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
       .pipe(
         switchMap((groups) => {
           // manually adding the group '_nogroup' to the list.
-          groups.unshift({ name: '' });
 
+          groups.unshift({ name: '' });
+          this.allGroups = Array.from(groups).map((group) => {
+            return {
+              value: group.name,
+              text: group.name === '' ? DEFAULT_SUBVOLUME_GROUP : group.name
+            };
+          });
           const observables = groups.map((group) =>
             this.cephfsSubvolumeService.existsInFs(this.fsName, group.name).pipe(
               switchMap((resp) => {
@@ -252,9 +260,6 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
 
   cloneModal() {
     const cloneName = `clone_${moment().toISOString(true)}`;
-    const allGroups = Array.from(this.subvolumeGroupList).map((group) => {
-      return { value: group, text: group === '' ? '_nogroup' : group };
-    });
     this.modalService.show(FormModalComponent, {
       titleText: $localize`Create clone`,
       fields: [
@@ -288,7 +293,7 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
           valueChangeListener: true,
           dependsOn: 'cloneName',
           typeConfig: {
-            options: allGroups
+            options: this.allGroups
           }
         }
       ],
diff --git a/src/pybind/mgr/dashboard/frontend/src/app/shared/constants/cephfs.ts b/src/pybind/mgr/dashboard/frontend/src/app/shared/constants/cephfs.ts
new file mode 100644 (file)
index 0000000..56890ff
--- /dev/null
@@ -0,0 +1 @@
+export const DEFAULT_SUBVOLUME_GROUP = '_nogroup';