Skip to content

Commit 59bc0a0

Browse files
committed
mgr/dashboard: fix generic form submit validator for inline edit
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 <[email protected]>
1 parent fe52553 commit 59bc0a0

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/pybind/mgr/dashboard/frontend/src/app/shared/datatable/table/table.component.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1425,15 +1425,19 @@ export class TableComponent implements AfterViewInit, OnInit, OnChanges, OnDestr
14251425
}
14261426

14271427
saveCellItem(row: any, colProp: string) {
1428-
if (this.formGroup?.invalid) {
1429-
this.formGroup.setErrors({ cdSubmitButton: true });
1428+
const key = `${row[this.identifier]}-${colProp}`;
1429+
const control = this.formGroup.get(key);
1430+
1431+
if (control?.invalid) {
1432+
control.setErrors({ cdSubmitButton: true, ...control.errors });
14301433
return;
14311434
}
1435+
14321436
this.editSubmitAction.emit({
14331437
state: this.editStates[row[this.identifier]],
14341438
row: row
14351439
});
1436-
this.editingCells.delete(`${row[this.identifier]}-${colProp}`);
1440+
this.editingCells.delete(key);
14371441
delete this.editStates[row[this.identifier]][colProp];
14381442
}
14391443

0 commit comments

Comments
 (0)