You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2024/03/19 13:09:55 UTC
(superset) 02/06: fix(alerts/reports): implementing custom_width as an Antd number input (#27260)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch 4.0
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 297849a8b507ae03a17a9f0001adf4d1a6b29558
Author: Jack <41...@users.noreply.github.com>
AuthorDate: Fri Mar 15 13:10:00 2024 -0500
fix(alerts/reports): implementing custom_width as an Antd number input (#27260)
(cherry picked from commit ad9024b040c3ccfd59ce531889b631049b67ea97)
---
superset-frontend/src/features/alerts/AlertReportModal.tsx | 14 ++++++++++----
1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx
index bc6908cac2..c297da2d71 100644
--- a/superset-frontend/src/features/alerts/AlertReportModal.tsx
+++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx
@@ -36,7 +36,7 @@ import {
import rison from 'rison';
import { useSingleViewResource } from 'src/views/CRUD/hooks';
-import { Input } from 'src/components/Input';
+import { InputNumber } from 'src/components/Input';
import { Switch } from 'src/components/Switch';
import Modal from 'src/components/Modal';
import Collapse from 'src/components/Collapse';
@@ -873,6 +873,10 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
updateAlertState(name, parsedValue);
};
+ const onCustomWidthChange = (value: number | null | undefined) => {
+ updateAlertState('custom_width', value);
+ };
+
const onTimeoutVerifyChange = (
event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>,
) => {
@@ -1542,12 +1546,14 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
>
<div className="control-label">{t('Screenshot width')}</div>
<div className="input-container">
- <Input
+ <InputNumber
type="number"
name="custom_width"
- value={currentAlert?.custom_width || ''}
+ value={currentAlert?.custom_width || undefined}
+ min={600}
+ max={2400}
placeholder={t('Input custom width in pixels')}
- onChange={onInputChange}
+ onChange={onCustomWidthChange}
/>
</div>
</StyledInputContainer>