Skip to content

Commit 8c1f97a

Browse files
authored
Merge pull request ceph#65973 from rhcs-dashboard/inline-edit-validator-fix
mgr/dashboard: fix generic form submit validator for inline edit Reviewed-by: Naman Munet <[email protected]>
2 parents 1954d18 + 59bc0a0 commit 8c1f97a

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)