You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by di...@apache.org on 2024/03/26 18:13:35 UTC

(superset) branch master updated: fix(AlertReports): disabling value when not null option is active (#27550)

This is an automated email from the ASF dual-hosted git repository.

diegopucci pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git


The following commit(s) were added to refs/heads/master by this push:
     new ed9e542781 fix(AlertReports): disabling value when not null option is active (#27550)
ed9e542781 is described below

commit ed9e5427817312b1b706e4e8ada3ecd78b9b79d5
Author: Jack <41...@users.noreply.github.com>
AuthorDate: Tue Mar 26 13:13:29 2024 -0500

    fix(AlertReports): disabling value when not null option is active (#27550)
---
 superset-frontend/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 358aa27df3..70d01885c3 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 6de43fae6a..2a9a9f438d 100644
--- a/superset-frontend/src/features/alerts/AlertReportModal.tsx
+++ b/superset-frontend/src/features/alerts/AlertReportModal.tsx
@@ -1410,7 +1410,8 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
               </StyledInputContainer>
               <StyledInputContainer css={noMarginBottom}>
                 <div className="control-label">
-                  {t('Value')} <span className="required">*</span>
+                  {t('Value')}{' '}
+                  {!conditionNotNull && <span className="required">*</span>}
                 </div>
                 <div className="input-container">
                   <input
@@ -1419,7 +1420,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
                     disabled={conditionNotNull}
                     value={
                       currentAlert?.validator_config_json?.threshold !==
-                      undefined
+                        undefined && !conditionNotNull
                         ? currentAlert.validator_config_json.threshold
                         : ''
                     }