Skip to content

Commit

Permalink
Small fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
betodealmeida committed Jun 29, 2023
1 parent d15b410 commit 6472a95
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 16 deletions.
8 changes: 3 additions & 5 deletions superset-frontend/src/components/ReportModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 || ''}
Expand Down
19 changes: 8 additions & 11 deletions superset-frontend/src/features/alerts/AlertReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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 = (
Expand Down Expand Up @@ -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 || ''}
Expand Down

0 comments on commit 6472a95

Please sign in to comment.