diff --git a/.eslintrc.js b/.eslintrc.js new file mode 100644 index 00000000..6151f2ca --- /dev/null +++ b/.eslintrc.js @@ -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 + } + } + ], +}; diff --git a/opensearch_dashboards.json b/opensearch_dashboards.json index d423863e..026def91 100644 --- a/opensearch_dashboards.json +++ b/opensearch_dashboards.json @@ -7,7 +7,8 @@ "data" ], "optionalPlugins": [ - "share" + "share", + "managementOverview" ], "server": true, "ui": true diff --git a/package.json b/package.json index 36990356..42fc3d43 100644 --- a/package.json +++ b/package.json @@ -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", @@ -34,4 +34,4 @@ "async": "^3.2.3", "minimist": "^1.2.6" } -} \ No newline at end of file +} diff --git a/public/plugin.ts b/public/plugin.ts index 6e71895e..baf9bee2 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -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'; @@ -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'); @@ -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 {}; } diff --git a/public/types.ts b/public/types.ts index 5f7eec2a..94dcd332 100644 --- a/public/types.ts +++ b/public/types.ts @@ -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 @@ -12,3 +13,7 @@ export interface notificationsDashboardsPluginStart {} export interface AppPluginStartDependencies { navigation: NavigationPublicPluginStart; } + +export interface NotificationsDashboardsSetupDeps { + managementOverview?: ManagementOverViewPluginSetup; +}