]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
mgr/dashboard: fix generic form submit validator for inline edit 65973/head
authorNizamudeen A <nia@redhat.com>
Thu, 16 Oct 2025 05:35:32 +0000 (11:05 +0530)
committerNizamudeen A <nia@redhat.com>
Thu, 16 Oct 2025 05:35:32 +0000 (11:05 +0530)
currently the validation error is being applied generically to the
parent formgroup which will set the whole form into an error state when
one of the inline editing is failing on a validation. So just changing
that to a single control.

Fixes: https://tracker.ceph.com/issues/73558
Signed-off-by: Nizamudeen A <nia@redhat.com>
src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts

index 86c105ec64b729f675c353083f0c220b8dfa3e1b..dd811aad36ee094dbd5f531b8646fb7101526101 100644 (file)
@@ -1425,15 +1425,19 @@ export class TableComponent implements AfterViewInit, OnInit, OnChanges, OnDestr
   }
 
   saveCellItem(row: any, colProp: string) {
-    if (this.formGroup?.invalid) {
-      this.formGroup.setErrors({ cdSubmitButton: true });
+    const key = `${row[this.identifier]}-${colProp}`;
+    const control = this.formGroup.get(key);
+
+    if (control?.invalid) {
+      control.setErrors({ cdSubmitButton: true, ...control.errors });
       return;
     }
+
     this.editSubmitAction.emit({
       state: this.editStates[row[this.identifier]],
       row: row
     });
-    this.editingCells.delete(`${row[this.identifier]}-${colProp}`);
+    this.editingCells.delete(key);
     delete this.editStates[row[this.identifier]][colProp];
   }