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] Converts Recognizer job page to React #47429

Merged
merged 44 commits into from
Oct 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
56af11b
[ML] wip recognize job
darnautov Oct 4, 2019
29c2fe8
[ML] error handling
darnautov Oct 4, 2019
2004e2b
[ML] layout enhancements
darnautov Oct 5, 2019
98d9675
[ML] errors handling
darnautov Oct 6, 2019
2055703
[ML] fix badges alignment and error message
darnautov Oct 6, 2019
c730d0d
[ML] components split
darnautov Oct 6, 2019
224fa1a
[ML] load module from the component, reset support
darnautov Oct 6, 2019
f5d131e
[ML] validators
darnautov Oct 7, 2019
9aecaba
[ML] check view route and resolver
darnautov Oct 7, 2019
1a1c5f6
[ML] validation
darnautov Oct 7, 2019
a70b659
[ML] remove angular code
darnautov Oct 7, 2019
48a7d03
[ML] change layout, fix patterns
darnautov Oct 7, 2019
6a22b9f
[ML] job response fix
darnautov Oct 7, 2019
0c62e7f
[ML] directive test
darnautov Oct 7, 2019
9e4dbac
[ML] directive test
darnautov Oct 7, 2019
32dc571
Merge remote-tracking branch 'upstream/master' into ML-18374-recognizer
darnautov Oct 7, 2019
7fab21c
[ML] remove lookbehind regexp
darnautov Oct 7, 2019
a3dd377
[ML] fix IE11 layout issues
darnautov Oct 7, 2019
adfdf78
Merge branch 'ML-18374-recognizer' of github.com:darnautov/kibana int…
darnautov Oct 7, 2019
0bfdfc3
[ML] remove form tag, refactor to formState
darnautov Oct 7, 2019
978c74b
[ML] aria labels, remove unused i18n
darnautov Oct 7, 2019
3ca6033
[ML] align kibana objects and reset button
darnautov Oct 8, 2019
c13c085
[ML] column layout for jobs response
darnautov Oct 8, 2019
6b195df
[ML] align icons and buttons
darnautov Oct 8, 2019
6d14ded
[ML] check existing kibana objects
darnautov Oct 9, 2019
cfae947
[ML] don't display kibana objects panel if empty
darnautov Oct 9, 2019
4cc6c6c
[ML] result and reset button order
darnautov Oct 9, 2019
9ad2e81
[ML] add EuiHorizontalRule
darnautov Oct 9, 2019
72fb12b
[ML] use time range and full index dat
darnautov Oct 9, 2019
cd15860
[ML] no check icon for existing objects
darnautov Oct 9, 2019
267b4fa
[ML] toast for exception during a jobs setup
darnautov Oct 9, 2019
3e71b74
[ML] disable panels growth, advanced settings with described form
darnautov Oct 9, 2019
bdc9e05
[ML] fix timeRange for results url
darnautov Oct 9, 2019
caf89c7
[ML] fix i18n
darnautov Oct 9, 2019
e1d7921
[ML] use EuiSwitch
darnautov Oct 9, 2019
0203bb4
[ML] PR remarks
darnautov Oct 9, 2019
1523992
[ML] job settings form component
darnautov Oct 9, 2019
cdcfd9b
[ML] i18n
darnautov Oct 9, 2019
fc33e3d
[ML] onChange fix
darnautov Oct 9, 2019
e0d2c17
Merge branch 'master' into ML-18374-recognizer
elasticmachine Oct 9, 2019
81c3081
[ML] custom hook for partial state update
darnautov Oct 10, 2019
20e5be2
[ML] jobGroups update
darnautov Oct 10, 2019
77b326b
[ML] PR remarks
darnautov Oct 10, 2019
ebd8d21
[ML] fix imports
darnautov Oct 10, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
83 changes: 83 additions & 0 deletions x-pack/legacy/plugins/ml/common/types/modules.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { Datafeed, Job } from '../../public/jobs/new_job_new/common/job_creator/configs';
import { SavedObjectAttributes } from '../../../../../../target/types/core/server';

export interface ModuleJob {
id: string;
config: Omit<Job, 'job_id'>;
}

