[ML] Removing old angular directives (#48382) (#48403)

* [ML] Removing old angular directives

* reverts small change

* typescriptifying access denied page

* changing access denied text

* updating translations
This commit is contained in:
James Gowdy 2019-10-16 17:28:06 +01:00 committed by GitHub
parent 9b5b8c0d85
commit 36cfa967b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
62 changed files with 222 additions and 620 deletions

View file

@ -1,46 +0,0 @@
<ml-nav-menu name="access-denied" />
<div class="col-md-12">
<div class="euiSpacer euiSpacer--m"></div>
<div class="euiCallOut euiCallOut--danger">
<div class="euiCallOutHeader">
<svg class="euiIcon euiIcon--medium euiCallOutHeader__icon" aria-hidden="true" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink"
width="16" height="16" viewBox="0 0 16 16">
<defs>
<path id="cross-a" d="M7.293 8l-4.147 4.146a.5.5 0 0 0 .708.708L8 8.707l4.146 4.147a.5.5 0 0 0 .708-.708L8.707 8l4.147-4.146a.5.5 0 0 0-.708-.708L8 7.293 3.854 3.146a.5.5 0 1 0-.708.708L7.293 8z"></path>
</defs>
<use fill-rule="nonzero" xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="#cross-a"></use>
</svg>
<span
class="euiCallOutHeader__title"
i18n-id="xpack.ml.accessDenied.noPermissionToAccessMLLabel"
i18n-default-message="You need permission to access Machine Learning"
></span>
</div>
<div class="euiText euiText--small">
<p
i18n-id="xpack.ml.accessDenied.noGrantedPrivilegesDescription"
i18n-default-message="You must have the privileges granted in the {kibanaUserParam} and {machineLearningUserParam} roles.{br}Your system admin can set these roles on the Management User page."
i18n-values="{
html_kibanaUserParam: '<span class=\'text-monospace\'>kibana_user</span>',
html_machineLearningUserParam: '<span class=\'text-monospace\'>machine_learning_user</span>',
html_br: '<br />',
}"
></p>
</div>
</div>
<div style='margin-top:20px;'>
<button
ng-click="accessDenied.goToKibana();"
class="kuiButton kuiButton--primary"
i18n-id="xpack.ml.accessDenied.backToKibanaHomeButtonLabel"
i18n-default-message="Back to Kibana home"
></button>
<button
ng-click="accessDenied.retry();"
class="kuiButton kuiButton--basic"
i18n-id="xpack.ml.accessDenied.retryButtonLabel"
i18n-default-message="Retry"
></button>
</div>
</div>

View file

@ -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');
};
}
});

View file

@ -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 = `<access-denied />`;
uiRoutes.when('/access-denied', {
template,
});
module.directive('accessDenied', function() {
return {
scope: {},
restrict: 'E',
link: async (scope: ng.IScope, element: ng.IAugmentedJQuery) => {
ReactDOM.render(
<I18nContext>{React.createElement(AccessDeniedPage)}</I18nContext>,
element[0]
);
element.on('$destroy', () => {
ReactDOM.unmountComponentAtNode(element[0]);
scope.$destroy();
});
},
};
});

View file

@ -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 = () => (
<Fragment>
<NavigationMenu tabId="access-denied" />
<EuiPage>
<EuiPageBody>
<EuiPageContentHeader>
<EuiPageContentHeaderSection>
<EuiTitle>
<h1>
<FormattedMessage
id="xpack.ml.management.jobsList.accessDeniedTitle"
defaultMessage="Access denied"
/>
</h1>
</EuiTitle>
</EuiPageContentHeaderSection>
</EuiPageContentHeader>
<EuiPageContentBody>
<EuiSpacer size="m" />
<EuiCallOut
title={i18n.translate('xpack.ml.accessDenied.label', {
defaultMessage: 'Insufficient permissions',
})}
color="danger"
iconType="cross"
>
<EuiText size="s">
<p>
<FormattedMessage
id="xpack.ml.accessDenied.description"
defaultMessage="You dont have permission to access the ML plugin"
/>
</p>
</EuiText>
</EuiCallOut>
</EuiPageContentBody>
</EuiPageBody>
</EuiPage>
</Fragment>
);

View file

@ -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';

View file

@ -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' });
});

View file

@ -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';

View file

@ -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(
<I18nContext>
{React.createElement(FieldTitleBar, props)}
</I18nContext>,
element[0]
);
}
}
};
});

View file

@ -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';

View file

@ -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(
<I18nContext>
{React.createElement(FieldTypeIcon, props)}
</I18nContext>,
element[0]
);
}
}
};
});

View file

