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

Reorganize Management apps into Ingest, Data, Alerts and Insights, Security, Kibana, and Stack groups #65796

Merged
merged 31 commits into from
May 15, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
465d813
Reorganize Management apps into Ingest, Data, Insights and Alerting, …
cjcenizal May 7, 2020
a66a7e0
Fix TS error in beats due to missing visible option.
cjcenizal May 8, 2020
7cc3490
Update snapshots.
cjcenizal May 8, 2020
25cb6ac
Remove support for icon.
cjcenizal May 9, 2020
f93aba0
Create ManagementSectionId enum and remove ability to register additi…
cjcenizal May 9, 2020
a9fdf54
Merge branch 'master' into reorg/management-apps
cjcenizal May 9, 2020
d3f557e
Return Index Patterns to Kibana section.
cjcenizal May 9, 2020
5c6d09e
Rename Beats Central Management to Beats Management in nav.
cjcenizal May 9, 2020
6ceed19
Add tooltips to sections.
cjcenizal May 10, 2020
3aa1d8f
Throw error if retrieved managementSection is missing.
cjcenizal May 12, 2020
b1771a1
Merge branch 'master' into reorg/management-apps
cjcenizal May 12, 2020
b4b5b64
Fix types to specify that a retrieved ManagementSection cannot be und…
cjcenizal May 12, 2020
accc91e
Add test to verify that the management service will throw an error if…
cjcenizal May 12, 2020
9d97c23
Revert name change to Beats Central Management.
cjcenizal May 12, 2020
af06fc5
Fixed management nav on narrow screens.
cjcenizal May 12, 2020
29fa95e
Merge branch 'master' into reorg/management-apps
cjcenizal May 12, 2020
3e38251
Remove undefined export. Fix Security and Spaces unit tests.
cjcenizal May 12, 2020
cde5d36
Update paths to apps in functional tests config.
cjcenizal May 12, 2020
d14f15f
Fix plugin functional test.
cjcenizal May 13, 2020
cd6fa5e
Fix TS errors.
cjcenizal May 14, 2020
f1ddf84
Change kibana/triggersActions paths to insightsAndAlerting/triggersAc…
cjcenizal May 14, 2020
1cf0af1
Merge branch 'master' into reorg/management-apps
cjcenizal May 14, 2020
265373e
Fix spaces snapshot.
cjcenizal May 14, 2020
68c61fa
Fix management plugin functional tests.
cjcenizal May 14, 2020
64cda1a
Fix i18n.
cjcenizal May 14, 2020
58b6e10
Fix reporting tests.
cjcenizal May 14, 2020
68c0eb4
Fix broken links and update snapshots.
cjcenizal May 15, 2020
dfccfa5
Fix watcher links.
cjcenizal May 15, 2020
3554533
Fix broken license management link.
cjcenizal May 15, 2020
79bcbb7
Merge branch 'master' into reorg/management-apps
cjcenizal May 15, 2020
69762fd
Merge branch 'master' into reorg/management-apps
cjcenizal May 15, 2020
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
Original file line number Diff line number Diff line change
Expand Up @@ -163,10 +163,10 @@ uiModules
};
});

