From 2484dd9ea8d788ede87fb4134504665e5552ad12 Mon Sep 17 00:00:00 2001 From: Hailong Cui Date: Mon, 22 May 2023 14:33:20 +0800 Subject: [PATCH] move notification into management section Signed-off-by: Hailong Cui --- opensearch_dashboards.json | 3 ++- public/pages/Main/Main.tsx | 2 +- public/plugin.ts | 43 +++++++++++++++++++++++++++++++------- 3 files changed, 39 insertions(+), 9 deletions(-) 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/public/pages/Main/Main.tsx b/public/pages/Main/Main.tsx index 4fa94d4f..ea4bac8b 100644 --- a/public/pages/Main/Main.tsx +++ b/public/pages/Main/Main.tsx @@ -21,7 +21,7 @@ import { CreateSESSender } from '../Emails/CreateSESSender'; import { EmailGroups } from '../Emails/EmailGroups'; import { EmailSenders } from '../Emails/EmailSenders'; -enum Navigation { +export enum Navigation { Notifications = 'Notifications', Channels = 'Channels', EmailSenders = 'Email senders', diff --git a/public/plugin.ts b/public/plugin.ts index 6e71895e..7c92e949 100644 --- a/public/plugin.ts +++ b/public/plugin.ts @@ -7,6 +7,7 @@ import { AppMountParameters, CoreSetup, CoreStart, + DEFAULT_APP_CATEGORIES, Plugin, } from '../../../src/core/public'; import { @@ -15,6 +16,13 @@ import { AppPluginStartDependencies, } 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 @@ -22,17 +30,13 @@ export class notificationsDashboardsPlugin notificationsDashboardsPluginSetup, notificationsDashboardsPluginStart > { - public setup(core: CoreSetup): notificationsDashboardsPluginSetup { + 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, + category: DEFAULT_APP_CATEGORIES.management, + order: 9060, async mount(params: AppMountParameters) { // Load application bundle const { renderApp } = await import('./application'); @@ -43,6 +47,31 @@ export class notificationsDashboardsPlugin }, }); + if (managementOverview) { + managementOverview.register({ + id: PLUGIN_NAME, + title: 'Notifications', + 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 + }, + ] + }); + } + // Return methods that should be available to other plugins return {}; }