From ed9e5427817312b1b706e4e8ada3ecd78b9b79d5 Mon Sep 17 00:00:00 2001 From: Jack <41238731+fisjac@users.noreply.github.com> Date: Tue, 26 Mar 2024 13:13:29 -0500 Subject: [PATCH] fix(AlertReports): disabling value when not null option is active (#27550) --- .../src/features/alerts/AlertReportModal.test.tsx | 5 ++++- superset-frontend/src/features/alerts/AlertReportModal.tsx | 5 +++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx index 358aa27df..70d01885c 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.test.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.test.tsx @@ -371,12 +371,15 @@ test('disables condition threshold if not null condition is selected', async () userEvent.click(screen.getByTestId('alert-condition-panel')); await screen.findByText(/smaller than/i); const condition = screen.getByRole('combobox', { name: /condition/i }); + const spinButton = screen.getByRole('spinbutton'); + expect(spinButton).toHaveValue(10); await comboboxSelect( condition, 'not null', () => screen.getAllByText(/not null/i)[0], ); - expect(screen.getByRole('spinbutton')).toBeDisabled(); + expect(spinButton).toHaveValue(null); + expect(spinButton).toBeDisabled(); }); // Content Section diff --git a/superset-frontend/src/features/alerts/AlertReportModal.tsx b/superset-frontend/src/features/alerts/AlertReportModal.tsx index 6de43fae6..2a9a9f438 100644 --- a/superset-frontend/src/features/alerts/AlertReportModal.tsx +++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx @@ -1410,7 +1410,8 @@ const AlertReportModal: FunctionComponent = ({
- {t('Value')} * + {t('Value')}{' '} + {!conditionNotNull && *}
= ({ disabled={conditionNotNull} value={ currentAlert?.validator_config_json?.threshold !== - undefined + undefined && !conditionNotNull ? currentAlert.validator_config_json.threshold : '' }