Skip to content

Commit

Permalink
Remove plugins pages for management overview registration
Browse files Browse the repository at this point in the history
Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am committed Jun 16, 2023
1 parent 7df1d1f commit cb4bc83
Show file tree
Hide file tree
Showing 5 changed files with 58 additions and 32 deletions.
33 changes: 33 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/

const LICENSE_HEADER = `
/*
* Copyright OpenSearch Contributors
* SPDX-License-Identifier: Apache-2.0
*/
`

module.exports = {
root: true,
extends: ['@elastic/eslint-config-kibana', 'plugin:@elastic/eui/recommended'],
rules: {
// "@osd/eslint/require-license-header": "off"
},
overrides: [
{
files: ['**/*.{js,ts,tsx}'],
rules: {
'@osd/eslint/require-license-header': [
'error',
{
licenses: [ LICENSE_HEADER ],
},
],
"no-console": 0
}
}
],
};
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"osd": "node ../../scripts/osd",
"opensearch": "node ../../scripts/opensearch",
"lint": "eslint .",
"lint": "node ../../scripts/eslint . && node ../../scripts/stylelint",
"start": "yarn plugin_helpers start",
"build": "yarn plugin_helpers build",
"test:jest": "TZ=UTC ../../node_modules/.bin/jest --config ./test/jest.config.js",
Expand All @@ -34,4 +34,4 @@
"async": "^3.2.3",
"minimist": "^1.2.6"
}
}
}
4 changes: 2 additions & 2 deletions public/pages/Main/Main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { CreateSESSender } from '../Emails/CreateSESSender';
import { EmailGroups } from '../Emails/EmailGroups';
import { EmailSenders } from '../Emails/EmailSenders';

export enum Navigation {
enum Navigation {
Notifications = 'Notifications',
Channels = 'Channels',
EmailSenders = 'Email senders',
Expand All @@ -32,7 +32,7 @@ enum Pathname {
Channels = '/channels',
}

interface MainProps extends RouteComponentProps {}
type MainProps = RouteComponentProps;

export interface MainState {
availableChannels: Partial<typeof CHANNEL_TYPE>;
Expand Down
44 changes: 16 additions & 28 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { i18n } from '@osd/i18n';
import {
AppMountParameters,
CoreSetup,
Expand All @@ -13,28 +14,28 @@ import {
import {
notificationsDashboardsPluginSetup,
notificationsDashboardsPluginStart,
AppPluginStartDependencies,
NotificationsDashboardsSetupDeps,
} from './types';
import { PLUGIN_NAME } from '../common';
import { Navigation } from "./pages/Main/Main";
import { ROUTES } from "./utils/constants";
import { ManagementOverViewPluginSetup } from "../../../src/plugins/management_overview/public";

interface NotificationsDashboardsSetupDeps {
managementOverview?: ManagementOverViewPluginSetup;
}

export class notificationsDashboardsPlugin
implements
Plugin<
notificationsDashboardsPluginSetup,
notificationsDashboardsPluginStart
> {
public setup(core: CoreSetup, { managementOverview }: NotificationsDashboardsSetupDeps): notificationsDashboardsPluginSetup {
private title = i18n.translate('notification.notificationTitle', {
defaultMessage: 'Notifications',
});

public setup(
core: CoreSetup,
{ managementOverview }: NotificationsDashboardsSetupDeps
): notificationsDashboardsPluginSetup {
// Register an application into the side navigation menu
core.application.register({
id: PLUGIN_NAME,
title: 'Notifications',
title: this.title,
category: DEFAULT_APP_CATEGORIES.management,
order: 9060,
async mount(params: AppMountParameters) {
Expand All @@ -50,25 +51,12 @@ export class notificationsDashboardsPlugin
if (managementOverview) {
managementOverview.register({
id: PLUGIN_NAME,
title: 'Notifications',
title: this.title,
order: 9060,
pages: [
{
title: Navigation.Channels,
url: `#${ROUTES.CHANNELS}`,
order: 100
},
{
title: Navigation.EmailSenders,
url: `#${ROUTES.EMAIL_SENDERS}`,
order: 200
},
{
title: Navigation.EmailGroups,
url: `#${ROUTES.EMAIL_GROUPS}`,
order: 300
},
]
description: i18n.translate('notification.notificationDescription', {
defaultMessage:
'Connect with your communication service to receive notifications from supported OpenSearch plugins.',
}),
});
}

Expand Down
5 changes: 5 additions & 0 deletions public/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
*/

import { NavigationPublicPluginStart } from '../../../src/plugins/navigation/public';
import { ManagementOverViewPluginSetup } from "../../../src/plugins/management_overview/public";

export interface notificationsDashboardsPluginSetup {}
// eslint-disable-next-line @typescript-eslint/no-empty-interface
Expand All @@ -12,3 +13,7 @@ export interface notificationsDashboardsPluginStart {}
export interface AppPluginStartDependencies {
navigation: NavigationPublicPluginStart;
}

export interface NotificationsDashboardsSetupDeps {
managementOverview?: ManagementOverViewPluginSetup;
}

0 comments on commit cb4bc83

Please sign in to comment.