</div>
<div class="form-item"
- *ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name && !this.isEdit">
+ *ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name">
<cds-select formControlName="subvolume_group"
name="subvolume_group"
for="subvolume_group"
</div>
<div class="form-group row"
- *ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name && !this.isEdit">
+ *ngIf="storageBackend === 'CEPH' && nfsForm.getValue('fsal').fs_name">
<cds-select formControlName="subvolume"
name="subvolume"
for="subvolume"
async getSubVol() {
const fs_name = this.nfsForm.getValue('fsal').fs_name;
const subvolgrp = this.nfsForm.getValue('subvolume_group');
+
await this.setSubVolGrpPath();
(subvolgrp === this.defaultSubVolGroup
const subVolumeControl = this.nfsForm.get('subvolume');
// SubVolume is required if SubVolume Group is "_nogroup".
- if (subvolumeGroup == this.defaultSubVolGroup) {
+ if (subvolumeGroup === DEFAULT_SUBVOLUME_GROUP) {
subVolumeControl?.setValidators([Validators.required]);
} else {
subVolumeControl?.clearValidators();
this.nfsForm.patchValue(res);
this.setPathValidation();
this.clients = res.clients;
+
+ if (this.isEdit) {
+ if (res?.fsal?.name === SUPPORTED_FSAL.CEPH && res?.path) {
+ this.getSubVolGrp(res.fsal.fs_name);
+ this.resolveCephfsPath(res.path, res.fsal.fs_name);
+ }
+ }
+ }
+
+ // Setting up Subvolumegroup and Subvolume for CephFS paths on Edit.
+ resolveCephfsPath(path: string, fsName: string) {
+ if (!path?.startsWith('/volumes/')) return;
+
+ const splitPath = path.split('/');
+ const subvolumeGroup = splitPath[2] ?? null;
+ const subvolume = splitPath[3] ?? null;
+
+ this.nfsForm.patchValue({
+ fsal: {
+ ...this.nfsForm.get('fsal').value,
+ fs_name: fsName
+ },
+ subvolumeGroup,
+ subvolume
+ });
}
resolveClusters(clusters: string[]) {