-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ML] Add checkbox to enable model plot in Advanced job wizard (#25468) (
#25831) * Move cardinality success check to utils * enableModelPlot checkbox base added * Run cardinality check on add/update fields * Handle changes made via json * only run cardinality check if model plot enabled * Handle model plot enabled via EditJSON tab * show message on cardinality check error * multi-metric + pop: show message on cardinality check error * add test for callout component * Fix flexitem overflow in IE11
- Loading branch information
1 parent
ff4a102
commit afc72eb
Showing
12 changed files
with
305 additions
and
33 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
x-pack/plugins/ml/public/jobs/new_job/advanced/_advanced.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
.../public/jobs/new_job/advanced/enable_model_plot_callout/enable_model_plot_callout.test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* 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 React from 'react'; | ||
import { mount } from 'enzyme'; | ||
import { EnableModelPlotCallout } from './enable_model_plot_callout_view.js'; | ||
|
||
const message = 'Test message'; | ||
|
||
describe('EnableModelPlotCallout', () => { | ||
|
||
test('Callout is rendered correctly with message', () => { | ||
const wrapper = mount(<EnableModelPlotCallout message={message} />); | ||
const calloutText = wrapper.find('EuiText'); | ||
|
||
expect(calloutText.text()).toBe(message); | ||
}); | ||
|
||
}); |
22 changes: 22 additions & 0 deletions
22
...ic/jobs/new_job/advanced/enable_model_plot_callout/enable_model_plot_callout_directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/* | ||
* 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 'ngreact'; | ||
|
||
import { uiModules } from 'ui/modules'; | ||
const module = uiModules.get('apps/ml', ['react']); | ||
|
||
import { EnableModelPlotCallout } from './enable_model_plot_callout_view.js'; | ||
|
||
module.directive('mlEnableModelPlotCallout', function (reactDirective) { | ||
return reactDirective( | ||
EnableModelPlotCallout, | ||
undefined, | ||
{ restrict: 'E' } | ||
); | ||
}); |
39 changes: 39 additions & 0 deletions
39
.../public/jobs/new_job/advanced/enable_model_plot_callout/enable_model_plot_callout_view.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* 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 PropTypes from 'prop-types'; | ||
import React, { Fragment } from 'react'; | ||
|
||
import { | ||
EuiCallOut, | ||
EuiFlexGroup, | ||
EuiFlexItem, | ||
} from '@elastic/eui'; | ||
|
||
|
||
export const EnableModelPlotCallout = ({ message }) => ( | ||
<Fragment> | ||
<EuiFlexGroup direction="column"> | ||
<EuiFlexItem grow={false}> | ||
<EuiCallOut | ||
title={'Proceed with caution!'} | ||
color="warning" | ||
iconType="help" | ||
> | ||
<p> | ||
{message} | ||
</p> | ||
</EuiCallOut> | ||
</EuiFlexItem> | ||
</EuiFlexGroup> | ||
</Fragment> | ||
); | ||
|
||
EnableModelPlotCallout.propTypes = { | ||
message: PropTypes.string.isRequired, | ||
}; |
8 changes: 8 additions & 0 deletions
8
x-pack/plugins/ml/public/jobs/new_job/advanced/enable_model_plot_callout/index.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
/* | ||
* 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 './enable_model_plot_callout_directive.js'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.