-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] Anomaly Detection: Adds never expire option to forecast creation modal #195151
Changes from 1 commit
894a9c4
49a0761
d1760c6
c25cdee
f4c9ed0
c79c616
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -20,6 +20,7 @@ import { | |||||||||
EuiForm, | ||||||||||
EuiFormRow, | ||||||||||
EuiSpacer, | ||||||||||
EuiSwitch, | ||||||||||
EuiText, | ||||||||||
EuiToolTip, | ||||||||||
} from '@elastic/eui'; | ||||||||||
|
@@ -82,6 +83,8 @@ export function RunControls({ | |||||||||
newForecastDuration, | ||||||||||
isNewForecastDurationValid, | ||||||||||
newForecastDurationErrors, | ||||||||||
neverExpires, | ||||||||||
onNeverExpiresChange, | ||||||||||
onNewForecastDurationChange, | ||||||||||
runForecast, | ||||||||||
isForecastRequested, | ||||||||||
|
@@ -134,34 +137,60 @@ export function RunControls({ | |||||||||
<EuiSpacer size="s" /> | ||||||||||
<EuiForm> | ||||||||||
<EuiFlexGroup> | ||||||||||
<EuiFlexItem> | ||||||||||
<EuiFormRow | ||||||||||
label={ | ||||||||||
<FormattedMessage | ||||||||||
id="xpack.ml.timeSeriesExplorer.runControls.durationLabel" | ||||||||||
defaultMessage="Duration" | ||||||||||
/> | ||||||||||
} | ||||||||||
fullWidth | ||||||||||
isInvalid={!isNewForecastDurationValid} | ||||||||||
error={newForecastDurationErrors} | ||||||||||
helpText={ | ||||||||||
<FormattedMessage | ||||||||||
id="xpack.ml.timeSeriesExplorer.runControls.forecastMaximumLengthHelpText" | ||||||||||
defaultMessage="Length of forecast, up to a maximum of {maximumForecastDurationDays} days. | ||||||||||
<EuiFlexItem grow={false}> | ||||||||||
<EuiFlexGroup direction="column"> | ||||||||||
<EuiFlexItem grow={false}> | ||||||||||
<EuiFormRow | ||||||||||
label={ | ||||||||||
<FormattedMessage | ||||||||||
id="xpack.ml.timeSeriesExplorer.runControls.durationLabel" | ||||||||||
defaultMessage="Duration" | ||||||||||
/> | ||||||||||
} | ||||||||||
fullWidth | ||||||||||
isInvalid={!isNewForecastDurationValid} | ||||||||||
error={newForecastDurationErrors} | ||||||||||
helpText={ | ||||||||||
<FormattedMessage | ||||||||||
id="xpack.ml.timeSeriesExplorer.runControls.forecastMaximumLengthHelpText" | ||||||||||
defaultMessage="Length of forecast, up to a maximum of {maximumForecastDurationDays} days. | ||||||||||
Use s for seconds, m for minutes, h for hours, d for days, w for weeks." | ||||||||||
values={{ maximumForecastDurationDays: FORECAST_DURATION_MAX_DAYS }} | ||||||||||
/> | ||||||||||
} | ||||||||||
> | ||||||||||
{disabledState.isDisabledToolTipText === undefined ? ( | ||||||||||
durationInput | ||||||||||
) : ( | ||||||||||
<EuiToolTip position="right" content={disabledState.isDisabledToolTipText}> | ||||||||||
{durationInput} | ||||||||||
</EuiToolTip> | ||||||||||
)} | ||||||||||
</EuiFormRow> | ||||||||||
values={{ maximumForecastDurationDays: FORECAST_DURATION_MAX_DAYS }} | ||||||||||
/> | ||||||||||
} | ||||||||||
> | ||||||||||
{disabledState.isDisabledToolTipText === undefined ? ( | ||||||||||
durationInput | ||||||||||
) : ( | ||||||||||
<EuiToolTip position="right" content={disabledState.isDisabledToolTipText}> | ||||||||||
{durationInput} | ||||||||||
</EuiToolTip> | ||||||||||
)} | ||||||||||
</EuiFormRow> | ||||||||||
</EuiFlexItem> | ||||||||||
<EuiFlexItem grow={false}> | ||||||||||
<EuiFormRow | ||||||||||
helpText={i18n.translate( | ||||||||||
'xpack.ml.timeSeriesExplorer.runControls.neverExpireHelpText', | ||||||||||
{ | ||||||||||
defaultMessage: | ||||||||||
'When not selected, created forecasts will expire after 14 days.', | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure if
Suggested change
OR
Suggested change
|
||||||||||
} | ||||||||||
)} | ||||||||||
> | ||||||||||
<EuiSwitch | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You'll need to disable this switch if the user doesn't have permission to run forecasts? Or I wonder if just hide the entire 'Run a new forecast section'? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The switch is disabled if the 'Run' is disabled. That is existing behavior. If we want to hide it completely that would require an additional change in the parent component. 🤔 I'm not sure we should change it since it has been available to be viewed until now. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. All good. Just wanted to make sure that the 'Never expire' switch was enabled as well as the 'Run' button. |
||||||||||
label={i18n.translate( | ||||||||||
'xpack.ml.timeSeriesExplorer.runControls.neverExpireLabel', | ||||||||||
{ | ||||||||||
defaultMessage: 'Never expire', | ||||||||||
} | ||||||||||
)} | ||||||||||
checked={neverExpires} | ||||||||||
onChange={onNeverExpiresChange} | ||||||||||
/> | ||||||||||
</EuiFormRow> | ||||||||||
</EuiFlexItem> | ||||||||||
</EuiFlexGroup> | ||||||||||
</EuiFlexItem> | ||||||||||
<EuiFlexItem grow={false}> | ||||||||||
<EuiFormRow hasEmptyLabelSpace> | ||||||||||
|
@@ -193,7 +222,9 @@ RunControls.propType = { | |||||||||
newForecastDuration: PropTypes.string, | ||||||||||
isNewForecastDurationValid: PropTypes.bool, | ||||||||||
newForecastDurationErrors: PropTypes.array, | ||||||||||
neverExpires: PropTypes.bool.isRequired, | ||||||||||
onNewForecastDurationChange: PropTypes.func.isRequired, | ||||||||||
onNeverExpiresChange: PropTypes.func.isRequired, | ||||||||||
runForecast: PropTypes.func.isRequired, | ||||||||||
isForecastRequested: PropTypes.bool, | ||||||||||
forecastProgress: PropTypes.number, | ||||||||||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or
When not selected, forecast results will be deleted after 14 days.
@szabosteve is there anything we can do here to switch the logic around to say what will happen if the switch is selected?