elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.68k stars 8.23k forks source link

[Dashboard] Clicking on edit on upgraded dashboard makes panel options menu go blank for visualize panels #197915

Open bhavyarm opened 1 month ago

bhavyarm commented 1 month ago

Kibana version: 8.16.0 BC2/serverless main QA

Browser version: chrome latest

Browser OS version: OS X

Original install method (e.g. download page, yum, from source, etc.): from staging

Describe the bug: Clicking on edit on upgraded dashboard and then converting one the panels to lens and discarding the change in dashboard makes the panel options for visualize go blank(?)

I am attaching the saved object for the dashboard. In this dashboard -> I clicked on edit -> clicked on convert to lens on "Logstash area chart" -> lens-> save and return to dashboard -> switch to view mode -> the panel options on all the visualize panels went blank.

Image

This is the error in browser console:

dashboardEnhanced.plugin.js:2 Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'events')
    at flyout_edit_drilldown_FlyoutEditDrilldownAction.isCompatible (dashboardEnhanced.plugin.js:2:10782)
    at action_internal_ActionInternal.isCompatible (uiActions.plugin.js:1:11957)
    at uiActions.plugin.js:1:22522
    at Array.map (<anonymous>)
    at ui_actions_service_UiActionsService.getTriggerCompatibleActions (uiActions.plugin.js:1:22512)
    at presentationPanel.chunk.1.js:1:709
    at presentationPanel.chunk.1.js:1:775
    at presentationPanel.chunk.1.js:1:1144
    at Xc (kbn-ui-shared-deps-npm.dll.js:429:106131)
    at kbn-ui-shared-deps-npm.dll.js:437:3768

saved object export: export_dashboard_6.8.ndjson.zip

elasticmachine commented 1 month ago

Pinging @elastic/kibana-visualizations (Team:Visualizations)

markov00 commented 4 weeks ago

Hey @Heenawter , do you have an idea what is going on there? do you believe is something that we are wrongly sending/calling on our end?

Heenawter commented 4 weeks ago

Based on the console error, it seems like the "convert to Lens" action is somehow dropping the events key from the dynamicActionsState- i.e. the dynamic actions state looks something like dynamicActions: {} which is causing the isCompatible check to fail because it always assumes that dynamicActions has an events key.

Once the Lens embeddable gets converted and it uses startDynamicActions, I imagine this will be resolved - but in the mean time, we could change the isCompatible method to treat the events key as optional... i.e. make the following change:

https://github.com/elastic/kibana/blob/0220874130fd9bb900d2d262d6e415f5a9e1bd7c/x-pack/plugins/dashboard_enhanced/public/services/drilldowns/actions/flyout_edit_drilldown/flyout_edit_drilldown.tsx#L75-L78

  public async isCompatible({ embeddable }: EmbeddableApiContext) {
    if (!isApiCompatible(embeddable) || getInheritedViewMode(embeddable) !== 'edit') return false;
    return (embeddable.dynamicActionsState$.getValue()?.dynamicActions?.events ?? []).length > 0;
  }

cc @nreese