Skip to content

Commit

Permalink
Management - New platform api (elastic#52579) (elastic#54321)
Browse files Browse the repository at this point in the history
* implement management new platform api
  • Loading branch information
mattkime authored Jan 9, 2020
1 parent 7c4f6cc commit 7479e2b
Show file tree
Hide file tree
Showing 43 changed files with 1,292 additions and 212 deletions.
13 changes: 10 additions & 3 deletions src/legacy/core_plugins/kibana/public/management/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,8 @@ import { I18nContext } from 'ui/i18n';
import { uiModules } from 'ui/modules';
import appTemplate from './app.html';
import landingTemplate from './landing.html';
import { management, SidebarNav, MANAGEMENT_BREADCRUMB } from 'ui/management';
import { management, MANAGEMENT_BREADCRUMB } from 'ui/management';
import { ManagementSidebarNav } from '../../../../../plugins/management/public';
import {
FeatureCatalogueRegistryProvider,
FeatureCatalogueCategory,
Expand All @@ -42,6 +43,7 @@ import {
EuiIcon,
EuiHorizontalRule,
} from '@elastic/eui';
import { npStart } from 'ui/new_platform';

const SIDENAV_ID = 'management-sidenav';
const LANDING_ID = 'management-landing';
Expand Down Expand Up @@ -102,15 +104,20 @@ export function updateLandingPage(version) {
);
}

export function updateSidebar(items, id) {
export function updateSidebar(legacySections, id) {
const node = document.getElementById(SIDENAV_ID);
if (!node) {
return;
}

render(
<I18nContext>
<SidebarNav sections={items} selectedId={id} className="mgtSideNav" />
<ManagementSidebarNav
getSections={npStart.plugins.management.sections.getSectionsEnabled}
legacySections={legacySections}
selectedId={id}
className="mgtSideNav"
/>
</I18nContext>,
node
);
Expand Down
1 change: 1 addition & 0 deletions src/legacy/ui/public/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
@import './saved_objects/index';
@import './share/index';
@import './style_compile/index';
@import '../../../plugins/management/public/components/index';

// The following are prefixed with "vis"

Expand Down
1 change: 0 additions & 1 deletion src/legacy/ui/public/management/_index.scss

This file was deleted.

This file was deleted.

107 changes: 0 additions & 107 deletions src/legacy/ui/public/management/components/sidebar_nav.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/legacy/ui/public/management/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ export {
PAGE_FOOTER_COMPONENT,
} from '../../../core_plugins/kibana/public/management/sections/settings/components/default_component_registry';
export { registerSettingsComponent } from '../../../core_plugins/kibana/public/management/sections/settings/components/component_registry';
export { SidebarNav } from './components';
export { MANAGEMENT_BREADCRUMB } from './breadcrumbs';

import { npStart } from 'ui/new_platform';
export const management = npStart.plugins.management.legacy;
2 changes: 1 addition & 1 deletion src/plugins/management/kibana.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
"version": "kibana",
"server": false,
"ui": true,
"requiredPlugins": []
"requiredPlugins": ["kibana_legacy"]
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/plugins/management/public/components/_index.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
@import './management_sidebar_nav/index';
21 changes: 21 additions & 0 deletions src/plugins/management/public/components/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

export { ManagementSidebarNav } from './management_sidebar_nav';
export { ManagementChrome } from './management_chrome';
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
* under the License.
*/

export { SidebarNav } from './sidebar_nav';
export { ManagementChrome } from './management_chrome';
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

import * as React from 'react';
import { EuiPage, EuiPageBody } from '@elastic/eui';
import { I18nProvider } from '@kbn/i18n/react';
import { ManagementSidebarNav } from '../management_sidebar_nav';
import { LegacySection } from '../../types';
import { ManagementSection } from '../../management_section';

interface Props {
getSections: () => ManagementSection[];
legacySections: LegacySection[];
selectedId: string;
onMounted: (element: HTMLDivElement) => void;
}

export class ManagementChrome extends React.Component<Props> {
private container = React.createRef<HTMLDivElement>();
componentDidMount() {
if (this.container.current) {
this.props.onMounted(this.container.current);
}
}
render() {
return (
<I18nProvider>
<EuiPage>
<ManagementSidebarNav
getSections={this.props.getSections}
legacySections={this.props.legacySections}
selectedId={this.props.selectedId}
/>
<EuiPageBody>
<div ref={this.container} />
</EuiPageBody>
</EuiPage>
</I18nProvider>
);
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 7479e2b

Please sign in to comment.