Adding move to advanced job feature (#18633)

This commit is contained in:
James Gowdy 2018-04-27 16:20:57 +01:00 committed by GitHub
parent a80c669490
commit 1249643cf6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 62 additions and 8 deletions

View file

@ -221,10 +221,14 @@ module.controller('MlNewJob',
console.log('Editing job', mlJobService.currentJob);
$scope.ui.pageTitle = 'Editing Job ' + $scope.job.job_id;
} else {
$scope.mode = MODE.CLONE;
console.log('Cloning job', mlJobService.currentJob);
$scope.ui.pageTitle = 'Clone Job from ' + $scope.job.job_id;
$scope.job.job_id = '';
if (mlJobService.currentJob.job_version === undefined) {
$scope.mode = MODE.NEW;
} else {
$scope.mode = MODE.CLONE;
console.log('Cloning job', mlJobService.currentJob);
$scope.ui.pageTitle = 'Clone Job from ' + $scope.job.job_id;
$scope.job.job_id = '';
}
setDatafeedUIText();
setFieldDelimiterControlsFromText();
@ -696,6 +700,7 @@ module.controller('MlNewJob',
const indicesText = datafeedConfig.indices.join(',');
$scope.ui.fieldsUpToDate = (indicesText === $scope.ui.datafeed.indicesText);
const types = Array.isArray(datafeedConfig.types) ? datafeedConfig.types : [];
$scope.ui.datafeed = {
queryText: angular.toJson(datafeedConfig.query, true),
@ -706,7 +711,7 @@ module.controller('MlNewJob',
scrollSizeText: scrollSize,
scrollSizeDefault: scrollSizeDefault,
indicesText,
typesText: datafeedConfig.types.join(','),
typesText: types.join(','),
};
if ($scope.ui.fieldsUpToDate === false) {

View file

@ -87,6 +87,10 @@
<div ng-show="ui.showJobInput && (jobState === JOB_STATE.NOT_STARTED || jobState === JOB_STATE.RUNNING || jobState === JOB_STATE.STOPPING)">
<ml-general-job-details></ml-general-job-details>
<div class="form-group">
<a href="" ng-click="moveToAdvancedJobCreation()">Move to advanced job configuration</a>
</div>
<div class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--responsive">
<div class="euiFlexItem euiFlexItem--flexGrowZero">
<ml-validate-job

View file

@ -24,7 +24,6 @@ import { IntervalHelperProvider } from 'plugins/ml/util/ml_time_buckets';
import { filterAggTypes } from 'plugins/ml/jobs/new_job/simple/components/utils/filter_agg_types';
import { validateJob } from 'plugins/ml/jobs/new_job/simple/components/utils/validate_job';
import { adjustIntervalDisplayed } from 'plugins/ml/jobs/new_job/simple/components/utils/adjust_interval';
import { createSearchItems, createResultsUrl, addNewJobToRecentlyAccessed } from 'plugins/ml/jobs/new_job/utils/new_job_utils';
import { populateAppStateSettings } from 'plugins/ml/jobs/new_job/simple/components/utils/app_state_settings';
import { CHART_STATE, JOB_STATE } from 'plugins/ml/jobs/new_job/simple/components/constants/states';
import { createFields } from 'plugins/ml/jobs/new_job/simple/components/utils/create_fields';
@ -33,6 +32,11 @@ import { ChartDataUtilsProvider } from 'plugins/ml/jobs/new_job/simple/component
import { checkMlNodesAvailable } from 'plugins/ml/ml_nodes_check/check_ml_nodes';
import { loadNewJobDefaults } from 'plugins/ml/jobs/new_job/utils/new_job_defaults';
import { mlEscape } from 'plugins/ml/util/string_utils';
import {
createSearchItems,
createResultsUrl,
addNewJobToRecentlyAccessed,
moveToAdvancedJobCreationProvider } from 'plugins/ml/jobs/new_job/utils/new_job_utils';
import template from './create_job.html';
uiRoutes
@ -67,6 +71,7 @@ module
timefilter.disableAutoRefreshSelector();
const msgs = mlMessageBarService;
const MlTimeBuckets = Private(IntervalHelperProvider);
const moveToAdvancedJobCreation = Private(moveToAdvancedJobCreationProvider);
const calculateModelMemoryLimit = Private(CalculateModelMemoryLimitProvider);
const chartDataUtils = Private(ChartDataUtilsProvider);
$scope.addNewJobToRecentlyAccessed = addNewJobToRecentlyAccessed;
@ -628,6 +633,11 @@ module
mlMultiMetricJobService.stopDatafeed($scope.formConfig);
};
$scope.moveToAdvancedJobCreation = function () {
const job = mlMultiMetricJobService.getJobFromConfig($scope.formConfig);
moveToAdvancedJobCreation(job);
};
$scope.setModelMemoryLimit = function () {
const formConfig = $scope.formConfig;
calculateModelMemoryLimit(

View file

@ -96,6 +96,10 @@
<div ng-show="ui.showJobInput && (jobState === JOB_STATE.NOT_STARTED || jobState === JOB_STATE.RUNNING || jobState === JOB_STATE.STOPPING)">
<ml-general-job-details></ml-general-job-details>
<div class="form-group">
<a href="" ng-click="moveToAdvancedJobCreation()">Move to advanced job configuration</a>
</div>
<div class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--responsive">
<div class="euiFlexItem euiFlexItem--flexGrowZero">
<ml-validate-job

View file

@ -23,7 +23,6 @@ import { IntervalHelperProvider } from 'plugins/ml/util/ml_time_buckets';
import { filterAggTypes } from 'plugins/ml/jobs/new_job/simple/components/utils/filter_agg_types';
import { validateJob } from 'plugins/ml/jobs/new_job/simple/components/utils/validate_job';
import { adjustIntervalDisplayed } from 'plugins/ml/jobs/new_job/simple/components/utils/adjust_interval';
import { createSearchItems, createResultsUrl, addNewJobToRecentlyAccessed } from 'plugins/ml/jobs/new_job/utils/new_job_utils';
import { populateAppStateSettings } from 'plugins/ml/jobs/new_job/simple/components/utils/app_state_settings';
import { CHART_STATE, JOB_STATE } from 'plugins/ml/jobs/new_job/simple/components/constants/states';
import { createFields } from 'plugins/ml/jobs/new_job/simple/components/utils/create_fields';
@ -32,6 +31,11 @@ import { ChartDataUtilsProvider } from 'plugins/ml/jobs/new_job/simple/component
import { checkMlNodesAvailable } from 'plugins/ml/ml_nodes_check/check_ml_nodes';
import { loadNewJobDefaults, newJobDefaults } from 'plugins/ml/jobs/new_job/utils/new_job_defaults';
import { mlEscape } from 'plugins/ml/util/string_utils';
import {
createSearchItems,
createResultsUrl,
addNewJobToRecentlyAccessed,
moveToAdvancedJobCreationProvider } from 'plugins/ml/jobs/new_job/utils/new_job_utils';
import template from './create_job.html';
uiRoutes
@ -68,6 +72,7 @@ module
timefilter.disableAutoRefreshSelector();
const msgs = mlMessageBarService;
const MlTimeBuckets = Private(IntervalHelperProvider);
const moveToAdvancedJobCreation = Private(moveToAdvancedJobCreationProvider);
const chartDataUtils = Private(ChartDataUtilsProvider);
$scope.addNewJobToRecentlyAccessed = addNewJobToRecentlyAccessed;
@ -655,6 +660,11 @@ module
mlPopulationJobService.stopDatafeed($scope.formConfig);
};
$scope.moveToAdvancedJobCreation = function () {
const job = mlPopulationJobService.getJobFromConfig($scope.formConfig);
moveToAdvancedJobCreation(job);
};
// resize the spilt cards on page resize.
// when the job starts the 'Analysis running' label appearing can cause a scroll bar to appear
// which will cause the split cards to look odd

View file

@ -221,6 +221,9 @@
</div>
</div>
<div class="form-group">
<a href="" ng-click="moveToAdvancedJobCreation()">Move to advanced job configuration</a>
</div>
<div class="euiFlexGroup euiFlexGroup--gutterSmall euiFlexGroup--alignItemsCenter euiFlexGroup--responsive">
<div class="euiFlexItem euiFlexItem--flexGrowZero">
<ml-validate-job

View file

@ -24,7 +24,6 @@ import { IntervalHelperProvider } from 'plugins/ml/util/ml_time_buckets';
import { filterAggTypes } from 'plugins/ml/jobs/new_job/simple/components/utils/filter_agg_types';
import { validateJob } from 'plugins/ml/jobs/new_job/simple/components/utils/validate_job';
import { adjustIntervalDisplayed } from 'plugins/ml/jobs/new_job/simple/components/utils/adjust_interval';
import { createSearchItems, createResultsUrl, addNewJobToRecentlyAccessed } from 'plugins/ml/jobs/new_job/utils/new_job_utils';
import { populateAppStateSettings } from 'plugins/ml/jobs/new_job/simple/components/utils/app_state_settings';
import { getIndexedFields } from 'plugins/ml/jobs/new_job/simple/components/utils/create_fields';
import { changeJobIDCase } from 'plugins/ml/jobs/new_job/simple/components/general_job_details/change_job_id_case';
@ -32,6 +31,12 @@ import { CHART_STATE, JOB_STATE } from 'plugins/ml/jobs/new_job/simple/component
import { getIndexPatternWithRoute, getSavedSearchWithRoute, timeBasedIndexCheck } from 'plugins/ml/util/index_utils';
import { checkMlNodesAvailable } from 'plugins/ml/ml_nodes_check/check_ml_nodes';
import { loadNewJobDefaults } from 'plugins/ml/jobs/new_job/utils/new_job_defaults';
import {
createSearchItems,
createResultsUrl,
addNewJobToRecentlyAccessed,
moveToAdvancedJobCreationProvider } from 'plugins/ml/jobs/new_job/utils/new_job_utils';
import template from './create_job.html';
uiRoutes
@ -68,6 +73,7 @@ module
timefilter.disableAutoRefreshSelector();
const msgs = mlMessageBarService;
const MlTimeBuckets = Private(IntervalHelperProvider);
const moveToAdvancedJobCreation = Private(moveToAdvancedJobCreationProvider);
const stateDefaults = {
mlJobSettings: {}
@ -550,6 +556,11 @@ module
mlSingleMetricJobService.stopDatafeed($scope.formConfig);
};
$scope.moveToAdvancedJobCreation = function () {
const job = mlSingleMetricJobService.getJobFromConfig($scope.formConfig);
moveToAdvancedJobCreation(job);
};
$scope.setFullTimeRange = function () {
mlFullTimeRangeSelectorService.setFullTimeRange($scope.ui.indexPattern, $scope.formConfig.combinedQuery);
};

View file

@ -107,3 +107,10 @@ export function addNewJobToRecentlyAccessed(jobId, resultsUrl) {
const urlParts = resultsUrl.match(/ml#\/(.+?)(\?.+)/);
addItemToRecentlyAccessed(urlParts[1], jobId, urlParts[2]);
}
export function moveToAdvancedJobCreationProvider(mlJobService, $location) {
return function moveToAdvancedJobCreation(job) {
mlJobService.currentJob = job;
$location.path('jobs/new_job/advanced');
};
}