From 5b165466e60c8885143fb9f675e83b9950e143b6 Mon Sep 17 00:00:00 2001 From: James Gowdy Date: Wed, 16 Oct 2019 14:35:55 +0100 Subject: [PATCH] [ML] Removing old angular directives (#48382) * [ML] Removing old angular directives * reverts small change * typescriptifying access denied page * changing access denied text * updating translations --- .../ml/public/access_denied/index.html | 46 ----- .../plugins/ml/public/access_denied/index.js | 25 --- .../plugins/ml/public/access_denied/index.tsx | 39 +++++ .../plugins/ml/public/access_denied/page.tsx | 63 +++++++ x-pack/legacy/plugins/ml/public/app.js | 1 - .../data_recognizer_directive.js | 17 -- .../components/data_recognizer/index.ts | 2 - .../field_title_bar_directive.js | 44 ----- .../components/field_title_bar/index.js | 4 - .../field_type_icon_directive.js | 46 ----- .../components/field_type_icon/index.js | 3 - .../full_time_range_selector_directive.js | 58 ------- .../messagebar/__tests__/messagebar.js | 29 ---- .../public/components/messagebar/_index.scss | 1 - .../components/messagebar/_messagebar.scss | 35 ---- .../index.js => messagebar/index.ts} | 4 +- .../components/messagebar/messagebar.html | 7 - .../components/messagebar/messagebar.js | 26 --- .../messagebar/messagebar_service.d.ts | 7 - .../messagebar/messagebar_service.js | 58 ------- .../components/navigation_menu/index.ts | 2 +- ...navigation_menu_react_wrapper_directive.js | 29 ---- .../index.js => validate_job/index.ts} | 2 +- .../validate_job/validate_job_directive.js | 26 --- .../validate_job/validate_job_view.js | 4 +- .../pages/analytics_exploration/page.tsx | 2 +- .../pages/analytics_management/page.tsx | 2 +- .../datavisualizer/datavisualizer_selector.js | 2 +- .../file_based/file_datavisualizer.js | 2 +- .../datavisualizer/index_based/page.tsx | 164 +++++++++--------- .../datavisualizer/index_based/route.ts | 2 +- .../plugins/ml/public/explorer/explorer.js | 2 +- x-pack/legacy/plugins/ml/public/index.scss | 1 - .../edit_job_flyout/edit_job_flyout.js | 2 +- .../group_selector/group_selector.js | 2 +- .../public/jobs/jobs_list/components/utils.js | 2 +- .../plugins/ml/public/jobs/jobs_list/jobs.js | 2 +- .../estimate_bucket_span.ts | 2 +- .../multi_metric_view/metric_selection.tsx | 2 +- .../metric_selection_summary.tsx | 2 +- .../population_view/metric_selection.tsx | 2 +- .../metric_selection_summary.tsx | 2 +- .../single_metric_view/metric_selection.tsx | 2 +- .../metric_selection_summary.tsx | 2 +- .../components/validation_step/validation.tsx | 2 +- .../ml/public/overview/overview_page.tsx | 2 +- .../ml/public/services/calendar_service.js | 2 +- .../plugins/ml/public/services/job_service.js | 2 +- .../settings/calendars/edit/new_calendar.js | 2 +- .../calendars/edit/new_calendar.test.js | 2 +- .../settings/calendars/list/calendars_list.js | 2 +- .../calendars/list/calendars_list.test.js | 2 +- .../filter_lists/edit/edit_filter_list.js | 2 +- .../edit/edit_filter_list.test.js | 2 +- .../filter_lists/list/filter_lists.js | 2 +- .../filter_lists/list/filter_lists.test.js | 2 +- .../plugins/ml/public/settings/settings.js | 2 +- .../ml/public/settings/settings.test.js | 2 +- .../forecasting_modal_directive.js | 27 --- .../timeseriesexplorer/timeseriesexplorer.js | 2 +- .../translations/translations/ja-JP.json | 4 - .../translations/translations/zh-CN.json | 4 - 62 files changed, 222 insertions(+), 620 deletions(-) delete mode 100644 x-pack/legacy/plugins/ml/public/access_denied/index.html delete mode 100644 x-pack/legacy/plugins/ml/public/access_denied/index.js create mode 100644 x-pack/legacy/plugins/ml/public/access_denied/index.tsx create mode 100644 x-pack/legacy/plugins/ml/public/access_denied/page.tsx delete mode 100644 x-pack/legacy/plugins/ml/public/components/data_recognizer/data_recognizer_directive.js delete mode 100644 x-pack/legacy/plugins/ml/public/components/field_title_bar/field_title_bar_directive.js delete mode 100644 x-pack/legacy/plugins/ml/public/components/field_type_icon/field_type_icon_directive.js delete mode 100644 x-pack/legacy/plugins/ml/public/components/full_time_range_selector/full_time_range_selector_directive.js delete mode 100644 x-pack/legacy/plugins/ml/public/components/messagebar/__tests__/messagebar.js delete mode 100644 x-pack/legacy/plugins/ml/public/components/messagebar/_index.scss delete mode 100644 x-pack/legacy/plugins/ml/public/components/messagebar/_messagebar.scss rename x-pack/legacy/plugins/ml/public/components/{validate_job/index.js => messagebar/index.ts} (80%) delete mode 100644 x-pack/legacy/plugins/ml/public/components/messagebar/messagebar.html delete mode 100644 x-pack/legacy/plugins/ml/public/components/messagebar/messagebar.js delete mode 100644 x-pack/legacy/plugins/ml/public/components/navigation_menu/navigation_menu_react_wrapper_directive.js rename x-pack/legacy/plugins/ml/public/components/{messagebar/index.js => validate_job/index.ts} (82%) delete mode 100644 x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_directive.js delete mode 100644 x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/forecasting_modal_directive.js diff --git a/x-pack/legacy/plugins/ml/public/access_denied/index.html b/x-pack/legacy/plugins/ml/public/access_denied/index.html deleted file mode 100644 index e085e089b2728..0000000000000 --- a/x-pack/legacy/plugins/ml/public/access_denied/index.html +++ /dev/null @@ -1,46 +0,0 @@ - -
-
-
-
- - -
-
-

-
-
- -
- - -
-
diff --git a/x-pack/legacy/plugins/ml/public/access_denied/index.js b/x-pack/legacy/plugins/ml/public/access_denied/index.js deleted file mode 100644 index 52b813917e9be..0000000000000 --- a/x-pack/legacy/plugins/ml/public/access_denied/index.js +++ /dev/null @@ -1,25 +0,0 @@ -/* - * 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 uiRoutes from 'ui/routes'; -import uiChrome from 'ui/chrome'; -import template from './index.html'; - -uiRoutes.when('/access-denied', { - template, - controllerAs: 'accessDenied', - controller($window, kbnUrl, kbnBaseUrl) { - this.goToKibana = () => { - $window.location.href = uiChrome.getBasePath() + kbnBaseUrl; - }; - - this.retry = () => { - return kbnUrl.redirect('/jobs'); - }; - } -}); diff --git a/x-pack/legacy/plugins/ml/public/access_denied/index.tsx b/x-pack/legacy/plugins/ml/public/access_denied/index.tsx new file mode 100644 index 0000000000000..883754896487e --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/access_denied/index.tsx @@ -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 React from 'react'; +import ReactDOM from 'react-dom'; +import uiRoutes from 'ui/routes'; +import { I18nContext } from 'ui/i18n'; +// @ts-ignore +import { uiModules } from 'ui/modules'; +import { AccessDeniedPage } from './page'; + +const module = uiModules.get('apps/ml', ['react']); + +const template = ``; + +uiRoutes.when('/access-denied', { + template, +}); + +module.directive('accessDenied', function() { + return { + scope: {}, + restrict: 'E', + link: async (scope: ng.IScope, element: ng.IAugmentedJQuery) => { + ReactDOM.render( + {React.createElement(AccessDeniedPage)}, + element[0] + ); + + element.on('$destroy', () => { + ReactDOM.unmountComponentAtNode(element[0]); + scope.$destroy(); + }); + }, + }; +}); diff --git a/x-pack/legacy/plugins/ml/public/access_denied/page.tsx b/x-pack/legacy/plugins/ml/public/access_denied/page.tsx new file mode 100644 index 0000000000000..1c908e114cbeb --- /dev/null +++ b/x-pack/legacy/plugins/ml/public/access_denied/page.tsx @@ -0,0 +1,63 @@ +/* + * 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, { Fragment } from 'react'; + +import { FormattedMessage } from '@kbn/i18n/react'; +import { i18n } from '@kbn/i18n'; +import { + EuiCallOut, + EuiPage, + EuiPageBody, + EuiPageContentBody, + EuiPageContentHeader, + EuiPageContentHeaderSection, + EuiSpacer, + EuiText, + EuiTitle, +} from '@elastic/eui'; +import { NavigationMenu } from '../components/navigation_menu'; + +export const AccessDeniedPage = () => ( + + + + + + + +

+ +

+
+
+
+ + + + +

+ +

+
+
+
+
+
+
+); diff --git a/x-pack/legacy/plugins/ml/public/app.js b/x-pack/legacy/plugins/ml/public/app.js index a97150eaa3d2c..5208f9b24bc27 100644 --- a/x-pack/legacy/plugins/ml/public/app.js +++ b/x-pack/legacy/plugins/ml/public/app.js @@ -16,7 +16,6 @@ import 'plugins/ml/access_denied'; import 'plugins/ml/jobs'; import 'plugins/ml/overview'; import 'plugins/ml/services/calendar_service'; -import 'plugins/ml/components/messagebar'; import 'plugins/ml/data_frame_analytics'; import 'plugins/ml/datavisualizer'; import 'plugins/ml/explorer'; diff --git a/x-pack/legacy/plugins/ml/public/components/data_recognizer/data_recognizer_directive.js b/x-pack/legacy/plugins/ml/public/components/data_recognizer/data_recognizer_directive.js deleted file mode 100644 index 81186fb9af812..0000000000000 --- a/x-pack/legacy/plugins/ml/public/components/data_recognizer/data_recognizer_directive.js +++ /dev/null @@ -1,17 +0,0 @@ -/* - * 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 { DataRecognizer } from './data_recognizer'; - -import { uiModules } from 'ui/modules'; -const module = uiModules.get('apps/ml', ['react']); -module.directive('mlDataRecognizer', function (reactDirective) { - return reactDirective(DataRecognizer, undefined, { restrict: 'AE' }); -}); diff --git a/x-pack/legacy/plugins/ml/public/components/data_recognizer/index.ts b/x-pack/legacy/plugins/ml/public/components/data_recognizer/index.ts index bb5a2ac4e479f..cc66fdac85af7 100644 --- a/x-pack/legacy/plugins/ml/public/components/data_recognizer/index.ts +++ b/x-pack/legacy/plugins/ml/public/components/data_recognizer/index.ts @@ -4,6 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import './data_recognizer_directive'; - export { DataRecognizer } from './data_recognizer'; diff --git a/x-pack/legacy/plugins/ml/public/components/field_title_bar/field_title_bar_directive.js b/x-pack/legacy/plugins/ml/public/components/field_title_bar/field_title_bar_directive.js deleted file mode 100644 index 96ea2e7e27c37..0000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_title_bar/field_title_bar_directive.js +++ /dev/null @@ -1,44 +0,0 @@ -/* - * 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 ReactDOM from 'react-dom'; - -import { FieldTitleBar } from './field_title_bar'; -import { I18nContext } from 'ui/i18n'; - -import { uiModules } from 'ui/modules'; -const module = uiModules.get('apps/ml'); - -module.directive('mlFieldTitleBar', function () { - return { - restrict: 'E', - replace: false, - scope: { - card: '=' - }, - link: function (scope, element) { - scope.$watch('card', updateComponent); - - updateComponent(); - - function updateComponent() { - const props = { - card: scope.card - }; - - ReactDOM.render( - - {React.createElement(FieldTitleBar, props)} - , - element[0] - ); - } - } - }; -}); diff --git a/x-pack/legacy/plugins/ml/public/components/field_title_bar/index.js b/x-pack/legacy/plugins/ml/public/components/field_title_bar/index.js index f04b029bd7c74..e969d15d3abfa 100644 --- a/x-pack/legacy/plugins/ml/public/components/field_title_bar/index.js +++ b/x-pack/legacy/plugins/ml/public/components/field_title_bar/index.js @@ -4,8 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ - - -import './field_title_bar_directive'; - export { FieldTitleBar } from './field_title_bar'; diff --git a/x-pack/legacy/plugins/ml/public/components/field_type_icon/field_type_icon_directive.js b/x-pack/legacy/plugins/ml/public/components/field_type_icon/field_type_icon_directive.js deleted file mode 100644 index 2be9129df6f7c..0000000000000 --- a/x-pack/legacy/plugins/ml/public/components/field_type_icon/field_type_icon_directive.js +++ /dev/null @@ -1,46 +0,0 @@ -/* - * 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 ReactDOM from 'react-dom'; - -import { FieldTypeIcon } from './field_type_icon.js'; -import { I18nContext } from 'ui/i18n'; - -import { uiModules } from 'ui/modules'; -const module = uiModules.get('apps/ml'); - -module.directive('mlFieldTypeIcon', function () { - return { - restrict: 'E', - replace: false, - scope: { - tooltipEnabled: '=', - type: '=' - }, - link: function (scope, element) { - scope.$watch('type', updateComponent); - - updateComponent(); - - function updateComponent() { - const props = { - tooltipEnabled: scope.tooltipEnabled, - type: scope.type - }; - - ReactDOM.render( - - {React.createElement(FieldTypeIcon, props)} - , - element[0] - ); - } - } - }; -}); diff --git a/x-pack/legacy/plugins/ml/public/components/field_type_icon/index.js b/x-pack/legacy/plugins/ml/public/components/field_type_icon/index.js index 93f2f659b52d5..c9c8fc3e5e751 100644 --- a/x-pack/legacy/plugins/ml/public/components/field_type_icon/index.js +++ b/x-pack/legacy/plugins/ml/public/components/field_type_icon/index.js @@ -5,7 +5,4 @@ */ - -import './field_type_icon_directive'; - export { FieldTypeIcon } from './field_type_icon'; diff --git a/x-pack/legacy/plugins/ml/public/components/full_time_range_selector/full_time_range_selector_directive.js b/x-pack/legacy/plugins/ml/public/components/full_time_range_selector/full_time_range_selector_directive.js deleted file mode 100644 index 5c78d376317ac..0000000000000 --- a/x-pack/legacy/plugins/ml/public/components/full_time_range_selector/full_time_range_selector_directive.js +++ /dev/null @@ -1,58 +0,0 @@ -/* - * 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 ReactDOM from 'react-dom'; - -import { uiModules } from 'ui/modules'; -const module = uiModules.get('apps/ml', ['react']); - -import { I18nContext } from 'ui/i18n'; - -import { FullTimeRangeSelector } from './index'; - -// Angular directive wrapper for the 'Use full time range' button. -module.directive('mlFullTimeRangeSelector', function () { - return { - restrict: 'E', - replace: true, - scope: { - indexPattern: '=', - disabled: '=', - query: '=' - }, - link: (scope, element) => { - - function renderComponent() { - const props = { - indexPattern: scope.indexPattern, - query: scope.query, - disabled: scope.disabled - }; - - ReactDOM.render( - - {React.createElement(FullTimeRangeSelector, props)} - , - element[0] - ); - } - - renderComponent(); - - // As the directive is only used in the job wizards and the data visualizer, - // it is safe to only watch the disabled property. - scope.$watch('disabled', renderComponent); - - element.on('$destroy', () => { - scope.$destroy(); - }); - - } - - }; -}); diff --git a/x-pack/legacy/plugins/ml/public/components/messagebar/__tests__/messagebar.js b/x-pack/legacy/plugins/ml/public/components/messagebar/__tests__/messagebar.js deleted file mode 100644 index 5cbcdd9b8afc2..0000000000000 --- a/x-pack/legacy/plugins/ml/public/components/messagebar/__tests__/messagebar.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 ngMock from 'ng_mock'; -import expect from '@kbn/expect'; - -describe('ML - Message Bar Controller', () => { - beforeEach(() => { - ngMock.module('kibana'); - }); - - it('Initialize Message Bar Controller', (done) => { - ngMock.inject(function ($rootScope, $controller) { - const scope = $rootScope.$new(); - - expect(() => { - $controller('MlMessageBarController', { $scope: scope }); - }).to.not.throwError(); - - expect(scope.messages).to.eql([]); - done(); - }); - }); -}); diff --git a/x-pack/legacy/plugins/ml/public/components/messagebar/_index.scss b/x-pack/legacy/plugins/ml/public/components/messagebar/_index.scss deleted file mode 100644 index 55e87d2640465..0000000000000 --- a/x-pack/legacy/plugins/ml/public/components/messagebar/_index.scss +++ /dev/null @@ -1 +0,0 @@ -@import 'messagebar'; \ No newline at end of file diff --git a/x-pack/legacy/plugins/ml/public/components/messagebar/_messagebar.scss b/x-pack/legacy/plugins/ml/public/components/messagebar/_messagebar.scss deleted file mode 100644 index a4d48ff64ad6b..0000000000000 --- a/x-pack/legacy/plugins/ml/public/components/messagebar/_messagebar.scss +++ /dev/null @@ -1,35 +0,0 @@ - -ml-message-bar { - font-size: $euiFontSizeS; - - // SASSTODO: Needs proper selector - div { - padding: $euiSizeXS; - } - - .ml-message { - border-bottom: 1px solid $euiColorEmptyShade; - color: $euiColorEmptyShade; - margin: 0px; - border-radius: $euiBorderRadius; - padding: $euiSizeXS $euiSizeS; - - // SASSTODO: Needs proper selector - a { - color: $euiColorEmptyShade; - float: right; - } - } - - // SASSTODO: Needs proper variables - .ml-message-info { - background-color: #858585; - } - .ml-message-warning { - background-color: #FF7800; - } - .ml-message-error { - background-color: #e74c3c; - } - -} diff --git a/x-pack/legacy/plugins/ml/public/components/validate_job/index.js b/x-pack/legacy/plugins/ml/public/components/messagebar/index.ts similarity index 80% rename from x-pack/legacy/plugins/ml/public/components/validate_job/index.js rename to x-pack/legacy/plugins/ml/public/components/messagebar/index.ts index 07e6725e33518..35130d28a890d 100644 --- a/x-pack/legacy/plugins/ml/public/components/validate_job/index.js +++ b/x-pack/legacy/plugins/ml/public/components/messagebar/index.ts @@ -4,6 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ - - -import './validate_job_directive'; +export { mlMessageBarService } from './messagebar_service'; diff --git a/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar.html b/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar.html deleted file mode 100644 index ef06d3e4c48fe..0000000000000 --- a/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar.html +++ /dev/null @@ -1,7 +0,0 @@ -
-
- {{msg.text}} x -
-
\ No newline at end of file diff --git a/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar.js b/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar.js deleted file mode 100644 index 293b0bc507b29..0000000000000 --- a/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 template from './messagebar.html'; - -import { mlMessageBarService } from 'plugins/ml/components/messagebar/messagebar_service'; - -import { uiModules } from 'ui/modules'; -const module = uiModules.get('apps/ml'); - -module - .controller('MlMessageBarController', function ($scope) { - $scope.messages = mlMessageBarService.getMessages(); - $scope.removeMessage = mlMessageBarService.removeMessage; - }) - .directive('mlMessageBar', function () { - return { - restrict: 'AE', - template - }; - }); diff --git a/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.d.ts b/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.d.ts index 747ee928ac0c1..29a537a7ca8d8 100644 --- a/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.d.ts +++ b/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.d.ts @@ -5,13 +5,6 @@ */ declare interface MlMessageBarService { - getMessages(): any[]; - addMessage(msg: any): void; - removeMessage(index: number): void; - clear(): void; - info(text: any): void; - warning(text: any): void; - error(text: any, resp?: any): void; notify: { error(text: any, resp?: any): void; }; diff --git a/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.js b/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.js index 79412c1d2d72f..a373ed71772f0 100644 --- a/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.js +++ b/x-pack/legacy/plugins/ml/public/components/messagebar/messagebar_service.js @@ -9,57 +9,6 @@ import { toastNotifications } from 'ui/notify'; import { MLRequestFailure } from '../../util/ml_error'; import { i18n } from '@kbn/i18n'; -const messages = []; - - -const MSG_STYLE = { INFO: 'ml-message-info', WARNING: 'ml-message-warning', ERROR: 'ml-message-error' }; - -function getMessages() { - return messages; -} - -function addMessage(msg) { - if (messages.find(m => (m.text === msg.text && m.style === msg.style)) === undefined) { - messages.push(msg); - } -} - -function removeMessage(index) { - messages.splice(index, 1); -} - -function clear() { - messages.length = 0; -} - -function info(text) { - addMessage({ text, style: MSG_STYLE.INFO }); -} - -function warning(text) { - addMessage({ text, style: MSG_STYLE.WARNING }); -} - -function error(text, resp) { - text = `${text} ${expandErrorMessageObj(resp)}`; - addMessage({ text, style: MSG_STYLE.ERROR }); -} - -function expandErrorMessageObj(resp) { - let txt = ''; - if (resp !== undefined && typeof resp === 'object') { - try { - const respObj = JSON.parse(resp.response); - if (typeof respObj === 'object' && respObj.error !== undefined) { - txt = respObj.error.reason; - } - } catch(e) { - txt = resp.message; - } - } - return txt; -} - function errorNotify(text, resp) { let err = null; if (typeof text === 'object' && text.response !== undefined) { @@ -78,13 +27,6 @@ function errorNotify(text, resp) { } export const mlMessageBarService = { - getMessages, - addMessage, - removeMessage, - clear, - info, - warning, - error, notify: { error: errorNotify } diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/index.ts b/x-pack/legacy/plugins/ml/public/components/navigation_menu/index.ts index 55fe88ec90869..60baa8a9559e9 100644 --- a/x-pack/legacy/plugins/ml/public/components/navigation_menu/index.ts +++ b/x-pack/legacy/plugins/ml/public/components/navigation_menu/index.ts @@ -4,4 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import './navigation_menu_react_wrapper_directive'; +export { NavigationMenu } from './navigation_menu'; diff --git a/x-pack/legacy/plugins/ml/public/components/navigation_menu/navigation_menu_react_wrapper_directive.js b/x-pack/legacy/plugins/ml/public/components/navigation_menu/navigation_menu_react_wrapper_directive.js deleted file mode 100644 index 543f04b6a4125..0000000000000 --- a/x-pack/legacy/plugins/ml/public/components/navigation_menu/navigation_menu_react_wrapper_directive.js +++ /dev/null @@ -1,29 +0,0 @@ -/* - * 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 ReactDOM from 'react-dom'; - -import { uiModules } from 'ui/modules'; -const module = uiModules.get('apps/ml'); - -import { NavigationMenu } from './navigation_menu'; - -module.directive('mlNavMenu', function () { - return { - restrict: 'E', - transclude: true, - link: function (scope, element, attrs) { - ReactDOM.render(, element[0]); - - element.on('$destroy', () => { - ReactDOM.unmountComponentAtNode(element[0]); - scope.$destroy(); - }); - } - }; -}); diff --git a/x-pack/legacy/plugins/ml/public/components/messagebar/index.js b/x-pack/legacy/plugins/ml/public/components/validate_job/index.ts similarity index 82% rename from x-pack/legacy/plugins/ml/public/components/messagebar/index.js rename to x-pack/legacy/plugins/ml/public/components/validate_job/index.ts index 6dc4892b37a2b..fed452502cc89 100644 --- a/x-pack/legacy/plugins/ml/public/components/messagebar/index.js +++ b/x-pack/legacy/plugins/ml/public/components/validate_job/index.ts @@ -4,4 +4,4 @@ * you may not use this file except in compliance with the Elastic License. */ -import './messagebar'; +export { ValidateJob } from './validate_job_view'; diff --git a/x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_directive.js b/x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_directive.js deleted file mode 100644 index 29455f3949157..0000000000000 --- a/x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_directive.js +++ /dev/null @@ -1,26 +0,0 @@ -/* - * 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 { wrapInI18nContext } from 'ui/i18n'; -import { uiModules } from 'ui/modules'; -const module = uiModules.get('apps/ml', ['react']); - -import { ValidateJob } from './validate_job_view'; -import { mlJobService } from 'plugins/ml/services/job_service'; - -module.directive('mlValidateJob', function (reactDirective) { - return reactDirective( - wrapInI18nContext(ValidateJob), - undefined, - { restrict: 'E' }, - { mlJobService } - ); -}); diff --git a/x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_view.js b/x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_view.js index 88e85cc5e530f..42ade2d9f9360 100644 --- a/x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_view.js +++ b/x-pack/legacy/plugins/ml/public/components/validate_job/validate_job_view.js @@ -167,7 +167,7 @@ Modal.propType = { title: PropTypes.string }; -class ValidateJob extends Component { +export class ValidateJob extends Component { constructor(props) { super(props); this.state = getDefaultState(); @@ -329,5 +329,3 @@ ValidateJob.propTypes = { setIsValid: PropTypes.func, idFilterList: PropTypes.array, }; - -export { ValidateJob }; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/page.tsx b/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/page.tsx index ad12404419133..0bbc313704174 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/page.tsx +++ b/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_exploration/page.tsx @@ -20,7 +20,7 @@ import { EuiTitle, } from '@elastic/eui'; -import { NavigationMenu } from '../../../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../../../components/navigation_menu'; import { Exploration } from './components/exploration'; import { RegressionExploration } from './components/regression_exploration'; diff --git a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/page.tsx b/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/page.tsx index c846a196dafab..fcff4aa06b6bb 100644 --- a/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/page.tsx +++ b/x-pack/legacy/plugins/ml/public/data_frame_analytics/pages/analytics_management/page.tsx @@ -23,7 +23,7 @@ import { EuiTitle, } from '@elastic/eui'; -import { NavigationMenu } from '../../../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../../../components/navigation_menu'; import { CreateAnalyticsButton } from './components/create_analytics_button'; import { DataFrameAnalyticsList } from './components/analytics_list'; import { RefreshAnalyticsListButton } from './components/refresh_analytics_list_button'; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/datavisualizer_selector.js b/x-pack/legacy/plugins/ml/public/datavisualizer/datavisualizer_selector.js index 65cc2533ed4fb..3bd825aee15ef 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/datavisualizer_selector.js +++ b/x-pack/legacy/plugins/ml/public/datavisualizer/datavisualizer_selector.js @@ -24,7 +24,7 @@ import { isFullLicense } from '../license/check_license'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; import { timefilter } from 'ui/timefilter'; -import { NavigationMenu } from '../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../components/navigation_menu'; function startTrialDescription() { return ( diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/file_datavisualizer.js b/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/file_datavisualizer.js index 241d80a2fcb0b..588c0b1ac2843 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/file_datavisualizer.js +++ b/x-pack/legacy/plugins/ml/public/datavisualizer/file_based/file_datavisualizer.js @@ -8,7 +8,7 @@ import React, { Fragment } from 'react'; import { timefilter } from 'ui/timefilter'; -import { NavigationMenu } from '../../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../../components/navigation_menu'; import { FileDataVisualizerView } from './components/file_datavisualizer_view'; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/page.tsx b/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/page.tsx index e9ee556caaa1c..9123858eef4e5 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/page.tsx +++ b/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/page.tsx @@ -26,6 +26,7 @@ import { EuiTitle, } from '@elastic/eui'; +import { NavigationMenu } from '../../components/navigation_menu'; import { KBN_FIELD_TYPES } from '../../../../../../../src/plugins/data/public'; import { ML_JOB_FIELD_TYPES } from '../../../common/constants/field_types'; import { SEARCH_QUERY_LANGUAGE } from '../../../common/constants/search'; @@ -591,87 +592,90 @@ export const Page: FC = () => { } return ( - - - - - -

{currentIndexPattern.title}

-
-
- {currentIndexPattern.timeFieldName !== undefined && ( - - + + + + + + + +

{currentIndexPattern.title}

+
- )} -
- - - - - - - - - {totalMetricFieldCount > 0 && ( - - - - - )} - - - - - {showActionsPanel === true && ( - - - + {currentIndexPattern.timeFieldName !== undefined && ( + + + )} - - -
-
+
+ + + + + + + + + {totalMetricFieldCount > 0 && ( + + + + + )} + + + + + {showActionsPanel === true && ( + + + + )} + + +
+
+ ); }; diff --git a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/route.ts b/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/route.ts index ff08591ac24d0..66edcbd945f77 100644 --- a/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/route.ts +++ b/x-pack/legacy/plugins/ml/public/datavisualizer/index_based/route.ts @@ -15,7 +15,7 @@ import { loadCurrentIndexPattern, loadCurrentSavedSearch } from '../../util/inde import { checkMlNodesAvailable } from '../../ml_nodes_check'; import { getDataVisualizerBreadcrumbs } from './breadcrumbs'; -const template = ``; +const template = ``; uiRoutes.when('/jobs/new_job/datavisualizer', { template, diff --git a/x-pack/legacy/plugins/ml/public/explorer/explorer.js b/x-pack/legacy/plugins/ml/public/explorer/explorer.js index 70a5c9c505acc..c9a2de3969280 100644 --- a/x-pack/legacy/plugins/ml/public/explorer/explorer.js +++ b/x-pack/legacy/plugins/ml/public/explorer/explorer.js @@ -43,7 +43,7 @@ import { InfluencersList } from '../components/influencers_list'; import { ALLOW_CELL_RANGE_SELECTION, dragSelect$, explorer$ } from './explorer_dashboard_service'; import { mlResultsService } from 'plugins/ml/services/results_service'; import { LoadingIndicator } from '../components/loading_indicator/loading_indicator'; -import { NavigationMenu } from '../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../components/navigation_menu'; import { CheckboxShowCharts, showCharts$ } from '../components/controls/checkbox_showcharts'; import { JobSelector } from '../components/job_selector'; import { SelectInterval, interval$ } from '../components/controls/select_interval/select_interval'; diff --git a/x-pack/legacy/plugins/ml/public/index.scss b/x-pack/legacy/plugins/ml/public/index.scss index af616ff54222f..97f0e037e2648 100644 --- a/x-pack/legacy/plugins/ml/public/index.scss +++ b/x-pack/legacy/plugins/ml/public/index.scss @@ -41,7 +41,6 @@ @import 'components/items_grid/index'; @import 'components/job_selector/index'; @import 'components/loading_indicator/index'; // SASSTODO: This component should be replaced with EuiLoadingSpinner - @import 'components/messagebar/index'; @import 'components/navigation_menu/index'; @import 'components/rule_editor/index'; // SASSTODO: This file overwrites EUI directly @import 'components/stats_bar/index'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js index 56b59eb949ee8..acc5a469204f9 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js +++ b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/edit_job_flyout/edit_job_flyout.js @@ -26,7 +26,7 @@ import { JobDetails, Detectors, Datafeed, CustomUrls } from './tabs'; import { saveJob } from './edit_utils'; import { loadFullJob } from '../utils'; import { validateModelMemoryLimit, validateGroupNames, isValidCustomUrls } from '../validate_job'; -import { mlMessageBarService } from '../../../../components/messagebar/messagebar_service'; +import { mlMessageBarService } from '../../../../components/messagebar'; import { toastNotifications } from 'ui/notify'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_selector.js b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_selector.js index dea9c27e1a90e..d104d2e02d07b 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_selector.js +++ b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/multi_job_actions/group_selector/group_selector.js @@ -28,7 +28,7 @@ import { cloneDeep } from 'lodash'; import { ml } from '../../../../../services/ml_api_service'; import { GroupList } from './group_list'; import { NewGroupInput } from './new_group_input'; -import { mlMessageBarService } from '../../../../../components/messagebar/messagebar_service'; +import { mlMessageBarService } from '../../../../../components/messagebar'; import { FormattedMessage, injectI18n } from '@kbn/i18n/react'; function createSelectedGroups(jobs, groups) { diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/utils.js b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/utils.js index 484b7ad18f586..3344d2d4ad4a5 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/utils.js +++ b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/components/utils.js @@ -6,7 +6,7 @@ import { each } from 'lodash'; import { toastNotifications } from 'ui/notify'; -import { mlMessageBarService } from 'plugins/ml/components/messagebar/messagebar_service'; +import { mlMessageBarService } from 'plugins/ml/components/messagebar'; import rison from 'rison-node'; import chrome from 'ui/chrome'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/jobs.js b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/jobs.js index 5bdf9c1944e43..188048d2d2f05 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/jobs_list/jobs.js +++ b/x-pack/legacy/plugins/ml/public/jobs/jobs_list/jobs.js @@ -6,7 +6,7 @@ import React, { Fragment } from 'react'; -import { NavigationMenu } from '../../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../../components/navigation_menu'; import { JobsListView } from './components/jobs_list_view'; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts index f60c9c3fb8ca8..f86baaccb84d3 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts +++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/bucket_span_estimator/estimate_bucket_span.ts @@ -15,7 +15,7 @@ import { } from '../../../../../common/job_creator'; import { ml, BucketSpanEstimatorData } from '../../../../../../../services/ml_api_service'; import { useKibanaContext } from '../../../../../../../contexts/kibana'; -import { mlMessageBarService } from '../../../../../../../components/messagebar/messagebar_service'; +import { mlMessageBarService } from '../../../../../../../components/messagebar'; export enum ESTIMATE_STATUS { NOT_RUNNING, diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx index e42bb76373e62..f913b5a5720d6 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx +++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/multi_metric_view/metric_selection.tsx @@ -15,7 +15,7 @@ import { AggFieldPair } from '../../../../../../../../common/types/fields'; import { getChartSettings, defaultChartSettings } from '../../../charts/common/settings'; import { MetricSelector } from './metric_selector'; import { ChartGrid } from './chart_grid'; -import { mlMessageBarService } from '../../../../../../../components/messagebar/messagebar_service'; +import { mlMessageBarService } from '../../../../../../../components/messagebar'; interface Props { setIsValid: (na: boolean) => void; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx index 44b8fd0255d3d..f39a316440e74 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx +++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/multi_metric_view/metric_selection_summary.tsx @@ -12,7 +12,7 @@ import { Results, ModelItem, Anomaly } from '../../../../../common/results_loade import { LineChartData } from '../../../../../common/chart_loader'; import { getChartSettings, defaultChartSettings } from '../../../charts/common/settings'; import { ChartGrid } from './chart_grid'; -import { mlMessageBarService } from '../../../../../../../components/messagebar/messagebar_service'; +import { mlMessageBarService } from '../../../../../../../components/messagebar'; export const MultiMetricDetectorsSummary: FC = () => { const { jobCreator: jc, chartLoader, resultsLoader, chartInterval } = useContext( diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/population_view/metric_selection.tsx b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/population_view/metric_selection.tsx index 00948902c0407..87d3e87d65536 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/population_view/metric_selection.tsx +++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/population_view/metric_selection.tsx @@ -17,7 +17,7 @@ import { getChartSettings, defaultChartSettings } from '../../../charts/common/s import { MetricSelector } from './metric_selector'; import { SplitFieldSelector } from '../split_field'; import { ChartGrid } from './chart_grid'; -import { mlMessageBarService } from '../../../../../../../components/messagebar/messagebar_service'; +import { mlMessageBarService } from '../../../../../../../components/messagebar'; interface Props { setIsValid: (na: boolean) => void; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx index 5b7d16e2bd7c9..b13f8e3a73a10 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx +++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/population_view/metric_selection_summary.tsx @@ -15,7 +15,7 @@ import { LineChartData } from '../../../../../common/chart_loader'; import { Field, AggFieldPair } from '../../../../../../../../common/types/fields'; import { getChartSettings, defaultChartSettings } from '../../../charts/common/settings'; import { ChartGrid } from './chart_grid'; -import { mlMessageBarService } from '../../../../../../../components/messagebar/messagebar_service'; +import { mlMessageBarService } from '../../../../../../../components/messagebar'; type DetectorFieldValues = Record; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx index 5a6e08cb2948a..45872faae4c09 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx +++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/single_metric_view/metric_selection.tsx @@ -13,7 +13,7 @@ import { newJobCapsService } from '../../../../../../../services/new_job_capabil import { AggFieldPair } from '../../../../../../../../common/types/fields'; import { AnomalyChart, CHART_TYPE } from '../../../charts/anomaly_chart'; import { getChartSettings } from '../../../charts/common/settings'; -import { mlMessageBarService } from '../../../../../../../components/messagebar/messagebar_service'; +import { mlMessageBarService } from '../../../../../../../components/messagebar'; interface Props { setIsValid: (na: boolean) => void; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx index 8124f20a33da8..85fb5890307ba 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx +++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/pick_fields_step/components/single_metric_view/metric_selection_summary.tsx @@ -11,7 +11,7 @@ import { Results, ModelItem, Anomaly } from '../../../../../common/results_loade import { LineChartData } from '../../../../../common/chart_loader'; import { AnomalyChart, CHART_TYPE } from '../../../charts/anomaly_chart'; import { getChartSettings } from '../../../charts/common/settings'; -import { mlMessageBarService } from '../../../../../../../components/messagebar/messagebar_service'; +import { mlMessageBarService } from '../../../../../../../components/messagebar'; const DTR_IDX = 0; diff --git a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/validation_step/validation.tsx b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/validation_step/validation.tsx index ac7e89ecf95b7..b60e225cdff4d 100644 --- a/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/validation_step/validation.tsx +++ b/x-pack/legacy/plugins/ml/public/jobs/new_job_new/pages/components/validation_step/validation.tsx @@ -9,7 +9,7 @@ import { WizardNav } from '../wizard_nav'; import { WIZARD_STEPS, StepProps } from '../step_types'; import { JobCreatorContext } from '../job_creator_context'; import { mlJobService } from '../../../../../services/job_service'; -import { ValidateJob } from '../../../../../components/validate_job/validate_job_view'; +import { ValidateJob } from '../../../../../components/validate_job'; import { JOB_TYPE } from '../../../common/job_creator/util/constants'; const idFilterList = [ diff --git a/x-pack/legacy/plugins/ml/public/overview/overview_page.tsx b/x-pack/legacy/plugins/ml/public/overview/overview_page.tsx index bb9e45ae84a41..39c3205d54eda 100644 --- a/x-pack/legacy/plugins/ml/public/overview/overview_page.tsx +++ b/x-pack/legacy/plugins/ml/public/overview/overview_page.tsx @@ -6,7 +6,7 @@ import React, { Fragment, FC } from 'react'; import { EuiFlexGroup, EuiPage, EuiPageBody } from '@elastic/eui'; -import { NavigationMenu } from '../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../components/navigation_menu'; import { OverviewSideBar } from './components/sidebar'; import { OverviewContent } from './components/content'; diff --git a/x-pack/legacy/plugins/ml/public/services/calendar_service.js b/x-pack/legacy/plugins/ml/public/services/calendar_service.js index 84f5bdb3c8e18..09e3001a0f7f5 100644 --- a/x-pack/legacy/plugins/ml/public/services/calendar_service.js +++ b/x-pack/legacy/plugins/ml/public/services/calendar_service.js @@ -11,7 +11,7 @@ import { i18n } from '@kbn/i18n'; import { ml } from 'plugins/ml/services/ml_api_service'; import { mlJobService } from 'plugins/ml/services/job_service'; -import { mlMessageBarService } from 'plugins/ml/components/messagebar/messagebar_service'; +import { mlMessageBarService } from 'plugins/ml/components/messagebar'; diff --git a/x-pack/legacy/plugins/ml/public/services/job_service.js b/x-pack/legacy/plugins/ml/public/services/job_service.js index 845481d41da77..bea6631a6a2c4 100644 --- a/x-pack/legacy/plugins/ml/public/services/job_service.js +++ b/x-pack/legacy/plugins/ml/public/services/job_service.js @@ -13,7 +13,7 @@ import { i18n } from '@kbn/i18n'; import { ml } from './ml_api_service'; -import { mlMessageBarService } from '../components/messagebar/messagebar_service'; +import { mlMessageBarService } from '../components/messagebar'; import { isWebUrl } from '../util/url_utils'; import { ML_DATA_PREVIEW_COUNT } from '../../common/util/job_utils'; import { parseInterval } from '../../common/util/parse_interval'; diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.js b/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.js index 1351a06c21f2c..12c8339c52d71 100644 --- a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.js +++ b/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.js @@ -21,7 +21,7 @@ import { import chrome from 'ui/chrome'; import { toastNotifications } from 'ui/notify'; -import { NavigationMenu } from '../../../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../../../components/navigation_menu'; import { getCalendarSettingsData, validateCalendarId } from './utils'; import { CalendarForm } from './calendar_form/'; diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.test.js b/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.test.js index bc2bddab7a6cb..a7547b9e43c73 100644 --- a/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.test.js +++ b/x-pack/legacy/plugins/ml/public/settings/calendars/edit/new_calendar.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -jest.mock('../../../components/navigation_menu/navigation_menu', () => ({ +jest.mock('../../../components/navigation_menu', () => ({ NavigationMenu: () =>
})); jest.mock('../../../privilege/check_privilege', () => ({ diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.js b/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.js index 0b5657b62ebf3..b7ad2c36f3b43 100644 --- a/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.js +++ b/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.js @@ -17,7 +17,7 @@ import { EUI_MODAL_CONFIRM_BUTTON, } from '@elastic/eui'; -import { NavigationMenu } from '../../../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../../../components/navigation_menu'; import { CalendarsListHeader } from './header'; import { CalendarsListTable } from './table/'; import { ml } from '../../../services/ml_api_service'; diff --git a/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.test.js b/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.test.js index 84211597f313c..d32b0ae9a4d5f 100644 --- a/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.test.js +++ b/x-pack/legacy/plugins/ml/public/settings/calendars/list/calendars_list.test.js @@ -10,7 +10,7 @@ import { ml } from '../../../services/ml_api_service'; import { CalendarsList } from './calendars_list'; -jest.mock('../../../components/navigation_menu/navigation_menu', () => ({ +jest.mock('../../../components/navigation_menu', () => ({ NavigationMenu: () =>
})); jest.mock('../../../privilege/check_privilege', () => ({ diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.js b/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.js index 2a27dd0fc9774..aed789304186e 100644 --- a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.js +++ b/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.js @@ -31,7 +31,7 @@ import { toastNotifications } from 'ui/notify'; import { EditFilterListHeader } from './header'; import { EditFilterListToolbar } from './toolbar'; import { ItemsGrid } from '../../../components/items_grid'; -import { NavigationMenu } from '../../../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../../../components/navigation_menu'; import { isValidFilterListId, saveFilterList diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.test.js b/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.test.js index 035913d5dc465..d2030a3dc944e 100644 --- a/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.test.js +++ b/x-pack/legacy/plugins/ml/public/settings/filter_lists/edit/edit_filter_list.test.js @@ -4,7 +4,7 @@ * you may not use this file except in compliance with the Elastic License. */ -jest.mock('../../../components/navigation_menu/navigation_menu', () => ({ +jest.mock('../../../components/navigation_menu', () => ({ NavigationMenu: () =>
})); diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.js b/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.js index 8ea2bb8929913..c6b177bcceaef 100644 --- a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.js +++ b/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.js @@ -21,7 +21,7 @@ import { injectI18n } from '@kbn/i18n/react'; import { toastNotifications } from 'ui/notify'; -import { NavigationMenu } from '../../../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../../../components/navigation_menu'; import { FilterListsHeader } from './header'; import { FilterListsTable } from './table'; diff --git a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.test.js b/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.test.js index 3c6a564ec92b4..ddf832565a8be 100644 --- a/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.test.js +++ b/x-pack/legacy/plugins/ml/public/settings/filter_lists/list/filter_lists.test.js @@ -9,7 +9,7 @@ import React from 'react'; import { FilterLists } from './filter_lists'; -jest.mock('../../../components/navigation_menu/navigation_menu', () => ({ +jest.mock('../../../components/navigation_menu', () => ({ NavigationMenu: () =>
})); jest.mock('../../../privilege/check_privilege', () => ({ diff --git a/x-pack/legacy/plugins/ml/public/settings/settings.js b/x-pack/legacy/plugins/ml/public/settings/settings.js index e8d2533af7f4b..f04283563797f 100644 --- a/x-pack/legacy/plugins/ml/public/settings/settings.js +++ b/x-pack/legacy/plugins/ml/public/settings/settings.js @@ -23,7 +23,7 @@ import { import { FormattedMessage } from '@kbn/i18n/react'; import { useUiChromeContext } from '../contexts/ui/use_ui_chrome_context'; -import { NavigationMenu } from '../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../components/navigation_menu'; export function Settings({ canGetFilters, diff --git a/x-pack/legacy/plugins/ml/public/settings/settings.test.js b/x-pack/legacy/plugins/ml/public/settings/settings.test.js index 0fe0a4ab50be4..8efe558fda961 100644 --- a/x-pack/legacy/plugins/ml/public/settings/settings.test.js +++ b/x-pack/legacy/plugins/ml/public/settings/settings.test.js @@ -10,7 +10,7 @@ import React from 'react'; import { Settings } from './settings'; jest.mock('../contexts/ui/use_ui_chrome_context'); -jest.mock('../components/navigation_menu/navigation_menu', () => ({ +jest.mock('../components/navigation_menu', () => ({ NavigationMenu: () =>
, })); diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/forecasting_modal_directive.js b/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/forecasting_modal_directive.js deleted file mode 100644 index cf101256724e9..0000000000000 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/components/forecasting_modal/forecasting_modal_directive.js +++ /dev/null @@ -1,27 +0,0 @@ -/* - * 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 { wrapInI18nContext } from 'ui/i18n'; -import { timefilter } from 'ui/timefilter'; -import { uiModules } from 'ui/modules'; -const module = uiModules.get('apps/ml', ['react']); - -import { ForecastingModal } from './forecasting_modal'; - -module.directive('mlForecastingModal', function ($injector) { - const reactDirective = $injector.get('reactDirective'); - return reactDirective( - wrapInI18nContext(ForecastingModal), - // reactDirective service requires for react component to have propTypes, but injectI18n doesn't copy propTypes from wrapped component. - // That's why we pass propTypes directly to reactDirective service. - Object.keys(ForecastingModal.WrappedComponent.propTypes || {}), - { restrict: 'E' }, - { timefilter } - ); -}); diff --git a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.js b/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.js index 5afb5ae64385d..cea2dc37bfad3 100644 --- a/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.js +++ b/x-pack/legacy/plugins/ml/public/timeseriesexplorer/timeseriesexplorer.js @@ -51,7 +51,7 @@ import { EntityControl } from './components/entity_control'; import { ForecastingModal } from './components/forecasting_modal/forecasting_modal'; import { JobSelector } from '../components/job_selector'; import { LoadingIndicator } from '../components/loading_indicator/loading_indicator'; -import { NavigationMenu } from '../components/navigation_menu/navigation_menu'; +import { NavigationMenu } from '../components/navigation_menu'; import { severity$, SelectSeverity } from '../components/controls/select_severity/select_severity'; import { interval$, SelectInterval } from '../components/controls/select_interval/select_interval'; import { TimeseriesChart } from './components/timeseries_chart/timeseries_chart'; diff --git a/x-pack/plugins/translations/translations/ja-JP.json b/x-pack/plugins/translations/translations/ja-JP.json index 3919a864b8d69..bb26a1cf2b1ed 100644 --- a/x-pack/plugins/translations/translations/ja-JP.json +++ b/x-pack/plugins/translations/translations/ja-JP.json @@ -5774,10 +5774,6 @@ "xpack.maps.tooltip.toolsControl.cancelDrawButtonLabel": "キャンセル", "xpack.maps.xyztmssource.attributionLink": "属性テキストにはリンクが必要です", "xpack.maps.xyztmssource.attributionText": "属性 URL にはテキストが必要です", - "xpack.ml.accessDenied.backToKibanaHomeButtonLabel": "Kibana ホームに戻る", - "xpack.ml.accessDenied.noGrantedPrivilegesDescription": "{kibanaUserParam} と {machineLearningUserParam} ロールの権限が必要です。{br}これらのロールはシステム管理者がユーザー管理ページで設定します。", - "xpack.ml.accessDenied.noPermissionToAccessMLLabel": "機械学習へのアクセスにはパーミッションが必要です", - "xpack.ml.accessDenied.retryButtonLabel": "再試行", "xpack.ml.annotationsTable.actionsColumnName": "アクション", "xpack.ml.annotationsTable.annotationColumnName": "注釈", "xpack.ml.annotationsTable.annotationsNotCreatedTitle": "このジョブには注釈が作成されていません", diff --git a/x-pack/plugins/translations/translations/zh-CN.json b/x-pack/plugins/translations/translations/zh-CN.json index f53a630b7d135..7854d7b37ef9a 100644 --- a/x-pack/plugins/translations/translations/zh-CN.json +++ b/x-pack/plugins/translations/translations/zh-CN.json @@ -5776,10 +5776,6 @@ "xpack.maps.tooltip.toolsControl.cancelDrawButtonLabel": "取消", "xpack.maps.xyztmssource.attributionLink": "属性文本必须附带链接", "xpack.maps.xyztmssource.attributionText": "属性 url 必须附带文本", - "xpack.ml.accessDenied.backToKibanaHomeButtonLabel": "返回 Kibana 主页", - "xpack.ml.accessDenied.noGrantedPrivilegesDescription": "您必须具有 {kibanaUserParam} 和 {machineLearningUserParam} 角色授予的权限。{br}您的系统管理员可以在“管理用户”页面上设置这些角色。", - "xpack.ml.accessDenied.noPermissionToAccessMLLabel": "您需要具备访问 Machine Learning 的权限", - "xpack.ml.accessDenied.retryButtonLabel": "重试", "xpack.ml.annotationsTable.actionsColumnName": "操作", "xpack.ml.annotationsTable.annotationColumnName": "注释", "xpack.ml.annotationsTable.annotationsNotCreatedTitle": "没有为此作业创建注释",