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

Move notification plugin into management section on left navigation menu #46

Merged
merged 4 commits into from
Jul 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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;
}