@ -5,7 +5,4 @@
*/
import './field_type_icon_directive';
export { FieldTypeIcon } from './field_type_icon';

View file

@ -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(
<I18nContext>
{React.createElement(FullTimeRangeSelector, props)}
</I18nContext>,
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();
});
}
};
});

View file

@ -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();
});
});
});

View file

@ -1 +0,0 @@
@import 'messagebar';

View file

@ -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;
}
}

View file

@ -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';

View file

@ -1,7 +0,0 @@
<div ng-controller="MlMessageBarController">
<div
ng-repeat="msg in messages"
class='ml-message {{msg.style}}'>
{{msg.text}} <a ng-click="removeMessage($index)">x</a>
</div>
</div>

View file

@ -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
};
});

View file

@ -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;
};

View file

@ -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
}

View file

@ -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';

View file

@ -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(<NavigationMenu tabId={attrs.name} />, element[0]);
element.on('$destroy', () => {
ReactDOM.unmountComponentAtNode(element[0]);
scope.$destroy();
});
}
};
});

View file

@ -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';

View file

@ -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 }
);
});

View file

@ -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 };

View file

@ -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';

View file

@ -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';

View file

@ -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 (

View file

@ -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';

View file

@ -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 (
<EuiPage data-test-subj="mlPageDataVisualizer">
<EuiPageBody>
<EuiPageContentHeader>
<EuiPageContentHeaderSection>
<EuiTitle size="l">
<h1>{currentIndexPattern.title}</h1>
</EuiTitle>
</EuiPageContentHeaderSection>
{currentIndexPattern.timeFieldName !== undefined && (
<EuiPageContentHeaderSection data-test-subj="mlDataVisualizerTimeRangeSelectorSection">
<FullTimeRangeSelector
indexPattern={currentIndexPattern}
query={combinedQuery}
disabled={false}
/>
<Fragment>
<NavigationMenu tabId="datavisualizer" />
<EuiPage data-test-subj="mlPageDataVisualizer">
<EuiPageBody>
<EuiPageContentHeader>
<EuiPageContentHeaderSection>
<EuiTitle size="l">
<h1>{currentIndexPattern.title}</h1>
</EuiTitle>
</EuiPageContentHeaderSection>
)}
</EuiPageContentHeader>
<EuiSpacer size="m" />
<EuiPageContentBody>
<EuiFlexGroup gutterSize="m">
<EuiFlexItem>
<SearchPanel
indexPattern={currentIndexPattern}
searchString={searchString}
setSearchString={setSearchString}
searchQuery={searchQuery}
setSearchQuery={setSearchQuery}
searchQueryLanguage={searchQueryLanguage}
samplerShardSize={samplerShardSize}
setSamplerShardSize={setSamplerShardSize}
totalCount={overallStats.totalCount}
/>
<EuiSpacer size="m" />
<EuiFlexGroup gutterSize="m">
<EuiFlexItem>
{totalMetricFieldCount > 0 && (
<Fragment>
<FieldsPanel
title={i18n.translate('xpack.ml.datavisualizer.page.metricsPanelTitle', {
defaultMessage: 'Metrics',
})}
totalFieldCount={totalMetricFieldCount}
populatedFieldCount={populatedMetricFieldCount}
fieldTypes={[ML_JOB_FIELD_TYPES.NUMBER]}
showFieldType={ML_JOB_FIELD_TYPES.NUMBER}
showAllFields={showAllMetrics}
setShowAllFields={setShowAllMetrics}
fieldSearchBarQuery={metricFieldQuery}
setFieldSearchBarQuery={setMetricFieldQuery}
fieldVisConfigs={metricConfigs}
/>
<EuiSpacer size="m" />
</Fragment>
)}
<FieldsPanel
title={i18n.translate('xpack.ml.datavisualizer.page.fieldsPanelTitle', {
defaultMessage: 'Fields',
})}
totalFieldCount={totalNonMetricFieldCount}
populatedFieldCount={populatedNonMetricFieldCount}
showAllFields={showAllNonMetrics}
setShowAllFields={setShowAllNonMetrics}
fieldTypes={indexedFieldTypes}
showFieldType={nonMetricShowFieldType}
setShowFieldType={setNonMetricShowFieldType}
fieldSearchBarQuery={nonMetricFieldQuery}
setFieldSearchBarQuery={setNonMetricFieldQuery}
fieldVisConfigs={nonMetricConfigs}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
{showActionsPanel === true && (
<EuiFlexItem grow={false} style={{ width: '280px' }}>
<ActionsPanel indexPattern={currentIndexPattern} />
</EuiFlexItem>
{currentIndexPattern.timeFieldName !== undefined && (
<EuiPageContentHeaderSection data-test-subj="mlDataVisualizerTimeRangeSelectorSection">
<FullTimeRangeSelector
indexPattern={currentIndexPattern}
query={combinedQuery}
disabled={false}
/>
</EuiPageContentHeaderSection>
)}
</EuiFlexGroup>
</EuiPageContentBody>
</EuiPageBody>
</EuiPage>
</EuiPageContentHeader>
<EuiSpacer size="m" />
<EuiPageContentBody>
<EuiFlexGroup gutterSize="m">
<EuiFlexItem>
<SearchPanel
indexPattern={currentIndexPattern}
searchString={searchString}
setSearchString={setSearchString}
searchQuery={searchQuery}
setSearchQuery={setSearchQuery}
searchQueryLanguage={searchQueryLanguage}
samplerShardSize={samplerShardSize}
setSamplerShardSize={setSamplerShardSize}
totalCount={overallStats.totalCount}
/>
<EuiSpacer size="m" />
<EuiFlexGroup gutterSize="m">
<EuiFlexItem>
{totalMetricFieldCount > 0 && (
<Fragment>
<FieldsPanel
title={i18n.translate('xpack.ml.datavisualizer.page.metricsPanelTitle', {
defaultMessage: 'Metrics',
})}
totalFieldCount={totalMetricFieldCount}
populatedFieldCount={populatedMetricFieldCount}
fieldTypes={[ML_JOB_FIELD_TYPES.NUMBER]}
showFieldType={ML_JOB_FIELD_TYPES.NUMBER}
showAllFields={showAllMetrics}
setShowAllFields={setShowAllMetrics}
fieldSearchBarQuery={metricFieldQuery}
setFieldSearchBarQuery={setMetricFieldQuery}
fieldVisConfigs={metricConfigs}
/>
<EuiSpacer size="m" />
</Fragment>
)}
<FieldsPanel
title={i18n.translate('xpack.ml.datavisualizer.page.fieldsPanelTitle', {
defaultMessage: 'Fields',
})}
totalFieldCount={totalNonMetricFieldCount}
populatedFieldCount={populatedNonMetricFieldCount}
showAllFields={showAllNonMetrics}
setShowAllFields={setShowAllNonMetrics}
fieldTypes={indexedFieldTypes}
showFieldType={nonMetricShowFieldType}
setShowFieldType={setNonMetricShowFieldType}
fieldSearchBarQuery={nonMetricFieldQuery}
setFieldSearchBarQuery={setNonMetricFieldQuery}
fieldVisConfigs={nonMetricConfigs}
/>
</EuiFlexItem>
</EuiFlexGroup>
</EuiFlexItem>
{showActionsPanel === true && (
<EuiFlexItem grow={false} style={{ width: '280px' }}>
<ActionsPanel indexPattern={currentIndexPattern} />
</EuiFlexItem>
)}
</EuiFlexGroup>
</EuiPageContentBody>
</EuiPageBody>
</EuiPage>
</Fragment>
);
};

View file

@ -15,7 +15,7 @@ import { loadCurrentIndexPattern, loadCurrentSavedSearch } from '../../util/inde
import { checkMlNodesAvailable } from '../../ml_nodes_check';
import { getDataVisualizerBreadcrumbs } from './breadcrumbs';
const template = `<ml-nav-menu name="datavisualizer" /><ml-data-visualizer />`;
const template = `<ml-data-visualizer />`;
uiRoutes.when('/jobs/new_job/datavisualizer', {
template,

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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) {

View file

@ -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';

View file

@ -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';

View file

@ -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,

View file

@ -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;

View file

@ -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(

View file

@ -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;

View file

@ -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<number, string[]>;

View file

@ -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;

View file

@ -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;

View file

@ -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 = [

View file

@ -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';

View file

@ -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';

View file

@ -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';

View file

@ -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/';

View file

@ -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: () => <div id="mockNavigationMenu" />
}));
jest.mock('../../../privilege/check_privilege', () => ({

View file

@ -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';

View file

@ -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: () => <div id="mockNavigationMenu" />
}));
jest.mock('../../../privilege/check_privilege', () => ({

View file

@ -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

View file

@ -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: () => <div id="mockNavigationMenu" />
}));

View file

@ -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';

View file

@ -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: () => <div id="mockNavigationMenu" />
}));
jest.mock('../../../privilege/check_privilege', () => ({

View file

@ -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,

View file

@ -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: () => <div id="mockNavigationMenu" />,
}));

View file

@ -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 }
);
});

View file

@ -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';

View file

@ -5782,10 +5782,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": "このジョブには注釈が作成されていません",

View file

@ -5784,10 +5784,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": "没有为此作业创建注释",