Skip to content

Commit

Permalink
[ML] Enabling new job wizards to replace old wizards (elastic#44233)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgowdyelastic authored Aug 28, 2019
1 parent 1004bdd commit 86e1f51
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const RecognizedResult = ({
`index=${indexPattern.id}` :
`savedSearchId=${savedSearch.id}`;

const href = `#/jobs/new_job/simple/recognize?id=${config.id}&${id}`;
const href = `#/jobs/new_job/recognize?id=${config.id}&${id}`;

let logo = null;
// if a logo is available, use that, otherwise display the id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ import template from './create_job.html';
import { timefilter } from 'ui/timefilter';

uiRoutes
.when('/jobs/new_job/simple/multi_metric', {
.when('/jobs/new_job_old/multi_metric', {
template,
k7Breadcrumbs: getCreateMultiMetricJobBreadcrumbs,
resolve: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import { timefilter } from 'ui/timefilter';
import { subscribeWithScope } from 'ui/utils/subscribe_with_scope';

uiRoutes
.when('/jobs/new_job/simple/population', {
.when('/jobs/new_job_old/population', {
template,
k7Breadcrumbs: getCreatePopulationJobBreadcrumbs,
resolve: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export function checkViewOrCreateJobs(Private, $route, kbnBaseUrl, kbnUrl) {
window.location.href = `${basePath}${resultsPageUrl}`;
reject();
} else {
window.location.href = `${basePath}ml#/jobs/new_job/simple/recognize?id=${moduleId}&index=${indexPatternId}`;
window.location.href = `${basePath}ml#/jobs/new_job/recognize?id=${moduleId}&index=${indexPatternId}`;
reject();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import { toastNotifications } from 'ui/notify';
import { timefilter } from 'ui/timefilter';

uiRoutes
.when('/jobs/new_job/simple/recognize', {
.when('/jobs/new_job/recognize', {
template,
k7Breadcrumbs: getCreateRecognizerJobBreadcrumbs,
resolve: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ import template from './create_job.html';
import { timefilter } from 'ui/timefilter';

uiRoutes
.when('/jobs/new_job/simple/single_metric', {
.when('/jobs/new_job_old/single_metric', {
template,
k7Breadcrumbs: getCreateSingleMetricJobBreadcrumbs,
resolve: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ function getWizardUrlFromAppState(appState) {
page = 'single_metric';
}
}
return `jobs/new_job/simple/${page}`;
return `jobs/new_job/${page}`;
} else {
return null;
}
Expand All @@ -98,7 +98,7 @@ function getWizardUrlFromCloningJob(job) {
}
const indexPatternId = getIndexPatternIdFromName(job.datafeed_config.indices[0]);

return `jobs/new_job/new_new_job/${page}?index=${indexPatternId}&_g=()`;
return `jobs/new_job/${page}?index=${indexPatternId}&_g=()`;
} else {
return null;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@

<div class="euiFlexGrid euiFlexGrid--gutterLarge euiFlexGrid--fourths">
<div class="euiFlexItem" ng-class='{disabled: isTimeBasedIndex===false}'>
<a ng-href="{{getUrl('#jobs/new_job/simple/single_metric')}}" ng-class='{disabled: isTimeBasedIndex===false}' class="euiLink synopsis">
<a ng-href="{{getUrl('#jobs/new_job/single_metric')}}" ng-class='{disabled: isTimeBasedIndex===false}' class="euiLink synopsis">
<div class="euiPanel euiPanel--paddingMedium synopsisPanel">
<div class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--responsive">
<div class="euiFlexItem euiFlexItem--flexGrowZero">
Expand Down Expand Up @@ -118,7 +118,7 @@
</a>
</div>
<div class="euiFlexItem" ng-class='{disabled: isTimeBasedIndex===false}'>
<a ng-href="{{getUrl('#jobs/new_job/simple/multi_metric')}}" ng-class='{disabled: isTimeBasedIndex===false}' class="euiLink synopsis">
<a ng-href="{{getUrl('#jobs/new_job/multi_metric')}}" ng-class='{disabled: isTimeBasedIndex===false}' class="euiLink synopsis">
<div class="euiPanel euiPanel--paddingMedium synopsisPanel">
<div class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--responsive">
<div class="euiFlexItem euiFlexItem--flexGrowZero">
Expand Down Expand Up @@ -150,7 +150,7 @@
</a>
</div>
<div class="euiFlexItem" ng-class='{disabled: isTimeBasedIndex===false}'>
<a ng-href="{{getUrl('#jobs/new_job/simple/population')}}" ng-class='{disabled: isTimeBasedIndex===false}' class="euiLink synopsis">
<a ng-href="{{getUrl('#jobs/new_job/population')}}" ng-class='{disabled: isTimeBasedIndex===false}' class="euiLink synopsis">
<div class="euiPanel euiPanel--paddingMedium synopsisPanel">
<div class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--responsive">
<div class="euiFlexItem euiFlexItem--flexGrowZero">
Expand Down Expand Up @@ -213,102 +213,6 @@
</div>
</a>
</div>
<div class="euiFlexItem" ng-class='{disabled: isTimeBasedIndex===false}'>
<a ng-href="{{getUrl('#jobs/new_job/new_new_job/single_metric')}}" ng-class='{disabled: isTimeBasedIndex===false}' class="euiLink synopsis" data-test-subj="mlJobTypeLinkSingleMetricJob">
<div class="euiPanel euiPanel--paddingMedium synopsisPanel">
<div class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--responsive">
<div class="euiFlexItem euiFlexItem--flexGrowZero">
<icon
type="'createSingleMetricJob'"
size="'xl'"
aria-label="{{ ::'xpack.ml.newJob.wizard.jobType.singleMetricAriaLabelNew' | i18n: {defaultMessage: 'Single metric job NEW'} }}"
class="synopsisIcon"
/>
</div>
<div class="euiFlexItem synopsisContent">
<h4
class="euiTitle euiTitle--small synopsisTitle"
i18n-id="xpack.ml.newJob.wizard.jobType.singleMetricTitleNew"
i18n-default-message="Single metric NEW"
></h4>
<div class="euiText synopsisBody">
<p>
<span
class="euiTextColor euiTextColor--subdued"
i18n-id="xpack.ml.newJob.wizard.jobType.singleMetricDescriptionNew"
i18n-default-message="Detect anomalies in a single time series."
></span>
</p>
</div>
</div>
</div>
</div>
</a>
</div>
<div class="euiFlexItem" ng-class='{disabled: isTimeBasedIndex===false}'>
<a ng-href="{{getUrl('#jobs/new_job/new_new_job/multi_metric')}}" ng-class='{disabled: isTimeBasedIndex===false}' class="euiLink synopsis" data-test-subj="mlJobTypeLinkMultiMetricJob">
<div class="euiPanel euiPanel--paddingMedium synopsisPanel">
<div class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--responsive">
<div class="euiFlexItem euiFlexItem--flexGrowZero">
<icon
type="'createMultiMetricJob'"
size="'xl'"
aria-label="{{ ::'xpack.ml.newJob.wizard.jobType.multiMetricAriaLabelNew' | i18n: {defaultMessage: 'Multi metric job NEW'} }}"
class="synopsisIcon"
/>
</div>
<div class="euiFlexItem synopsisContent">
<h4
class="euiTitle euiTitle--small synopsisTitle"
i18n-id="xpack.ml.newJob.wizard.jobType.multiMetricTitleNew"
i18n-default-message="Multi metric NEW"
></h4>
<div class="euiText synopsisBody">
<p>
<span
class="euiTextColor euiTextColor--subdued"
i18n-id="xpack.ml.newJob.wizard.jobType.multiMetricDescriptionNew"
i18n-default-message="Detect anomalies in multiple metrics by splitting a time series by a categorical field."
></span>
</p>
</div>
</div>
</div>
</div>
</a>
</div>
<div class="euiFlexItem" ng-class='{disabled: isTimeBasedIndex===false}'>
<a ng-href="{{getUrl('#jobs/new_job/new_new_job/population')}}" ng-class='{disabled: isTimeBasedIndex===false}' class="euiLink synopsis" data-test-subj="mlJobTypeLinkPopulationJob">
<div class="euiPanel euiPanel--paddingMedium synopsisPanel">
<div class="euiFlexGroup euiFlexGroup--gutterLarge euiFlexGroup--responsive">
<div class="euiFlexItem euiFlexItem--flexGrowZero">
<icon
type="'createPopulationJob'"
size="'xl'"
aria-label="{{ ::'xpack.ml.newJob.wizard.jobType.populationAriaLabelNew' | i18n: {defaultMessage: 'Population job NEW'} }}"
class="synopsisIcon"
/>
</div>
<div class="euiFlexItem synopsisContent">
<h4
class="euiTitle euiTitle--small synopsisTitle"
i18n-id="xpack.ml.newJob.wizard.jobType.populationTitleNew"
i18n-default-message="Population NEW"
></h4>
<div class="euiText synopsisBody">
<p>
<span
class="euiTextColor euiTextColor--subdued"
i18n-id="xpack.ml.newJob.wizard.jobType.populationDescriptionNew"
i18n-default-message="Detect activity that is unusual compared to the behavior of the population."
></span>
</p>
</div>
</div>
</div>
</div>
</a>
</div>
</div>

<div class="euiSpacer euiSpacer--xxl"></div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,5 @@ export function convertToAdvancedJob(jobCreator: JobCreator) {
datafeed_config: jobCreator.datafeedConfig,
};

window.location.href = window.location.href.replace('new_new_job/multi_metric', 'advanced');
window.location.href = window.location.href.replace('multi_metric', 'advanced');
}
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ const routes: Route[] = [
];

routes.forEach((route: Route) => {
uiRoutes.when(`/jobs/new_job/new_new_job/${route.id}`, {
uiRoutes.when(`/jobs/new_job/${route.id}`, {
template,
k7Breadcrumbs: route.k7Breadcrumbs,
resolve: {
Expand Down

0 comments on commit 86e1f51

Please sign in to comment.