From b03ac148231fdf187879eec16f0b73d2fed7fb33 Mon Sep 17 00:00:00 2001 From: Junqiu Lei Date: Fri, 13 Jan 2023 18:10:30 -0800 Subject: [PATCH] Add OpenSearch Dashboards context to component and common folder changes (#209) Signed-off-by: Junqiu Lei Signed-off-by: Junqiu Lei --- .opensearch_dashboards-plugin-helpers.json | 10 +++++++++ public/plugin.tsx | 25 ++++++++++++++-------- tsconfig.json | 1 + 3 files changed, 27 insertions(+), 9 deletions(-) create mode 100644 .opensearch_dashboards-plugin-helpers.json diff --git a/.opensearch_dashboards-plugin-helpers.json b/.opensearch_dashboards-plugin-helpers.json new file mode 100644 index 00000000..5b079101 --- /dev/null +++ b/.opensearch_dashboards-plugin-helpers.json @@ -0,0 +1,10 @@ +{ + "serverSourcePatterns": [ + "package.json", + "tsconfig.json", + "yarn.lock", + ".yarnrc", + "{lib,public,server,webpackShims,translations,utils,models,test,common}/**/*", + "!__tests__" + ] +} diff --git a/public/plugin.tsx b/public/plugin.tsx index 6b4f8526..ee892f07 100644 --- a/public/plugin.tsx +++ b/public/plugin.tsx @@ -8,7 +8,6 @@ import { AppMountParameters, CoreSetup, CoreStart, - DEFAULT_APP_CATEGORIES, Plugin, PluginInitializerContext, } from '../../../src/core/public'; @@ -24,10 +23,10 @@ import { PLUGIN_NAVIGATION_BAR_TILE, } from '../common/constants/shared'; import { ConfigSchema } from '../common/config'; - import { AppPluginSetupDependencies } from './types'; import { RegionMapVisualizationDependencies } from '../../../src/plugins/region_map/public'; import { VectorUploadOptions } from './components/vector_upload_options'; +import { OpenSearchDashboardsContextProvider } from '../../../src/plugins/opensearch_dashboards_react/public'; export class CustomImportMapPlugin implements Plugin { @@ -80,13 +79,21 @@ export class CustomImportMapPlugin }, }); - regionMap.addOptionTab({ - name: 'controls', - title: i18n.translate('regionMap.mapVis.regionMapEditorConfig.controlTabs.controlsTitle', { - defaultMessage: 'Import Vector Map', - }), - editor: (props: RegionMapVisualizationDependencies) => , - }); + const customSetup = async () => { + const [coreStart] = await core.getStartServices(); + regionMap.addOptionTab({ + name: 'controls', + title: i18n.translate('regionMap.mapVis.regionMapEditorConfig.controlTabs.controlsTitle', { + defaultMessage: 'Import Vector Map', + }), + editor: (props: RegionMapVisualizationDependencies) => ( + + + + ), + }); + }; + customSetup(); // Return methods that should be available to other plugins return { diff --git a/tsconfig.json b/tsconfig.json index 01fa7676..4bb3727a 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -48,6 +48,7 @@ "types": ["node", "jest", "react"] }, "include": [ + "common/**/*", "server/**/*", "public/**/*", "utils/**/*",