@@ -26,6 +26,7 @@ import moment from 'moment';
2626import { Validators } from '@angular/forms' ;
2727import { CdValidators } from '~/app/shared/forms/cd-validators' ;
2828import { ModalCdsService } from '~/app/shared/services/modal-cds.service' ;
29+ import { DEFAULT_SUBVOLUME_GROUP } from '~/app/shared/constants/cephfs' ;
2930
3031@Component ( {
3132 selector : 'cd-cephfs-subvolume-snapshots-list' ,
@@ -57,6 +58,7 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
5758 isLoading = true ;
5859
5960 observables : any = [ ] ;
61+ allGroups : any = [ ] ;
6062
6163 constructor (
6264 private cephfsSubvolumeGroupService : CephfsSubvolumeGroupService ,
@@ -126,8 +128,14 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
126128 . pipe (
127129 switchMap ( ( groups ) => {
128130 // manually adding the group '_nogroup' to the list.
129- groups . unshift ( { name : '' } ) ;
130131
132+ groups . unshift ( { name : '' } ) ;
133+ this . allGroups = Array . from ( groups ) . map ( ( group ) => {
134+ return {
135+ value : group . name ,
136+ text : group . name === '' ? DEFAULT_SUBVOLUME_GROUP : group . name
137+ } ;
138+ } ) ;
131139 const observables = groups . map ( ( group ) =>
132140 this . cephfsSubvolumeService . existsInFs ( this . fsName , group . name ) . pipe (
133141 switchMap ( ( resp ) => {
@@ -248,9 +256,6 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
248256
249257 cloneModal ( ) {
250258 const cloneName = `clone_${ moment ( ) . toISOString ( true ) } ` ;
251- const allGroups = Array . from ( this . subvolumeGroupList ) . map ( ( group ) => {
252- return { value : group , text : group === '' ? '_nogroup' : group } ;
253- } ) ;
254259 this . modalService . show ( FormModalComponent , {
255260 titleText : $localize `Create clone` ,
256261 fields : [
@@ -284,7 +289,7 @@ export class CephfsSubvolumeSnapshotsListComponent implements OnInit, OnChanges
284289 valueChangeListener : true ,
285290 dependsOn : 'cloneName' ,
286291 typeConfig : {
287- options : allGroups
292+ options : this . allGroups
288293 }
289294 }
290295 ] ,
0 commit comments