You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2023/06/29 19:37:18 UTC
[superset] branch customize_screenshot_width updated: Small fixes
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch customize_screenshot_width
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/customize_screenshot_width by this push:
new 6472a95db3 Small fixes
6472a95db3 is described below
commit 6472a95db323400758333b7a81ed1646fd9e431d
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Thu Jun 29 12:37:05 2023 -0700
Small fixes
---
.../src/components/ReportModal/index.tsx | 8 +++-----
.../src/features/alerts/AlertReportModal.tsx | 19 ++++++++-----------
2 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/superset-frontend/src/components/ReportModal/index.tsx b/superset-frontend/src/components/ReportModal/index.tsx
index c66ea0e6c3..f98cddd66c 100644
--- a/superset-frontend/src/components/ReportModal/index.tsx
+++ b/superset-frontend/src/components/ReportModal/index.tsx
@@ -33,6 +33,7 @@ import LabeledErrorBoundInput from 'src/components/Form/LabeledErrorBoundInput';
import Icons from 'src/components/Icons';
import { CronError } from 'src/components/CronPicker';
import { RadioChangeEvent } from 'src/components';
+import { Input } from 'src/components/Input';
import withToasts from 'src/components/MessageToasts/withToasts';
import { ChartState } from 'src/explore/types';
import {
@@ -265,14 +266,11 @@ function ReportModal({
);
const renderCustomWidthSection = (
<StyledInputContainer>
- <div
- className="control-label"
- css={(theme: SupersetTheme) => CustomWidthHeaderStyle(theme)}
- >
+ <div className="control-label" css={CustomWidthHeaderStyle}>
{TRANSLATIONS.CUSTOM_SCREENSHOT_WIDTH_TEXT}
</div>
<div className="input-container">
- <input
+ <Input
type="number"
name="custom_width"
value={currentReport?.custom_width || ''}
diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx
index f20d98b146..ce46eb69f5 100644
--- a/superset-frontend/src/features/alerts/AlertReportModal.tsx
+++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx
@@ -35,6 +35,7 @@ import rison from 'rison';
import { useSingleViewResource } from 'src/views/CRUD/hooks';
import Icons from 'src/components/Icons';
+import { Input } from 'src/components/Input';
import { Switch } from 'src/components/Switch';
import Modal from 'src/components/Modal';
import TimezoneSelector from 'src/components/TimezoneSelector';
@@ -867,13 +868,12 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
const onInputChange = (
event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>,
) => {
- const { target } = event;
- const value =
- target.type === 'number'
- ? parseInt(target.value, 10) || null
- : target.value;
+ const {
+ target: { type, value, name },
+ } = event;
+ const parsedValue = type === 'number' ? parseInt(value, 10) || null : value;
- updateAlertState(target.name, value);
+ updateAlertState(name, parsedValue);
};
const onTimeoutVerifyChange = (
@@ -1488,14 +1488,11 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
)}
{isScreenshot && (
<StyledInputContainer>
- <div
- className="control-label"
- css={(theme: SupersetTheme) => CustomWidthHeaderStyle(theme)}
- >
+ <div className="control-label" css={CustomWidthHeaderStyle}>
{TRANSLATIONS.CUSTOM_SCREENSHOT_WIDTH_TEXT}
</div>
<div className="input-container">
- <input
+ <Input
type="number"
name="custom_width"
value={currentAlert?.custom_width || ''}