Skip to content

Commit

Permalink
Move notification plugin into management section on left navigation m…
Browse files Browse the repository at this point in the history
…enu (#46)

* move notification into management section

Signed-off-by: Hailong Cui <[email protected]>

* Fix eslint

Signed-off-by: Hailong Cui <[email protected]>

* Remove plugins pages for management overview registration

Signed-off-by: Hailong Cui <[email protected]>

* wording update

Signed-off-by: Hailong Cui <[email protected]>

---------

Signed-off-by: Hailong Cui <[email protected]>
  • Loading branch information
Hailong-am authored Jul 7, 2023
1 parent f094410 commit f26c1ca
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 12 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
}
}
],
};
3 changes: 2 additions & 1 deletion opensearch_dashboards.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
"data"
],
"optionalPlugins": [
"share"
"share",
"managementOverview"
],
"server": true,
"ui": true
Expand Down
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"
}
}
}
35 changes: 26 additions & 9 deletions public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@
* SPDX-License-Identifier: Apache-2.0
*/

import { i18n } from '@osd/i18n';
import {
AppMountParameters,
CoreSetup,
CoreStart,
DEFAULT_APP_CATEGORIES,
Plugin,
} from '../../../src/core/public';
import {
notificationsDashboardsPluginSetup,
notificationsDashboardsPluginStart,
AppPluginStartDependencies,
NotificationsDashboardsSetupDeps,
} from './types';
import { PLUGIN_NAME } from '../common';

Expand All @@ -22,17 +24,20 @@ export class notificationsDashboardsPlugin
notificationsDashboardsPluginSetup,
notificationsDashboardsPluginStart
> {
public setup(core: CoreSetup): 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',
category: {
id: 'opensearch',
label: 'OpenSearch Plugins',
order: 2000,
},
order: 6000,
title: this.title,
category: DEFAULT_APP_CATEGORIES.management,
order: 9060,
async mount(params: AppMountParameters) {
// Load application bundle
const { renderApp } = await import('./application');
Expand All @@ -43,6 +48,18 @@ export class notificationsDashboardsPlugin
},
});

if (managementOverview) {
managementOverview.register({
id: PLUGIN_NAME,
title: this.title,
order: 9060,
description: i18n.translate('notification.notificationDescription', {
defaultMessage:
'Connect with your communication services to receive notifications from supported OpenSearch plugins.',
}),
});
}

// Return methods that should be available to other plugins
return {};
}
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 f26c1ca

Please sign in to comment.