From 1edbb403698f77d005763032cbc48b0c1a8bd3d9 Mon Sep 17 00:00:00 2001 From: SuZhou-Joe Date: Mon, 13 May 2024 21:35:38 +0800 Subject: [PATCH] feat: draft version Signed-off-by: SuZhou-Joe --- public/pages/Main/Main.tsx | 6 -- public/plugin.ts | 143 ++++++++++++++++++++++++++++++++++--- 2 files changed, 132 insertions(+), 17 deletions(-) diff --git a/public/pages/Main/Main.tsx b/public/pages/Main/Main.tsx index e462fe10d..3939dbf5b 100644 --- a/public/pages/Main/Main.tsx +++ b/public/pages/Main/Main.tsx @@ -485,12 +485,6 @@ export default class Main extends Component { {/* Hide side navigation bar when creating or editing rollup job*/} - {!HIDDEN_NAV_ROUTES.includes(pathname) && - !HIDDEN_NAV_STARTS_WITH_ROUTE.some((item) => pathname.startsWith(item)) ? ( - - - - ) : null} = { + indexes: { + id: "indexes", + label: i18n.translate("core.ui.indexesNavList.label", { + defaultMessage: "Indexes", + }), + order: 9000, + euiIconType: "managementApp", + group: DATA_ADMINISTRATION, + }, + backup: { + id: "backup", + label: i18n.translate("core.ui.backupNavList.label", { + defaultMessage: "Index backup and recovery", + }), + order: 9010, + euiIconType: "managementApp", + group: DATA_ADMINISTRATION, + }, +}; + export class IndexManagementPlugin implements Plugin { constructor(private readonly initializerContext: PluginInitializerContext) { // can retrieve config from initializerContext @@ -52,27 +81,119 @@ export class IndexManagementPlugin implements Plugin { + const { renderApp } = await import("./index_management_app"); + const [coreStart, depsStart] = await core.getStartServices(); + return renderApp(coreStart, depsStart, params, defaultRoutes, dataSourceManagement); + }; + core.application.register({ - id: "opensearch_index_management_dashboards", - title: "Index Management", + id: `opensearch_index_management_dashboards_${encodeURIComponent(ROUTES.INDEX_POLICIES)}`, + title: "Indexes", + order: 8040, + category: ISM_category.indexes, + mount: async (params: AppMountParameters) => { + return mountWrapper(params, ROUTES.INDICES); + }, + }); + + core.application.register({ + id: `opensearch_index_management_dashboards_${encodeURIComponent(ROUTES.DATA_STREAMS)}`, + title: "Data streams", + order: 8050, + category: ISM_category.indexes, + mount: async (params: AppMountParameters) => { + return mountWrapper(params, ROUTES.DATA_STREAMS); + }, + }); + + core.application.register({ + id: `opensearch_index_management_dashboards_${encodeURIComponent(ROUTES.ALIASES)}`, + title: "Index alias", + order: 8060, + category: ISM_category.indexes, + mount: async (params: AppMountParameters) => { + return mountWrapper(params, ROUTES.ALIASES); + }, + }); + + core.application.register({ + id: `opensearch_index_management_dashboards`, + title: "Index state management policies", order: 9010, - category: DEFAULT_APP_CATEGORIES.management, + category: ISM_category.indexes, mount: async (params: AppMountParameters) => { - const { renderApp } = await import("./index_management_app"); - const [coreStart, depsStart] = await core.getStartServices(); - return renderApp(coreStart, depsStart, params, ROUTES.INDEX_POLICIES, dataSourceManagement); + return mountWrapper(params, ROUTES.INDEX_POLICIES); + }, + }); + + core.application.register({ + id: `opensearch_index_management_dashboards_${encodeURIComponent(ROUTES.TEMPLATES)}`, + title: "Index templates", + order: 9011, + category: ISM_category.indexes, + mount: async (params: AppMountParameters) => { + return mountWrapper(params, ROUTES.TEMPLATES); + }, + }); + + core.application.register({ + id: `opensearch_index_management_dashboards_${encodeURIComponent(ROUTES.NOTIFICATIONS)}`, + title: "Index notification settings", + order: 9012, + category: ISM_category.indexes, + mount: async (params: AppMountParameters) => { + return mountWrapper(params, ROUTES.NOTIFICATIONS); + }, + }); + + core.application.register({ + id: `opensearch_index_management_dashboards_${encodeURIComponent(ROUTES.ROLLUPS)}`, + title: "Rollup jobs", + order: 9013, + category: ISM_category.indexes, + mount: async (params: AppMountParameters) => { + return mountWrapper(params, ROUTES.ROLLUPS); + }, + }); + + core.application.register({ + id: `opensearch_index_management_dashboards_${encodeURIComponent(ROUTES.TRANSFORMS)}`, + title: "Transform jobs", + order: 9014, + category: ISM_category.indexes, + mount: async (params: AppMountParameters) => { + return mountWrapper(params, ROUTES.TRANSFORMS); }, }); core.application.register({ id: "opensearch_snapshot_management_dashboards", - title: "Snapshot Management", + title: "Index snapshots", order: 9020, - category: DEFAULT_APP_CATEGORIES.management, + category: ISM_category.backup, + mount: async (params: AppMountParameters) => { + return mountWrapper(params, ROUTES.SNAPSHOT_POLICIES); + }, + }); + + core.application.register({ + id: `opensearch_index_management_dashboards_${encodeURIComponent(ROUTES.SNAPSHOT_POLICIES)}`, + title: "Index snapshot policies", + order: 9030, + category: ISM_category.backup, + mount: async (params: AppMountParameters) => { + return mountWrapper(params, ROUTES.SNAPSHOT_POLICIES); + }, + }); + + core.application.register({ + id: `opensearch_index_management_dashboards_${encodeURIComponent(ROUTES.REPOSITORIES)}`, + title: "Index snapshot repositories", + order: 9040, + category: ISM_category.backup, mount: async (params: AppMountParameters) => { - const { renderApp } = await import("./index_management_app"); - const [coreStart, depsStart] = await core.getStartServices(); - return renderApp(coreStart, depsStart, params, ROUTES.SNAPSHOT_POLICIES, dataSourceManagement); + return mountWrapper(params, ROUTES.REPOSITORIES); }, });