fix(AlertReports): disabling value when not null option is active (#27550)

(cherry picked from commit ed9e542781)
This commit is contained in:
Jack 2024-03-26 13:13:29 -05:00 committed by Michael S. Molina
parent 32aa25ae17
commit 34b06f94ab
2 changed files with 7 additions and 3 deletions

View File

@ -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

View File

@ -1417,7 +1417,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
@ -1426,7 +1427,7 @@ const AlertReportModal: FunctionComponent<AlertReportModalProps> = ({
disabled={conditionNotNull}
value={
currentAlert?.validator_config_json?.threshold !==
undefined
undefined && !conditionNotNull
? currentAlert.validator_config_json.threshold
: ''
}