Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MDS] Expose DataSourceMenu types for plugin consumption #6271

Closed
Tracked by #5872
derek-ho opened this issue Mar 26, 2024 · 3 comments
Closed
Tracked by #5872

[MDS] Expose DataSourceMenu types for plugin consumption #6271

derek-ho opened this issue Mar 26, 2024 · 3 comments
Labels
enhancement New feature or request multiple datasource multiple datasource project needs more info Requires more information from poster

Comments

@derek-ho
Copy link
Contributor

With the DataSourceMenu refactor, some changes were made to expose a common config for all types. However, this is currently taking in Any:

, so it is hard for plugins to consume this/know what to put as the type.

Can we expose the type to plugins and/or enforce it when passing in the value?

@derek-ho derek-ho added the enhancement New feature or request label Mar 26, 2024
@derek-ho
Copy link
Contributor Author

Same issue with constants. I am seeing the following error:

 ERROR in ./public/apps/configuration/top-nav-menu.tsx
       │          Module not found: Error: import [../../../../../src/plugins/data_source_management/public] references a public export of the [dataSourceManagement] bundle, but that bundle is not in the "requiredPlugins" or "requiredBundles" list in the plugin manifest [/Users/dxho/Desktop/OpenSearch-Dashboards/plugins/security-dashboards-plugin/opensearch_dashboards.json]
       │           @ ./public/apps/configuration/top-nav-menu.tsx 17:0-99 37:46-69 37:87-110
       │           @ ./public/apps/configuration/panels/auth-view/auth-view.tsx
       │           @ ./public/apps/configuration/app-router.tsx
       │           @ ./public/apps/configuration/configuration-app.tsx
       │           @ ./public/plugin.ts
       │           @ ./public/index.ts
       │           @ /Users/dxho/Desktop/OpenSearch-Dashboards/packages/osd-optimizer/target/worker/entry_point_creator.js

When trying to do:

import { DataSourceComponentType } from '../../../../../src/plugins/data_source_management/public';

@seraphjiang
Copy link
Member

@zhongnansu would you discuss with @derek-ho about this enhancement

@zhongnansu
Copy link
Member

@zhongnansu would you discuss with @derek-ho about this enhancement

@derek-ho Hi Derek, are you still having this issue? I think with the correct configType generic type passed in, when you first retrieve the DataSourceMenu component via API. It will enforce the componentConfig to use param from the configType you chose, otherwise it throws compile error

An example usage as shown in the MD picker example plugin

const DataSourceMenu = dataSourceManagement.ui.getDataSourceMenu<DataSourceSelectableConfig>();

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request multiple datasource multiple datasource project needs more info Requires more information from poster
Projects
None yet
Development

No branches or pull requests

4 participants