mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 09:48:58 -04:00
## Summary This PR fixes a bug where the `initialValue` of the `jobSummaryData` hook would not differ after querying for jobs which would result in the embedded SIEM Jobs not being installed. See: https://github.com/elastic/ingest-dev/issues/600 ### Checklist Use ~~strikethroughs~~ to remove checklist items you don't feel are applicable to this PR. - [x] This was checked for cross-browser compatibility, [including a check against IE11](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) - [ ] ~Any text added follows [EUI's writing guidelines](https://elastic.github.io/eui/#/guidelines/writing), uses sentence case text and includes [i18n support](https://github.com/elastic/kibana/blob/master/packages/kbn-i18n/README.md)~ - [ ] ~[Documentation](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#writing-documentation) was added for features that require explanation or tutorials~ - [ ] ~[Unit or functional tests](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#cross-browser-compatibility) were updated or added to match the most common scenarios~ - [ ] ~This was checked for [keyboard-only and screenreader accessibility](https://developer.mozilla.org/en-US/docs/Learn/Tools_and_testing/Cross_browser_testing/Accessibility#Accessibility_testing_checklist)~ ### For maintainers - [ ] ~This was checked for breaking API changes and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~ - [ ] ~This includes a feature addition or change that requires a release note and was [labeled appropriately](https://github.com/elastic/kibana/blob/master/CONTRIBUTING.md#release-notes-process)~
This commit is contained in:
parent
26cd792924
commit
c089139f55
3 changed files with 7 additions and 6 deletions
|
@ -35,7 +35,8 @@ export const getConfigTemplatesToInstall = (
|
|||
*
|
||||
* @param jobs to filter
|
||||
* @param embeddedJobIds jobIds as defined in the ConfigTemplates provided by the ML Team
|
||||
* @param showCustomJobs whether or not to show all Custom Jobs, or just the embedded Elastic Jobs
|
||||
* @param showCustomJobs whether or not to show all Custom Jobs (Non-embedded Jobs in SIEM Group)
|
||||
* @param showElasticJobs whether or not to show Elastic Jobs (Embedded ConfigTemplate Jobs)
|
||||
* @param filterQuery user-provided search string to filter for occurrence in job names/description
|
||||
*/
|
||||
export const getJobsToDisplay = (
|
||||
|
|
|
@ -11,7 +11,7 @@ import { KibanaConfigContext } from '../../../lib/adapters/framework/kibana_fram
|
|||
import { hasMlUserPermissions } from '../../ml/permissions/has_ml_user_permissions';
|
||||
import { MlCapabilitiesContext } from '../../ml/permissions/ml_capabilities_provider';
|
||||
|
||||
type Return = [boolean, Job[]];
|
||||
type Return = [boolean, Job[] | null];
|
||||
|
||||
export const getSiemJobsFromJobsSummary = (data: Job[]) =>
|
||||
data.reduce((jobs: Job[], job: Job) => {
|
||||
|
@ -19,7 +19,7 @@ export const getSiemJobsFromJobsSummary = (data: Job[]) =>
|
|||
}, []);
|
||||
|
||||
export const useJobSummaryData = (jobIds: string[] = [], refreshToggle = false): Return => {
|
||||
const [jobSummaryData, setJobSummaryData] = useState<Job[]>([]);
|
||||
const [jobSummaryData, setJobSummaryData] = useState<Job[] | null>(null);
|
||||
const [loading, setLoading] = useState(true);
|
||||
const config = useContext(KibanaConfigContext);
|
||||
const capabilities = useContext(MlCapabilitiesContext);
|
||||
|
|
|
@ -116,8 +116,8 @@ export const MlPopover = React.memo(() => {
|
|||
const embeddedJobIds = getJobsToInstall(configTemplates);
|
||||
|
||||
// Jobs currently installed retrieved via ml jobs_summary api for 'siem' group
|
||||
const siemJobs = jobSummaryData.map(job => job.id);
|
||||
const installedJobIds = embeddedJobIds.filter(job => siemJobs.includes(job));
|
||||
const siemGroupJobIds = jobSummaryData != null ? jobSummaryData.map(job => job.id) : [];
|
||||
const installedJobIds = embeddedJobIds.filter(job => siemGroupJobIds.includes(job));
|
||||
|
||||
// Config templates that still need to be installed and have a defaultIndexPattern that is configured
|
||||
const configTemplatesToInstall = getConfigTemplatesToInstall(
|
||||
|
@ -138,7 +138,7 @@ export const MlPopover = React.memo(() => {
|
|||
// Install Config Templates as effect of opening popover
|
||||
useEffect(() => {
|
||||
if (
|
||||
jobSummaryData.length &&
|
||||
jobSummaryData != null &&
|
||||
configuredIndexPattern !== '' &&
|
||||
configTemplatesToInstall.length > 0
|
||||
) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue