From: Abhishek Desai Date: Tue, 28 Apr 2026 07:15:16 +0000 (+0530) Subject: mgr/dashboard : Fixes EC profile used pool empty X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=f1ec487c242a7cf7523474c3c8c9df1f216ca41c;p=ceph.git mgr/dashboard : Fixes EC profile used pool empty fixes : https://tracker.ceph.com/issues/76288 Signed-off-by: Abhishek Desai (cherry picked from commit 19b60ccb4e5ef574a7570d1ca9a03ecad9a04fba) --- diff --git a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html index 9652cf145a08..fd0dbe171a74 100644 --- a/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html +++ b/src/pybind/mgr/dashboard/frontend/src/app/ceph/pool/pool-form/pool-form.component.html @@ -383,7 +383,6 @@ > { - // The ec profile can only be changed if type 'erasure' is set. - if (!profile) { - return; - } - this.data.erasureInfo = false; - this.erasureProfileChange(); - this.ecpIsUsedBy(profile); - this.pgCalc(); - }); + this.form + .get('erasureProfile') + .valueChanges.pipe(startWith(this.form.getValue('erasureProfile'))) + .subscribe((profile) => { + // The ec profile can only be changed if type 'erasure' is set. + this.erasureProfileChange(profile); + this.pgCalc(); + }); this.form.get('mode').valueChanges.subscribe(() => { ['minBlobSize', 'maxBlobSize', 'ratio'].forEach((name) => { this.form.get(name).updateValueAndValidity({ emitEvent: false }); @@ -1021,16 +1020,27 @@ export class PoolFormComponent extends CdForm implements OnInit { this.form.get('name').updateValueAndValidity({ emitEvent: false, onlySelf: true }); } - erasureProfileChange() { + erasureProfileChange(selectedName?: string) { if (!this.ecProfiles || this.ecProfiles.length === 0) { return; } - const selectedName = this.form.get('erasureProfile').value; - this.selectedEcp = this.ecProfiles.find((ecp: ErasureCodeProfile) => ecp.name === selectedName); - if (this.selectedEcp) { + const formSelectedName = this.form.get('erasureProfile')?.value; + const resolvedName = selectedName ?? formSelectedName ?? this.ecProfiles[0]?.name; + const selectedEcp = this.ecProfiles.find( + (ecp: ErasureCodeProfile) => ecp.name === resolvedName + ); + this.ecpIsUsedBy(resolvedName); + if (resolvedName) { + this.data.erasureInfo = false; + } + if (selectedEcp) { + this.selectedEcp = selectedEcp; this.msrCrush = - this.selectedEcp['crush-num-failure-domains'] > 0 || - this.selectedEcp['crush-osds-per-failure-domain'] > 0; + (selectedEcp['crush-num-failure-domains'] ?? 0) > 0 || + (selectedEcp['crush-osds-per-failure-domain'] ?? 0) > 0; + } else { + this.selectedEcp = undefined as any; + this.msrCrush = false; } } }