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

This commit is contained in:
Jack 2024-03-26 13:13:29 -05:00 committed by GitHub
parent fa3fea9dd8
commit ed9e542781
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
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

@ -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
: ''
}