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

New management overview page and rename stack management to dashboard management #4287

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
d7bae77
navigation changes and overview page
Hailong-am Jun 14, 2023
d822316
Merge remote-tracking branch 'upstream/main' into feature/navigation_…
Hailong-am Jun 14, 2023
1ef839e
Add changelog
Hailong-am Jun 14, 2023
caca46d
Rename stack management to dashboard management
Hailong-am Jun 15, 2023
74faff7
management overviw page align with app directory page
Hailong-am Jun 16, 2023
d7716ce
wording changes for dashboards management
Hailong-am Jun 19, 2023
59bb4ce
wording changes
Hailong-am Jun 20, 2023
144c415
wording update
Hailong-am Jun 23, 2023
b4cd336
Merge branch 'main' into feature/navigation_changes_2
Hailong-am Jun 24, 2023
8c22160
i18n title fix
Hailong-am Jun 24, 2023
bdff260
Merge branch 'main' into feature/navigation_changes_2
joshuarrrr Jun 26, 2023
9f39df8
Merge branch 'main' into feature/navigation_changes_2
Hailong-am Jun 26, 2023
b1286f0
Merge branch 'main' into feature/navigation_changes_2
ashwin-pc Jun 28, 2023
7c37ceb
Merge branch 'main' into feature/navigation_changes_2
Hailong-am Jun 29, 2023
8c23c95
Merge branch 'main' into feature/navigation_changes_2
Hailong-am Jun 29, 2023
fa7be2f
Merge branch 'main' into feature/navigation_changes_2
Hailong-am Jun 30, 2023
a148aaa
Merge branch 'main' into feature/navigation_changes_2
Hailong-am Jul 1, 2023
c73eec9
Merge branch 'main' into feature/navigation_changes_2
Hailong-am Jul 3, 2023
d49fcd3
Merge branch 'main' into feature/navigation_changes_2
Hailong-am Jul 4, 2023
e2be9ce
Merge branch 'main' into feature/navigation_changes_2
ashwin-pc Jul 5, 2023
01d8ea6
remove overview register setup in start phase
Hailong-am Jul 6, 2023
833179c
Add comment for dev tools order change
Hailong-am Jul 6, 2023
9472de0
Make home plugin optional for managemnet overview
Hailong-am Jul 6, 2023
66f286e
Fix failed functional test due to wording change
Hailong-am Jul 7, 2023
d83d7a9
Merge remote-tracking branch 'upstream/main' into feature/navigation_…
Hailong-am Jul 7, 2023
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
Next Next commit
navigation changes and overview page
Signed-off-by: Hailong Cui <ihailong@amazon.com>
  • Loading branch information
Hailong-am committed Jun 14, 2023
commit d7bae779a301ca30df106152afd2e9d0fe0f64e8
1 change: 1 addition & 0 deletions src/core/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,4 @@ export * from './ui_settings';
export * from './saved_objects';
export * from './serializable';
export * from './custom_branding';
export * from './plugin_pages';
10 changes: 10 additions & 0 deletions src/core/types/plugin_pages.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

export interface PluginPages {
title: string;
url: string;
order: number;
}
2 changes: 1 addition & 1 deletion src/plugins/dev_tools/opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"version": "opensearchDashboards",
"server": false,
"ui": true,
"optionalPlugins": ["dataSource"],
"optionalPlugins": ["dataSource", "managementOverview"],
"requiredPlugins": ["urlForwarding"],
"requiredBundles": ["dataSourceManagement"]
}
30 changes: 27 additions & 3 deletions src/plugins/dev_tools/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
*/

import { BehaviorSubject } from 'rxjs';
import { Plugin, CoreSetup, AppMountParameters } from 'src/core/public';
import { Plugin, CoreSetup, AppMountParameters, CoreStart } from 'src/core/public';
import { AppUpdater } from 'opensearch-dashboards/public';
import { i18n } from '@osd/i18n';
import { sortBy } from 'lodash';
Expand All @@ -40,10 +40,17 @@ import { UrlForwardingSetup } from '../../url_forwarding/public';
import { CreateDevToolArgs, DevToolApp, createDevToolApp } from './dev_tool';

import './index.scss';
import { PluginPages } from '../../../core/types';
import { ManagementOverViewPluginStart } from '../../management_overview/public';

