Skip to content

Commit

Permalink
[ML] DF Analytics creation wizard: Fixing field loading race condition (
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic authored Sep 15, 2020
1 parent af15529 commit 51eab3f
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import {
import { i18n } from '@kbn/i18n';
import { FormattedMessage } from '@kbn/i18n/react';
import { useMlContext } from '../../../contexts/ml';
import { newJobCapsService } from '../../../services/new_job_capabilities_service';
import { ml } from '../../../services/ml_api_service';
import { useCreateAnalyticsForm } from '../analytics_management/hooks/use_create_analytics_form';
import { CreateAnalyticsAdvancedEditor } from './components/create_analytics_advanced_editor';
Expand Down Expand Up @@ -62,8 +61,6 @@ export const Page: FC<Props> = ({ jobId }) => {

if (currentIndexPattern) {
(async function () {
await newJobCapsService.initializeFromIndexPattern(currentIndexPattern, false, false);

if (jobId !== undefined) {
const analyticsConfigs = await ml.dataFrameAnalytics.getDataFrameAnalytics(jobId);
if (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import { useResolver } from '../../use_resolver';
import { basicResolvers } from '../../resolvers';
import { Page } from '../../../data_frame_analytics/pages/analytics_creation';
import { breadcrumbOnClickFactory, getBreadcrumbWithUrlForApp } from '../../breadcrumbs';
import { loadNewJobCapabilities } from '../../../services/new_job_capabilities_service';

export const analyticsJobsCreationRouteFactory = (navigateToPath: NavigateToPath): MlRoute => ({
path: '/data_frame_analytics/new_job',
Expand All @@ -36,7 +37,10 @@ const PageWrapper: FC<PageProps> = ({ location, deps }) => {
sort: false,
});

const { context } = useResolver(index, savedSearchId, deps.config, basicResolvers(deps));
const { context } = useResolver(index, savedSearchId, deps.config, {
...basicResolvers(deps),
jobCaps: () => loadNewJobCapabilities(index, savedSearchId, deps.indexPatterns),
});

return (
<PageLoader context={context}>
Expand Down

0 comments on commit 51eab3f

Please sign in to comment.