[Security Solution] ML rule preview results button is disabled when ML job is running (#137878) (#138078)

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
(cherry picked from commit 6e1cac8dad)

Co-authored-by: Ievgen Sorokopud <ievgen.sorokopud@elastic.co>
This commit is contained in:
Kibana Machine 2022-08-04 05:35:13 -04:00 committed by GitHub
parent e9a2150547
commit 73cd3a4fc5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -140,9 +140,10 @@ const RulePreviewComponent: React.FC<RulePreviewProps> = ({
return true; // Don't do the expensive logic if we don't need it
}
if (isMlLoading) {
const selectedJobs = jobs.filter(({ id }) => machineLearningJobId.includes(id));
return selectedJobs.every((job) => isJobStarted(job.jobState, job.datafeedState));
return false;
}
const selectedJobs = jobs.filter(({ id }) => machineLearningJobId.includes(id));
return selectedJobs.every((job) => isJobStarted(job.jobState, job.datafeedState));
}, [jobs, machineLearningJobId, ruleType, isMlLoading]);
const [queryPreviewIdSelected, setQueryPreviewRadioIdSelected] = useState(QUICK_QUERY_SELECT_ID);