export interface KibanaObjectConfig extends SavedObjectAttributes {
description: string;
title: string;
version: number;
}

export interface KibanaObject {
id: string;
title: string;
config: KibanaObjectConfig;
}

export interface KibanaObjects {
[objectType: string]: KibanaObject[] | undefined;
}

/**
* Interface for get_module endpoint response.
*/
export interface Module {
id: string;
title: string;
description: string;
type: string;
logoFile: string;
defaultIndexPattern: string;
query: any;
jobs: ModuleJob[];
datafeeds: Datafeed[];
kibana: KibanaObjects;
}

export interface KibanaObjectResponse {
exists?: boolean;
success?: boolean;
id: string;
}

export interface SetupError {
body: string;
msg: string;
path: string;
query: {};
response: string;
statusCode: number;
}

export interface DatafeedResponse {
id: string;
success: boolean;
started: boolean;
error?: SetupError;
}

export interface JobResponse {
id: string;
success: boolean;
error?: SetupError;
}

export interface DataRecognizerConfigResponse {
datafeeds: DatafeedResponse[];
jobs: JobResponse[];
kibana: {
search: KibanaObjectResponse;
visualization: KibanaObjectResponse;
dashboard: KibanaObjectResponse;
};
}
35 changes: 35 additions & 0 deletions x-pack/legacy/plugins/ml/common/util/validators.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,38 @@ export function maxLengthValidator(
}
: null;
}

/**
* Provides a validator function for checking against pattern.
* @param pattern
*/
export function patternValidator(
pattern: RegExp
): (value: string) => { pattern: { matchPattern: string } } | null {
return value =>
pattern.test(value)
? null
: {
pattern: {
matchPattern: pattern.toString(),
},
};
}

/**
* Composes multiple validators into a single function
* @param validators
*/
export function composeValidators(
...validators: Array<(value: string) => { [key: string]: any } | null>
): (value: string) => { [key: string]: any } | null {
return value => {
const validationResult = validators.reduce((acc, validator) => {
return {
...acc,
...(validator(value) || {}),
};
}, {});
return Object.keys(validationResult).length > 0 ? validationResult : null;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/



import './create_job';
export { usePartialState } from './use_partial_state';
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import { useState } from 'react';

/**
* Custom hook for partial state update.
*/
export function usePartialState<T>(initialValue: T): [T, (update: Partial<T>) => void] {
const [state, setState] = useState<T>(initialValue);
const setFormStateCallback = (update: Partial<T>) => {
setState({
...state,
...update,
});
};
return [state, setFormStateCallback];
}
Original file line number Diff line number Diff line change
Expand Up @@ -189,16 +189,6 @@ export const getTooltips = () => {
defaultMessage: 'Advanced option. Select to retrieve unfiltered _source document, instead of specified fields.'
})
},
new_job_advanced_settings: {
text: i18n.translate('xpack.ml.tooltips.newJobAdvancedSettingsTooltip', {
defaultMessage: 'Advanced options'
})
},
new_job_dedicated_index: {
text: i18n.translate('xpack.ml.tooltips.newJobDedicatedIndexTooltip', {
defaultMessage: 'Select to store results in a separate index for this job.'
})
},
new_job_enable_model_plot: {
text: i18n.translate('xpack.ml.tooltips.newJobEnableModelPlotTooltip', {
defaultMessage: 'Select to enable model plot. Stores model information along with results. ' +
Expand Down
1 change: 0 additions & 1 deletion x-pack/legacy/plugins/ml/public/jobs/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,5 @@ import './new_job/advanced';
import './new_job/simple/single_metric';
import './new_job/simple/multi_metric';
import './new_job/simple/population';
import './new_job/simple/recognize';
import 'plugins/ml/components/validate_job';
import './new_job_new';
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@

@import 'multi_metric/index'; // SASSTODO: Needs some rewriting
@import 'population/index'; // SASSTODO: Needs some rewriting
@import 'recognize/index'; // SASSTODO: Needs some rewriting
@import 'single_metric/index'; // SASSTODO: Needs some rewriting

This file was deleted.

This file was deleted.

This file was deleted.

Loading