mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
[8.x] [ML][Rules] Fixes deletion in Check interval input for anomaly detection rule (#193420) (#193731)
# Backport This will backport the following commits from `main` to `8.x`: - [[ML][Rules] Fixes deletion in Check interval input for anomaly detection rule (#193420)](https://github.com/elastic/kibana/pull/193420) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Robert Jaszczurek","email":"92210485+rbrtj@users.noreply.github.com"},"sourceCommit":{"committedDate":"2024-09-23T14:27:01Z","message":"[ML][Rules] Fixes deletion in Check interval input for anomaly detection rule (#193420)\n\n## Summary\r\n\r\nIt was trying to parse `null` values.\r\nAfter:\r\n\r\n\r\n\r\nFixes [#190732](https://github.com/elastic/kibana/issues/190732)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"65b7bf9586480b522393905ff21324f473ee90ed","branchLabelMapping":{"^v9.0.0$":"main","^v8.16.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix",":ml","v9.0.0","Team:ML","backport:prev-major"],"title":"[ML][Rules] Fixes deletion in Check interval input for anomaly detection rule","number":193420,"url":"https://github.com/elastic/kibana/pull/193420","mergeCommit":{"message":"[ML][Rules] Fixes deletion in Check interval input for anomaly detection rule (#193420)\n\n## Summary\r\n\r\nIt was trying to parse `null` values.\r\nAfter:\r\n\r\n\r\n\r\nFixes [#190732](https://github.com/elastic/kibana/issues/190732)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"65b7bf9586480b522393905ff21324f473ee90ed"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/193420","number":193420,"mergeCommit":{"message":"[ML][Rules] Fixes deletion in Check interval input for anomaly detection rule (#193420)\n\n## Summary\r\n\r\nIt was trying to parse `null` values.\r\nAfter:\r\n\r\n\r\n\r\nFixes [#190732](https://github.com/elastic/kibana/issues/190732)\r\n\r\n---------\r\n\r\nCo-authored-by: kibanamachine <42973632+kibanamachine@users.noreply.github.com>","sha":"65b7bf9586480b522393905ff21324f473ee90ed"}}]}] BACKPORT--> Co-authored-by: Robert Jaszczurek <92210485+rbrtj@users.noreply.github.com>
This commit is contained in:
parent
1143a10f14
commit
49051eae6d
1 changed files with 5 additions and 2 deletions
|
@ -32,13 +32,15 @@ export const ConfigValidator: FC<ConfigValidatorProps> = React.memo(
|
|||
({ jobConfigs = [], alertInterval, alertParams, alertNotifyWhen, maxNumberOfBuckets }) => {
|
||||
if (jobConfigs.length === 0) return null;
|
||||
|
||||
const alertIntervalInSeconds = parseInterval(alertInterval)!.asSeconds();
|
||||
const alertIntervalInSeconds = parseInterval(alertInterval)?.asSeconds();
|
||||
|
||||
const lookbackIntervalInSeconds =
|
||||
!!alertParams.lookbackInterval && parseInterval(alertParams.lookbackInterval)?.asSeconds();
|
||||
|
||||
const isAlertIntervalTooHigh =
|
||||
lookbackIntervalInSeconds && lookbackIntervalInSeconds < alertIntervalInSeconds;
|
||||
lookbackIntervalInSeconds &&
|
||||
alertIntervalInSeconds &&
|
||||
lookbackIntervalInSeconds < alertIntervalInSeconds;
|
||||
|
||||
const jobWithoutStartedDatafeed = jobConfigs
|
||||
.filter((job) => job.datafeed_config.state !== DATAFEED_STATE.STARTED)
|
||||
|
@ -49,6 +51,7 @@ export const ConfigValidator: FC<ConfigValidatorProps> = React.memo(
|
|||
const notifyWhenWarning =
|
||||
alertNotifyWhen === 'onActiveAlert' &&
|
||||
lookbackIntervalInSeconds &&
|
||||
alertIntervalInSeconds &&
|
||||
alertIntervalInSeconds < lookbackIntervalInSeconds;
|
||||
|
||||
const bucketSpanDuration = parseInterval(jobConfigs[0].analysis_config.bucket_span!);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue