Skip to content

Commit 1f8add4

Browse files
committed
ui: fix diagnostics expires after input validation
currently the field for expires_after does not allow full deletion of the inputted number, leading to a poor experience this is changed by allowing full deletions, while maintaining sanitation for integrity of integer outputs Epic: None Release note: None
1 parent 755c186 commit 1f8add4

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

pkg/ui/workspaces/cluster-ui/src/statementsDiagnostics/activateStatementDiagnosticsModal.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,8 +293,11 @@ export const ActivateStatementDiagnosticsModal = React.forwardRef<
293293
disabled={!expires}
294294
value={expiresAfter}
295295
onChange={(e: React.ChangeEvent<HTMLInputElement>) => {
296-
if (parseInt(e.target.value) > 0) {
297-
setExpiresAfter(parseInt(e.target.value));
296+
const expires = parseInt(e.target.value);
297+
if (!isNaN(expires) && expires > -1) {
298+
setExpiresAfter(expires);
299+
} else {
300+
setExpiresAfter(0);
298301
}
299302
}}
300303
rootClassName={cx("compact")}

0 commit comments

Comments
 (0)