export interface DevToolsSetupDependencies {
dataSource?: DataSourcePluginStart;
}

export interface DevToolsStartDependencies {
managementOverview?: ManagementOverViewPluginStart;
}

export interface DevToolsSetup {
/**
* Register a developer tool. It will be available
Expand Down Expand Up @@ -79,7 +86,7 @@ export class DevToolsPlugin implements Plugin<DevToolsSetup, void> {
}),
updater$: this.appStateUpdater,
icon: '/plugins/home/public/assets/logos/opensearch_mark_default.svg',
order: 9010,
order: 9070,
Hailong-am marked this conversation as resolved.
Show resolved Hide resolved
category: DEFAULT_APP_CATEGORIES.management,
mount: async (params: AppMountParameters) => {
const { element, history } = params;
Expand Down Expand Up @@ -109,9 +116,26 @@ export class DevToolsPlugin implements Plugin<DevToolsSetup, void> {
};
}

public start() {
public start(core: CoreStart, { managementOverview }: DevToolsStartDependencies) {
if (this.getSortedDevTools().length === 0) {
this.appStateUpdater.next(() => ({ navLinkStatus: AppNavLinkStatus.hidden }));
} else {
const features: PluginPages[] = this.getSortedDevTools().map((devApp) => {
return {
title: devApp.title,
url: `#/${devApp.id}`,
order: devApp.order,
};
});

managementOverview?.register({
id: 'dev_tools',
title: i18n.translate('devTools.devToolsTitle', {
defaultMessage: 'Dev Tools',
}),
order: 9070,
pages: features,
});
}
}

Expand Down
4 changes: 2 additions & 2 deletions src/plugins/management/opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"version": "opensearchDashboards",
"server": true,
"ui": true,
"optionalPlugins": ["home"],
"requiredBundles": ["opensearchDashboardsReact", "opensearchDashboardsUtils", "home"]
"optionalPlugins": ["home", "managementOverview"],
"requiredBundles": ["opensearchDashboardsReact", "opensearchDashboardsUtils"]
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,15 +61,15 @@ export const ManagementLandingPage = ({ version, setBreadcrumbs }: ManagementLan
<h1>
<FormattedMessage
id="management.landing.header"
defaultMessage="Welcome to Stack Management {version}"
defaultMessage="Welcome to Dashboard Management {version}"
values={{ version }}
/>
</h1>
</EuiTitle>
<EuiText>
<FormattedMessage
id="management.landing.subhead"
defaultMessage="Manage your indices, index patterns, saved objects, OpenSearch Dashboards settings, and more."
defaultMessage="Manage your index patterns, saved objects, OpenSearch Dashboards settings, and more."
/>
</EuiText>
</div>
Expand Down
56 changes: 35 additions & 21 deletions src/plugins/management/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
import { i18n } from '@osd/i18n';
import { BehaviorSubject } from 'rxjs';
import { ManagementSetup, ManagementStart } from './types';
import { FeatureCatalogueCategory, HomePublicPluginSetup } from '../../home/public';
import { HomePublicPluginSetup } from '../../home/public';
import {
CoreSetup,
CoreStart,
Expand All @@ -49,11 +49,17 @@ import {
ManagementSectionsService,
getSectionsServiceStartPrivate,
} from './management_sections_service';
import { PluginPages } from '../../../core/types';
import { ManagementOverViewPluginStart } from '../../management_overview/public';

interface ManagementSetupDependencies {
home?: HomePublicPluginSetup;
}

interface ManagementStartDependencies {
managementOverview?: ManagementOverViewPluginStart;
}

export class ManagementPlugin implements Plugin<ManagementSetup, ManagementStart> {
private readonly managementSections = new ManagementSectionsService();

Expand All @@ -66,29 +72,12 @@ export class ManagementPlugin implements Plugin<ManagementSetup, ManagementStart
public setup(core: CoreSetup, { home }: ManagementSetupDependencies) {
const opensearchDashboardsVersion = this.initializerContext.env.packageInfo.version;

if (home) {
home.featureCatalogue.register({
id: 'stack-management',
title: i18n.translate('management.stackManagement.managementLabel', {
defaultMessage: 'Stack Management',
}),
description: i18n.translate('management.stackManagement.managementDescription', {
defaultMessage: 'Your center console for managing the OpenSearch Stack.',
}),
icon: 'managementApp',
path: '/app/management',
showOnHomePage: false,
category: FeatureCatalogueCategory.ADMIN,
visible: () => this.hasAnyEnabledApps,
});
}

core.application.register({
id: MANAGEMENT_APP_ID,
title: i18n.translate('management.stackManagement.title', {
defaultMessage: 'Stack Management',
defaultMessage: 'Dashboard Management',
}),
order: 9040,
order: 9030,
icon: '/plugins/home/assets/logos/opensearch_mark_default.svg',
category: DEFAULT_APP_CATEGORIES.management,
updater$: this.appUpdater,
Expand All @@ -109,7 +98,7 @@ export class ManagementPlugin implements Plugin<ManagementSetup, ManagementStart
};
}

public start(core: CoreStart) {
public start(core: CoreStart, { managementOverview }: ManagementStartDependencies) {
this.managementSections.start({ capabilities: core.application.capabilities });
this.hasAnyEnabledApps = getSectionsServiceStartPrivate()
.getSectionsEnabled()
Expand All @@ -124,6 +113,31 @@ export class ManagementPlugin implements Plugin<ManagementSetup, ManagementStart
});
}

if (managementOverview) {
const enabledSections = getSectionsServiceStartPrivate().getSectionsEnabled();
const pluginPages: PluginPages[] = enabledSections
.map((section) => section.apps)
.flat()
.map((app) => {
return {
title: app.title,
url: app.basePath,
order: app.order,
};
});

if (pluginPages) {
managementOverview.register({
id: MANAGEMENT_APP_ID,
title: i18n.translate('management.stackManagement.title', {
defaultMessage: 'Dashboard Management',
}),
order: 9030,
pages: pluginPages,
});
}
}

return {};
}
}
6 changes: 6 additions & 0 deletions src/plugins/management_overview/common/constants.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

export const MANAGEMENT_OVERVIEW_PLUGIN_ID = 'opensearch_management_overview';
8 changes: 8 additions & 0 deletions src/plugins/management_overview/opensearch_dashboards.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"id": "managementOverview",
"version": "opensearchDashboards",
"ui": true,
"server": false,
"requiredPlugins": ["navigation", "home"],
"optionalPlugins": []
}
67 changes: 67 additions & 0 deletions src/plugins/management_overview/public/application.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

import ReactDOM from 'react-dom';
import { I18nProvider } from '@osd/i18n/react';
import React from 'react';
import { EuiFlexGrid, EuiFlexItem, EuiPanel, EuiSpacer, EuiTitle } from '@elastic/eui';
import { i18n } from '@osd/i18n';
import { ApplicationStart, CoreStart } from '../../../core/public';
import { OverviewApp } from './overview_app';
import { OverviewCard } from './components/overview_card';

export interface ManagementOverviewProps {
application: ApplicationStart;
overviewApps?: OverviewApp[];
}

function ManagementOverviewWrapper(props: ManagementOverviewProps) {
const { application, overviewApps } = props;

const onClick = (appId: string) => {
return (url: string) => {
const pageUrl = application.getUrlForApp(appId, { path: url });
application.navigateToUrl(pageUrl);
};
};

const title = i18n.translate('core.ui.managementNavList.label', {
defaultMessage: 'Management',
});

return (
<EuiPanel style={{ padding: '20px' }}>
<EuiTitle size="l">
<h1>{title}</h1>
</EuiTitle>
<EuiSpacer />
<EuiFlexGrid columns={3}>
{overviewApps?.map((app) => (
<EuiFlexItem key={app.title}>
<OverviewCard title={app.title} pages={app.pages || []} onClick={onClick(app.id)} />
</EuiFlexItem>
))}
</EuiFlexGrid>
</EuiPanel>
);
}

export function renderApp(
{ application, chrome }: CoreStart,
overviewApps: OverviewApp[],
element: HTMLElement
) {
ReactDOM.render(
<I18nProvider>
<ManagementOverviewWrapper application={application} overviewApps={overviewApps} />
</I18nProvider>,
element
);

return () => {
chrome.docTitle.reset();
ReactDOM.unmountComponentAtNode(element);
};
}
Loading