From 6210930260fcd189c164f8ac75d7c94001d43070 Mon Sep 17 00:00:00 2001 From: Dnyaneshwari Date: Wed, 4 Sep 2024 16:18:08 +0530 Subject: [PATCH] mgr/dashboard: Cloning subvolume not listing _nogroup subvolumegroup if there are no subvols in _nogroup Fixes: https://tracker.ceph.com/issues/67891 Signed-off-by: Dnyaneshwari talwekar (cherry picked from commit 5c6c4a07d8dcd7bde46057310fbd1c5580a0da2f) --- .../cephfs-subvolume-snapshots-list.component.ts | 15 ++++++++++----- .../frontend/src/app/shared/constants/cephfs.ts | 1 + 2 files changed, 11 insertions(+), 5 deletions(-) create mode 100644 src/pybind/mgr/dashboard/frontend/src/app/shared/constants/cephfs.ts diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-subvolume-snapshots-list/cephfs-subvolume-snapshots-list.component.ts b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-subvolume-snapshots-list/cephfs-subvolume-snapshots-list.component.ts index 05c93faf161..d0bf2aaa18a 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-subvolume-snapshots-list/cephfs-subvolume-snapshots-list.component.ts +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/cephfs/cephfs-subvolume-snapshots-list/cephfs-subvolume-snapshots-list.component.ts @@ -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 index 00000000000..56890ff7214 --- /dev/null +++ b/src/pybind/mgr/dashboard/frontend/src/app/shared/constants/cephfs.ts @@ -0,0 +1 @@ +export const DEFAULT_SUBVOLUME_GROUP = '_nogroup'; -- 2.39.5