Skip to content

Commit

Permalink
[ML] Fixing index data visualizer not available when no ML nodes avai…
Browse files Browse the repository at this point in the history
…lable (elastic#115972)

Co-authored-by: Kibana Machine <[email protected]>
  • Loading branch information
jgowdyelastic and kibanamachine authored Oct 25, 2021
1 parent 80bb1ad commit 4cc94c5
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,7 @@ import { IndexDataVisualizerPage as Page } from '../../../datavisualizer/index_b
import { checkBasicLicense } from '../../../license';
import { checkGetJobsCapabilitiesResolver } from '../../../capabilities/check_capabilities';
import { loadIndexPatterns } from '../../../util/index_utils';
import { checkMlNodesAvailable } from '../../../ml_nodes_check';
import { getBreadcrumbWithUrlForApp } from '../../breadcrumbs';
import { ML_PAGES } from '../../../../../common/constants/locator';
import { useCreateAndNavigateToMlLink } from '../../../contexts/kibana/use_create_url';

export const indexBasedRouteFactory = (
navigateToPath: NavigateToPath,
Expand All @@ -44,16 +41,12 @@ export const indexBasedRouteFactory = (

const PageWrapper: FC<PageProps> = ({ location, deps }) => {
const { redirectToMlAccessDeniedPage } = deps;
const redirectToJobsManagementPage = useCreateAndNavigateToMlLink(
ML_PAGES.ANOMALY_DETECTION_JOBS_MANAGE
);

const { index, savedSearchId }: Record<string, any> = parse(location.search, { sort: false });
const { context } = useResolver(index, savedSearchId, deps.config, {
checkBasicLicense,
loadIndexPatterns: () => loadIndexPatterns(deps.indexPatterns),
checkGetJobsCapabilities: () => checkGetJobsCapabilitiesResolver(redirectToMlAccessDeniedPage),
checkMlNodesAvailable: () => checkMlNodesAvailable(redirectToJobsManagementPage),
});

return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,6 @@ import { getBreadcrumbWithUrlForApp } from '../../breadcrumbs';
import { checkBasicLicense } from '../../../license';
import { loadIndexPatterns } from '../../../util/index_utils';
import { checkGetJobsCapabilitiesResolver } from '../../../capabilities/check_capabilities';
import { checkMlNodesAvailable } from '../../../ml_nodes_check';
import { ML_PAGES } from '../../../../../common/constants/locator';
import { useCreateAndNavigateToMlLink } from '../../../contexts/kibana/use_create_url';

enum MODE {
NEW_JOB,
Expand Down Expand Up @@ -85,9 +82,6 @@ const PageWrapper: FC<IndexOrSearchPageProps> = ({ nextStepPath, deps, mode }) =
} = useMlKibana();

const { redirectToMlAccessDeniedPage } = deps;
const redirectToJobsManagementPage = useCreateAndNavigateToMlLink(
ML_PAGES.ANOMALY_DETECTION_JOBS_MANAGE
);

const newJobResolvers = {
...basicResolvers(deps),
Expand All @@ -98,7 +92,6 @@ const PageWrapper: FC<IndexOrSearchPageProps> = ({ nextStepPath, deps, mode }) =
checkBasicLicense,
loadIndexPatterns: () => loadIndexPatterns(deps.indexPatterns),
checkGetJobsCapabilities: () => checkGetJobsCapabilitiesResolver(redirectToMlAccessDeniedPage),
checkMlNodesAvailable: () => checkMlNodesAvailable(redirectToJobsManagementPage),
};

const { context } = useResolver(
Expand Down

0 comments on commit 4cc94c5

Please sign in to comment.