This is an automated email from the ASF dual-hosted git repository. enzomartellucci pushed a commit to branch enxdev/refactor/replace-native-html-elements-with-antd5-components in repository https://gitbox.apache.org/repos/asf/superset.git
commit 42350dfe80cc33435165e7d10d1181fed10e2996 Author: Enzo Martellucci <[email protected]> AuthorDate: Thu Apr 10 17:38:36 2025 +0200 refactor(AlertReportModal): replace <input> elements with Antd Input component --- .../src/features/alerts/AlertReportModal.tsx | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx index c81a548262..e093248ba0 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx @@ -39,7 +39,7 @@ import { import rison from 'rison'; import { useSingleViewResource } from 'src/views/CRUD/hooks'; -import { InputNumber } from 'src/components/Input'; +import { Input, InputNumber } from 'src/components/Input'; import { Switch } from 'src/components/Switch'; import Modal from 'src/components/Modal'; import Collapse from 'src/components/Collapse'; @@ -1088,12 +1088,10 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({ updateAlertState('validator_config_json', config); }; - const onThresholdChange = (event: ChangeEvent<HTMLInputElement>) => { - const { target } = event; - + const onThresholdChange = (value: number | null) => { const config = { op: currentAlert ? currentAlert.validator_config_json?.op : undefined, - threshold: target.value, + threshold: value, }; updateAlertState('validator_config_json', config); @@ -1487,15 +1485,14 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({ <span className="required">*</span> </div> <div className="input-container"> - <input - type="text" + <Input name="name" - value={currentAlert ? currentAlert.name : ''} placeholder={ isReport ? t('Enter report name') : t('Enter alert name') } + value={currentAlert ? currentAlert.name : ''} onChange={onInputChange} /> </div> @@ -1526,8 +1523,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({ <StyledInputContainer> <div className="control-label">{t('Description')}</div> <div className="input-container"> - <input - type="text" + <Input name="description" value={currentAlert ? currentAlert.description || '' : ''} placeholder={t( @@ -1642,16 +1638,17 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({ )} </div> <div className="input-container"> - <input + <InputNumber + disabled={conditionNotNull} type="number" name="threshold" - disabled={conditionNotNull} value={ currentAlert?.validator_config_json ?.threshold !== undefined && !conditionNotNull ? currentAlert.validator_config_json.threshold : '' } + min={0} placeholder={t('Value')} onChange={onThresholdChange} />
