Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(alerts/reports): implementing custom_width as an Antd number input #27260

Merged
merged 3 commits into from
Mar 15, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions superset-frontend/src/features/alerts/AlertReportModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
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';
Expand Down Expand Up @@ -873,6 +873,10 @@
updateAlertState(name, parsedValue);
};

const onCustomWidthChange = (value: number | null | undefined) => {
updateAlertState('custom_width', value);

Check warning on line 877 in superset-frontend/src/features/alerts/AlertReportModal.tsx

View check run for this annotation

Codecov / codecov/patch

superset-frontend/src/features/alerts/AlertReportModal.tsx#L877

Added line #L877 was not covered by tests
};

const onTimeoutVerifyChange = (
event: React.ChangeEvent<HTMLTextAreaElement | HTMLInputElement>,
) => {
Expand Down Expand Up @@ -1542,12 +1546,14 @@
>
<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>
Expand Down
Loading