management.getSection('kibana').register('index_patterns', {
management.getSection('data').register('index_patterns', {
display: i18n.translate('kbn.management.indexPattern.sectionsHeader', {
defaultMessage: 'Index Patterns',
}),
order: 0,
order: 1,
url: '#/management/kibana/index_patterns/',
});
2 changes: 1 addition & 1 deletion src/plugins/management/public/legacy/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
* under the License.
*/

export { LegacyManagementAdapter } from './sections_register';
export { LegacyManagementAdapter, sections } from './sections_register';
export { LegacyManagementSection } from './section';
56 changes: 33 additions & 23 deletions src/plugins/management/public/legacy/sections_register.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,33 @@
import { LegacyManagementSection } from './section';
import { i18n } from '@kbn/i18n';

export const sections = [
{
id: 'ingest',
Copy link
Contributor

@jloleysens jloleysens May 8, 2020

Choose a reason for hiding this comment

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

I really like this.

One suggestion in case we want to refactor ids whatever reason, it could be useful to have an enum that management exports in public (I can imagine search for 'data' may bring up many results 😄 ). Maybe Sections.Ingest for instance.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Great idea! Will do.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm hoping we'll change how sections are referenced in the near future. I'm 👎 on looking items up by id unless necessary and this case is not necessary. We should be exporting the sections as public APIs of the plugins that create them. The current usage creates an implicit dependency and the potential for runtime errors instead of compile time errors.

title: 'Ingest',
},
{
id: 'data',
title: 'Data',
},
{
id: 'insightsAndAlerting',
title: 'Insights and Alerting',
},
{
id: 'security',
title: 'Security',
},
{
id: 'kibana',
title: 'Kibana',
},
{
id: 'stack',
title: 'Stack',
},
];

export class LegacyManagementAdapter {
main = undefined;
init = capabilities => {
Expand All @@ -33,29 +60,12 @@ export class LegacyManagementAdapter {
capabilities
);

this.main.register('data', {
display: i18n.translate('management.connectDataDisplayName', {
defaultMessage: 'Connect Data',
}),
order: 0,
});

this.main.register('elasticsearch', {
display: 'Elasticsearch',
order: 20,
icon: 'logoElasticsearch',
});

this.main.register('kibana', {
display: 'Kibana',
order: 30,
icon: 'logoKibana',
});

this.main.register('logstash', {
display: 'Logstash',
order: 30,
icon: 'logoLogstash',
sections.forEach(({ id, title, icon }, idx) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

Does icon exist in any of these?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It doesn't, great spot. My original line of thought was that we'd need to support icons for these buckets but TBH, I think they're unnecessary in terms of UX. I'll remove this from the code and we can always reimplement if we need to.

this.main.register(id, {
display: title,
order: idx,
icon,
});
});

return this.main;
Expand Down
14 changes: 6 additions & 8 deletions src/plugins/management/public/management_service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import { ManagementSection } from './management_section';
import { KibanaLegacySetup } from '../../kibana_legacy/public';
// @ts-ignore
import { LegacyManagementSection } from './legacy';
import { LegacyManagementSection, sections } from './legacy';
import { CreateSection } from './types';
import { StartServicesAccessor, CoreStart } from '../../../core/public';

Expand Down Expand Up @@ -79,13 +79,11 @@ export class ManagementService {
getStartServices
);

register({ id: 'kibana', title: 'Kibana', order: 30, euiIconType: 'logoKibana' });
register({
id: 'elasticsearch',
title: 'Elasticsearch',
order: 20,
euiIconType: 'logoElasticsearch',
});
sections.forEach(
({ id, title, icon }: { id: string; title: string; icon?: string }, idx: number) => {
register({ id, title, euiIconType: icon, order: idx });
}
);

return {
register,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ export { INDEX_NAMES } from './index_names';
export { PLUGIN } from './plugin';
export { LICENSES, REQUIRED_LICENSES, REQUIRED_ROLES } from './security';
export { TABLE_CONFIG } from './table';
export const BASE_PATH = '/management/beats_management';
export const BASE_PATH = '/management/ingest/beats_management';
18 changes: 2 additions & 16 deletions x-pack/legacy/plugins/beats_management/public/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async function startApp(libs: FrontendLibs) {
BASE_PATH,
<ThemeProvider theme={{ eui: euiVars }}>
<I18nContext>
<HashRouter basename="/management/beats_management">
<HashRouter basename={BASE_PATH}>
<UnstatedProvider inject={[new BeatsContainer(libs), new TagsContainer(libs)]}>
<BreadcrumbProvider useGlobalBreadcrumbs={libs.framework.versionGreaterThen('6.7.0')}>
<Subscribe to={[BeatsContainer, TagsContainer]}>
Expand All @@ -52,21 +52,7 @@ async function startApp(libs: FrontendLibs) {
await libs.framework.waitUntilFrameworkReady();

if (libs.framework.licenseIsAtLeast('standard')) {
libs.framework.registerManagementSection({
id: 'beats',
name: i18n.translate('xpack.beatsManagement.centralManagementSectionLabel', {
defaultMessage: 'Beats',
}),
iconName: 'logoBeats',
});

libs.framework.registerManagementUI({
sectionId: 'beats',
name: i18n.translate('xpack.beatsManagement.centralManagementLinkLabel', {
defaultMessage: 'Central Management',
}),
basePath: BASE_PATH,
});
libs.framework.registerManagementSection();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,7 @@ export interface FrameworkAdapter {
component: React.ReactElement<any>,
toController: 'management' | 'self'
): void;
registerManagementSection(settings: {
id?: string;
name: string;
iconName: string;
order?: number;
}): void;
registerManagementUI(settings: {
sectionId?: string;
name: string;
basePath: string;
visable?: boolean;
order?: number;
}): void;
registerManagementSection(): void;
}

export const RuntimeFrameworkInfo = t.type({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,13 @@ import { IScope } from 'angular';
import { PathReporter } from 'io-ts/lib/PathReporter';
import * as React from 'react';
import * as ReactDOM from 'react-dom';
import { i18n } from '@kbn/i18n';
import { UIRoutes } from 'ui/routes';
import { isLeft } from 'fp-ts/lib/Either';
import { npSetup } from 'ui/new_platform';
import { SecurityPluginSetup } from '../../../../../../../plugins/security/public';
import { BufferedKibanaServiceCall, KibanaAdapterServiceRefs, KibanaUIConfig } from '../../types';
import { BASE_PATH } from '../../../../common/constants';
import {
FrameworkAdapter,
FrameworkInfo,
Expand Down Expand Up @@ -148,45 +150,13 @@ export class KibanaFrameworkAdapter implements FrameworkAdapter {
);
}

public registerManagementSection(settings: {
id?: string;
name: string;
iconName: string;
order?: number;
}) {
const sectionId = settings.id || this.PLUGIN_ID;

if (!this.management.hasItem(sectionId)) {
this.management.register(sectionId, {
display: settings.name,
icon: settings.iconName,
order: settings.order || 30,
});
}
}

public registerManagementUI(settings: {
sectionId?: string;
name: string;
basePath: string;
visable?: boolean;
order?: number;
}) {
const sectionId = settings.sectionId || this.PLUGIN_ID;

if (!this.management.hasItem(sectionId)) {
throw new Error(
`registerManagementUI was called with a sectionId of ${sectionId}, and that is is not yet regestered as a section`
);
}

const section = this.management.getSection(sectionId);

section.register(sectionId, {
visible: settings.visable || true,
display: settings.name,
order: settings.order || 30,
url: `#${settings.basePath}`,
public registerManagementSection() {
this.management.getSection('ingest')!.register('beats_central_management', {
display: i18n.translate('xpack.beatsManagement.centralManagementSectionLabel', {
defaultMessage: 'Beats Central Management',
}),
order: 2,
url: `#${BASE_PATH}/`,
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,22 +48,7 @@ export class TestingFrameworkAdapter implements FrameworkAdapter {
throw new Error('not yet implamented');
}

public registerManagementSection(settings: {
id?: string;
name: string;
iconName: string;
order?: number;
}) {
throw new Error('not yet implamented');
}

public registerManagementUI(settings: {
sectionId?: string;
name: string;
basePath: string;
visable?: boolean;
order?: number;
}) {
public registerManagementSection() {
throw new Error('not yet implamented');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ export class FrameworkLib {
public waitUntilFrameworkReady = this.adapter.waitUntilFrameworkReady.bind(this.adapter);
public renderUIAtPath = this.adapter.renderUIAtPath.bind(this.adapter);
public registerManagementSection = this.adapter.registerManagementSection.bind(this.adapter);
public registerManagementUI = this.adapter.registerManagementUI.bind(this.adapter);

constructor(private readonly adapter: FrameworkAdapter) {}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ export const APPS = {
};

export const MANAGEMENT_ID = 'cross_cluster_replication';
export const BASE_PATH = `/management/elasticsearch/${MANAGEMENT_ID}`;
export const BASE_PATH_REMOTE_CLUSTERS = '/management/elasticsearch/remote_clusters';
export const BASE_PATH = `/management/data/${MANAGEMENT_ID}`;
export const BASE_PATH_REMOTE_CLUSTERS = '/management/data/remote_clusters';
export const API_BASE_PATH = '/api/cross_cluster_replication';
export const API_REMOTE_CLUSTERS_BASE_PATH = '/api/remote_clusters';
export const API_INDEX_MANAGEMENT_BASE_PATH = '/api/index_management';
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/cross_cluster_replication/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export class CrossClusterReplicationPlugin implements Plugin {

public setup(coreSetup: CoreSetup, plugins: PluginDependencies) {
const { licensing, remoteClusters, usageCollection, management, indexManagement } = plugins;
const esSection = management.sections.getSection('elasticsearch');
const esSection = management.sections.getSection('data');

const {
http,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@ export const PLUGIN = {
}),
};

export const BASE_PATH = '/management/elasticsearch/index_lifecycle_management/';
export const BASE_PATH = '/management/data/index_lifecycle_management/';

export const API_BASE_PATH = '/api/index_lifecycle_management';
4 changes: 2 additions & 2 deletions x-pack/plugins/index_lifecycle_management/public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,10 @@ export class IndexLifecycleManagementPlugin {
initUiMetric(usageCollection);
initNotification(toasts, fatalErrors);

management.sections.getSection('elasticsearch')!.registerApp({
management.sections.getSection('data')!.registerApp({
id: PLUGIN.ID,
title: PLUGIN.TITLE,
order: 3,
order: 2,
mount: async ({ element }) => {
const [coreStart] = await getStartServices();
const {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const BASE_PATH = '/management/elasticsearch/index_management/';
export const BASE_PATH = '/management/data/index_management/';
4 changes: 2 additions & 2 deletions x-pack/plugins/index_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ export class IndexMgmtUIPlugin {
notificationService.setup(notifications);
this.uiMetricService.setup(usageCollection);

management.sections.getSection('elasticsearch')!.registerApp({
management.sections.getSection('data')!.registerApp({
id: PLUGIN.id,
title: i18n.translate('xpack.idxMgmt.appTitle', { defaultMessage: 'Index Management' }),
order: 2,
order: 0,
mount: async params => {
const { mountManagementSection } = await import('./application/mount_management_section');
const services = {
Expand Down
2 changes: 1 addition & 1 deletion x-pack/plugins/ingest_pipelines/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class IngestPipelinesPlugin implements Plugin {
uiMetricService.setup(usageCollection);
apiService.setup(http, uiMetricService);

management.sections.getSection('elasticsearch')!.registerApp({
management.sections.getSection('ingest')!.registerApp({
id: PLUGIN_ID,
order: 1,
title: i18n.translate('xpack.ingestPipelines.appTitle', {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
* you may not use this file except in compliance with the Elastic License.
*/

export const BASE_PATH = '/management/elasticsearch/license_management/';
export const BASE_PATH = '/management/stack/license_management/';

export const API_BASE_PATH = '/api/license';
4 changes: 2 additions & 2 deletions x-pack/plugins/license_management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ export class LicenseManagementUIPlugin
const { getStartServices } = coreSetup;
const { management, telemetry, licensing } = plugins;

management.sections.getSection('elasticsearch')!.registerApp({
management.sections.getSection('stack')!.registerApp({
id: PLUGIN.id,
title: PLUGIN.title,
order: 99,
order: 0,
mount: async ({ element, setBreadcrumbs }) => {
const [core] = await getStartServices();
const initialLicense = await plugins.licensing.license$.pipe(first()).toPromise();
Expand Down
13 changes: 4 additions & 9 deletions x-pack/plugins/logstash/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,13 @@ export class LogstashPlugin implements Plugin<void, void, SetupDeps> {
const logstashLicense$ = plugins.licensing.license$.pipe(
map(license => new LogstashLicenseService(license))
);
const section = plugins.management.sections.register({
id: 'logstash',
title: 'Logstash',
order: 30,
euiIconType: 'logoLogstash',
});
const managementApp = section.registerApp({

const managementApp = plugins.management.sections.getSection('ingest')!.registerApp({
id: 'pipelines',
title: i18n.translate('xpack.logstash.managementSection.pipelinesTitle', {
defaultMessage: 'Pipelines',
defaultMessage: 'Logstash Pipelines',
}),
order: 10,
order: 1,
mount: async params => {
const [coreStart] = await core.getStartServices();
const { renderApp } = await import('./application');
Expand Down
Loading