Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[ML] Removing old angular directives #48382

Merged
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 0 additions & 46 deletions x-pack/legacy/plugins/ml/public/access_denied/index.html

This file was deleted.

25 changes: 0 additions & 25 deletions x-pack/legacy/plugins/ml/public/access_denied/index.js

This file was deleted.

39 changes: 39 additions & 0 deletions x-pack/legacy/plugins/ml/public/access_denied/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
* or more contributor license agreements. Licensed under the Elastic License;
* you may not use this file except in compliance with the Elastic License.
*/

import 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();
});
},
};
});
63 changes: 63 additions & 0 deletions x-pack/legacy/plugins/ml/public/access_denied/page.tsx
Original file line number Diff line number Diff line change
@@ -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: 'You need permission to access ML jobs',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Compared to the previous angular version, the texts here don't mention the user roles anymore. However, the text is still specific about ML jobs, which could be irrelevant if a user doesn't have permissions to even access file visualizer. Maybe the messaging should be even more generic for this PR until we can come up with something more elaborate in combination with react-router?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point. i've updated the text.
It's worth noting that currently this page will not be redirected to automatically. So unless someone navigates to it directly in their browser, no one will see it.

})}
color="danger"
iconType="cross"
>
<EuiText size="s">
<p>
<FormattedMessage
id="xpack.ml.accessDenied.description"
defaultMessage="You don’t have permission to manage ML jobs"
/>
</p>
</EuiText>
</EuiCallOut>
</EuiPageContentBody>
</EuiPageBody>
</EuiPage>
</Fragment>
);
1 change: 0 additions & 1 deletion x-pack/legacy/plugins/ml/public/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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';

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -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';

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,4 @@
*/



import './field_type_icon_directive';

export { FieldTypeIcon } from './field_type_icon';

This file was deleted.

Loading