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

Module Issue with useOpensearchDashboards method #5

Conversation

keskami
Copy link
Collaborator

@keskami keskami commented Nov 24, 2023

Description

for review, when using useOpensearchDashboards to find all saved objects, I get this error:
Module not found: Error: Can't resolve 'src/plugins/opensearch_dashboards_react/public' in '/Users/kk/Desktop/Github/OpenSearch-Dashboards/src/plugins/vis_type_drilldown/public'

Other than that, added a EuiSuperSelect which will eventually hold the saved objects

Issues Resolved

Screenshot

Error:
Screen Shot 2023-11-23 at 2 37 49 PM

Testing the changes

Check List

  • All tests pass
    • yarn test:jest
    • yarn test:jest_integration
  • New functionality includes testing.
  • New functionality has been documented.
  • Update CHANGELOG.md
  • Commits are signed per the DCO using --signoff

Signed-off-by: keskami <kkak808@gmail.com>
Copy link

@joshuarrrr joshuarrrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@keskami Close! Just 3 issues that were causing the error.

Comment on lines 16 to 17
"optionalPlugins": [],
"requiredBundles": ["opensearchDashboardsUtils", "opensearchDashboardsReact", "home"]

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No need to add these required bundles, as opensearchDashboardsReact is already in the requiredPlugins section. We may eventually decide to move it to requiredBundles, but it should only be in one or the other.

Suggested change
"optionalPlugins": [],
"requiredBundles": ["opensearchDashboardsUtils", "opensearchDashboardsReact", "home"]
"optionalPlugins": [],


import { VisOptionsProps } from 'src/plugins/vis_default_editor/public';
import { DrilldownVisParams } from './types';
import { useOpenSearchDashboards } from 'src/plugins/opensearch_dashboards_react/public';

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking at most other imports, I think this needs to be relative:

Suggested change
import { useOpenSearchDashboards } from 'src/plugins/opensearch_dashboards_react/public';
import { useOpenSearchDashboards } from '../../opensearch_dashboards_react/public';

Comment on lines 30 to 34
services: { savedObjectsClient },
} = useOpenSearchDashboards<DrilldownServices>();

useEffect(() => {
const saved = savedObjectsClient.find({

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's not quite the right format for the service. It should be:

Suggested change
services: { savedObjectsClient },
} = useOpenSearchDashboards<DrilldownServices>();
useEffect(() => {
const saved = savedObjectsClient.find({
services: { savedObjects },
} = useOpenSearchDashboards<DrilldownServices>();
useEffect(() => {
const saved = savedObjects?.client.find({

…rds'

Signed-off-by: keskami <kkak808@gmail.com>
@keskami keskami closed this Nov 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants