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

Migrate Management views to Kibana Platform plugin #53880

Merged
merged 9 commits into from
Jan 21, 2020
7 changes: 6 additions & 1 deletion src/plugins/management/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,12 @@ export function plugin(initializerContext: PluginInitializerContext) {
return new ManagementPlugin();
}

export { ManagementSetup, ManagementStart, RegisterManagementApp } from './types';
export {
ManagementSetup,
ManagementStart,
RegisterManagementApp,
RegisterManagementAppArgs,
} from './types';
export { ManagementApp } from './management_app';
export { ManagementSection } from './management_section';
export { ManagementSidebarNav } from './components'; // for use in legacy management apps
28 changes: 0 additions & 28 deletions x-pack/legacy/plugins/security/common/model.ts

This file was deleted.

2 changes: 1 addition & 1 deletion x-pack/legacy/plugins/security/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
*/

import { Legacy } from 'kibana';
import { AuthenticatedUser } from './common/model';
import { AuthenticatedUser } from '../../../plugins/security/public';

/**
* Public interface of the security plugin.
Expand Down
3 changes: 0 additions & 3 deletions x-pack/legacy/plugins/security/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@ export const security = kibana =>
},

uiExports: {
chromeNavControls: [],
managementSections: ['plugins/security/views/management'],
styleSheetPaths: resolve(__dirname, 'public/index.scss'),
apps: [
{
Expand Down Expand Up @@ -76,7 +74,6 @@ export const security = kibana =>
'plugins/security/hacks/on_unauthorized_response',
'plugins/security/hacks/register_account_management_app',
],
home: ['plugins/security/register_feature'],
injectDefaultVars: server => {
const securityPlugin = server.newPlatform.setup.plugins.security;
if (!securityPlugin) {
Expand Down
3 changes: 0 additions & 3 deletions x-pack/legacy/plugins/security/public/images/logout.svg

This file was deleted.

3 changes: 0 additions & 3 deletions x-pack/legacy/plugins/security/public/images/person.svg

This file was deleted.

3 changes: 3 additions & 0 deletions x-pack/legacy/plugins/security/public/index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ $secFormWidth: 460px;
// Public views
@import './views/index';

// Styles of Kibana Platform plugin
@import '../../../../plugins/security/public/index';
Copy link
Member Author

Choose a reason for hiding this comment

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

note: looks like it's the only way to import style from platform plugin right now.


49 changes: 0 additions & 49 deletions x-pack/legacy/plugins/security/public/lib/__tests__/util.js

This file was deleted.

19 changes: 0 additions & 19 deletions x-pack/legacy/plugins/security/public/lib/util.js

This file was deleted.

29 changes: 0 additions & 29 deletions x-pack/legacy/plugins/security/public/register_feature.js

This file was deleted.

18 changes: 0 additions & 18 deletions x-pack/legacy/plugins/security/public/services/shield_indices.js

This file was deleted.

30 changes: 0 additions & 30 deletions x-pack/legacy/plugins/security/public/services/shield_role.js

This file was deleted.

3 changes: 0 additions & 3 deletions x-pack/legacy/plugins/security/public/views/_index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
// Login styles
@import './login/index';

// Management styles
@import './management/index';

This file was deleted.

27 changes: 10 additions & 17 deletions x-pack/legacy/plugins/security/public/views/account/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,14 @@
* you may not use this file except in compliance with the Elastic License.
*/

import routes from 'ui/routes';
import template from './account.html';
import { i18n } from '@kbn/i18n';
import { I18nContext } from 'ui/i18n';
import { npSetup } from 'ui/new_platform';
import { AccountManagementPage } from './components';
import React from 'react';
import { render, unmountComponentAtNode } from 'react-dom';
import { i18n } from '@kbn/i18n';
import { npStart } from 'ui/new_platform';
import routes from 'ui/routes';

routes.when('/account', {

This comment was marked as resolved.

This comment was marked as resolved.

template,
template: '<div id="userProfileReactRoot" />',
k7Breadcrumbs: () => [
{
text: i18n.translate('xpack.security.account.breadcrumb', {
Expand All @@ -24,19 +21,15 @@ routes.when('/account', {
],
controllerAs: 'accountController',
controller($scope) {
$scope.$on('$destroy', () => {
const elem = document.getElementById('userProfileReactRoot');
if (elem) {
unmountComponentAtNode(elem);
}
});
$scope.$$postDigest(() => {
const domNode = document.getElementById('userProfileReactRoot');

render(
<I18nContext>
<AccountManagementPage securitySetup={npSetup.plugins.security} />
</I18nContext>,
document.getElementById('userProfileReactRoot')
<npStart.plugins.security.__legacyCompat.account_management.AccountManagementPage />,
domNode
);

$scope.$on('$destroy', () => unmountComponentAtNode(domNode));
});
},
});
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@
// loginChart__legend--small
// loginChart__legend-isLoading

@import 'login';

@import './components/index';
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './login_page/index';
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
import { EuiButton, EuiCallOut } from '@elastic/eui';
import React from 'react';
import { mountWithIntl, shallowWithIntl } from 'test_utils/enzyme_helpers';
import { LoginState } from '../../../../../common/login_state';
import { LoginState } from '../../login_state';
import { BasicLoginForm } from './basic_login_form';

const createMockHttp = ({ simulateError = false } = {}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { FormattedMessage, InjectedIntl, injectI18n } from '@kbn/i18n/react';
import React, { ChangeEvent, Component, FormEvent, Fragment, MouseEvent } from 'react';
import ReactMarkdown from 'react-markdown';
import { EuiText } from '@elastic/eui';
import { LoginState } from '../../../../../common/login_state';
import { LoginState } from '../../login_state';

interface Props {
http: any;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './login_page';
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

.loginWelcome {
@include kibanaFullScreenGraphics;
}
Expand All @@ -16,10 +15,6 @@
margin-bottom: $euiSizeXL;
}

.loginWelcome__footerAction {
margin-right: $euiSizeS;
}

.loginWelcome__content {
position: relative;
margin: auto;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

import { shallow } from 'enzyme';
import React from 'react';
import { LoginLayout, LoginState } from '../../../../../common/login_state';
import { LoginLayout, LoginState } from '../../login_state';
import { LoginPage } from './login_page';

const createMockHttp = ({ simulateError = false } = {}) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import {
EuiTitle,
} from '@elastic/eui';
import classNames from 'classnames';
import { LoginState } from '../../../../../common/login_state';
import { LoginState } from '../../login_state';
import { BasicLoginForm } from '../basic_login_form';
import { DisabledLoginForm } from '../disabled_login_form';

Expand Down

This file was deleted.

8 changes: 3 additions & 5 deletions x-pack/legacy/plugins/security/public/views/login/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,14 @@

import { i18n } from '@kbn/i18n';
import { get } from 'lodash';
import { parseNext } from 'plugins/security/lib/parse_next';
import { LoginPage } from 'plugins/security/views/login/components';
// @ts-ignore
import template from 'plugins/security/views/login/login.html';
import React from 'react';
import { render } from 'react-dom';
import chrome from 'ui/chrome';
import { I18nContext } from 'ui/i18n';
import { parse } from 'url';
import { LoginState } from '../../../common/login_state';
import { parseNext } from './parse_next';
import { LoginState } from './login_state';
const messageMap = {
SESSION_EXPIRED: i18n.translate('xpack.security.login.sessionExpiredDescription', {
defaultMessage: 'Your session has timed out. Please log in again.',
Expand All @@ -31,7 +29,7 @@ interface AnyObject {

(chrome as AnyObject)
.setVisible(false)
.setRootTemplate(template)
.setRootTemplate('<div id="reactLoginRoot" />')
.setRootController(
'login',
(
Expand Down
Loading