Skip to content

Commit

Permalink
Add OpenSearch Dashboards context to component and common folder chan…
Browse files Browse the repository at this point in the history
…ges (opensearch-project#209)

Signed-off-by: Junqiu Lei <[email protected]>

Signed-off-by: Junqiu Lei <[email protected]>
  • Loading branch information
junqiu-lei authored Jan 14, 2023
1 parent 535a002 commit b03ac14
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 9 deletions.
10 changes: 10 additions & 0 deletions .opensearch_dashboards-plugin-helpers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"serverSourcePatterns": [
"package.json",
"tsconfig.json",
"yarn.lock",
".yarnrc",
"{lib,public,server,webpackShims,translations,utils,models,test,common}/**/*",
"!__tests__"
]
}
25 changes: 16 additions & 9 deletions public/plugin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import {
AppMountParameters,
CoreSetup,
CoreStart,
DEFAULT_APP_CATEGORIES,
Plugin,
PluginInitializerContext,
} from '../../../src/core/public';
Expand All @@ -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<CustomImportMapPluginSetup, CustomImportMapPluginStart> {
Expand Down Expand Up @@ -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) => <VectorUploadOptions {...props} />,
});
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) => (
<OpenSearchDashboardsContextProvider services={coreStart}>
<VectorUploadOptions {...props} />
</OpenSearchDashboardsContextProvider>
),
});
};
customSetup();

// Return methods that should be available to other plugins
return {
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
"types": ["node", "jest", "react"]
},
"include": [
"common/**/*",
"server/**/*",
"public/**/*",
"utils/**/*",
Expand Down

0 comments on commit b03ac14

Please sign in to comment.