Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Adding ability to change data view in advanced job wizard #115191

Merged
14 changes: 14 additions & 0 deletions x-pack/plugins/ml/common/types/job_validation.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/

import type { ErrorType } from '../util/errors';

export interface DatafeedValidationResponse {
valid: boolean;
documentsFound: boolean;
error?: ErrorType;
}
2 changes: 1 addition & 1 deletion x-pack/plugins/ml/common/types/saved_objects.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

import { ErrorType } from '../util/errors';
import type { ErrorType } from '../util/errors';
export type JobType = 'anomaly-detector' | 'data-frame-analytics';
export const ML_SAVED_OBJECT_TYPE = 'ml-job';
export const ML_MODULE_SAVED_OBJECT_TYPE = 'ml-module';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const useNavigateToPath = () => {
const location = useLocation();

return useCallback(
async (path: string | undefined, preserveSearch = false) => {
async (path: string | undefined, preserveSearch: boolean = false) => {
if (path === undefined) return;
const modifiedPath = `${path}${preserveSearch === true ? location.search : ''}`;
/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,10 @@ export class JobCreator {
return this._datafeed_config.indices;
}

public set indices(indics: string[]) {
this._datafeed_config.indices = indics;
}

public get scriptFields(): Field[] {
return this._scriptFields;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -258,17 +258,21 @@ export function convertToMultiMetricJob(
jobCreator.createdBy = CREATED_BY_LABEL.MULTI_METRIC;
jobCreator.modelPlot = false;
stashJobForCloning(jobCreator, true, true);

navigateToPath(`jobs/new_job/${JOB_TYPE.MULTI_METRIC}`, true);
}

export function convertToAdvancedJob(jobCreator: JobCreatorType, navigateToPath: NavigateToPath) {
jobCreator.createdBy = null;
stashJobForCloning(jobCreator, true, true);

navigateToPath(`jobs/new_job/${JOB_TYPE.ADVANCED}`, true);
}

export function resetAdvancedJob(jobCreator: JobCreatorType, navigateToPath: NavigateToPath) {
jobCreator.createdBy = null;
stashJobForCloning(jobCreator, true, false);
navigateToPath('/jobs/new_job');
}

export function resetJob(jobCreator: JobCreatorType, navigateToPath: NavigateToPath) {
jobCreator.jobId = '';
stashJobForCloning(jobCreator, true, true);
Expand Down
Loading