Skip to content

[dashboard as code] move visualize embeddable reference handling to server#234249

Merged
nreese merged 35 commits intoelastic:mainfrom
nreese:vis_embeddable_transforms
Sep 19, 2025
Merged

[dashboard as code] move visualize embeddable reference handling to server#234249
nreese merged 35 commits intoelastic:mainfrom
nreese:vis_embeddable_transforms

Conversation

@nreese
Copy link
Contributor

@nreese nreese commented Sep 7, 2025

PR moves visualize embeddable reference handling to the server.

dashboard CRUD APIs no longer contain references from visualize panels. In the screen shot below, notice how savedSearchId and index fields contain saved object ids and are not references. Notice how the reference array for the dashboard is empty.
Screenshot 2025-09-10 at 6 04 00 AM

References are extracted on server and stored in dashboard saved object. In the screen shot below, notice how savedSearchId has been replaced with savedSearchRefName and points to a reference that contains the saved objec tid. Notice how index has been replaced with indexRefName and points to a reference that contains the saved object id.
Screenshot 2025-09-10 at 6 07 27 AM

@nreese nreese mentioned this pull request Sep 9, 2025
@nreese
Copy link
Contributor Author

nreese commented Sep 9, 2025

/ci

@nreese nreese requested a review from a team as a code owner September 10, 2025 14:12
@nreese nreese added Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting Project:Dashboards API v9.2.0 labels Sep 10, 2025
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-presentation (Team:Presentation)

@elasticmachine
Copy link
Contributor

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

@nreese
Copy link
Contributor Author

nreese commented Sep 12, 2025

@elasticmachine merge upstream

@nreese
Copy link
Contributor Author

nreese commented Sep 15, 2025

@elasticmachine merge upstream

};
}

throw new Error('Unable to inject references from Visualization state, unexpected state');
Copy link
Contributor

Choose a reason for hiding this comment

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

I faced this error when saving a new Visualize chart into a dashboard (chosing Add to New dashboard)

[2025-09-16T12:08:25.551+02:00][WARN ][plugins.dashboard] Unable to transform "visualization" embeddable state on read. Error: Unable to inject references from Visualization state, unexpected state

I get that with both a dataView or a saved search selected as data source.
No visible error on the chart

Copy link
Contributor Author

@nreese nreese Sep 16, 2025

Choose a reason for hiding this comment

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

resolved in 580ccbf

The warnings where logged when opening the visualize save model. The save modal has a dashboard selector. The selections are populated by fetching the first 30 dashboards. Since these dashboards are read, their panel state is transformed. The warning was coming from "sample web logs dashboard". This dashboard has old state where "by-reference" saved object ids are saved outside of embeddable config. I updated the transforms to better handle this case.

Copy link
Contributor

Choose a reason for hiding this comment

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

Wait, why does it need to fetch the first 30 dashboards with all panels here?
Wouldn't be sufficient to fetch the same data as the Dashboard listing page?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Wait, why does it need to fetch the first 30 dashboards with all panels here?

I am not sure, that is just how the dashboards selector element is currently implemented. If you want to discuss that, we could open a separate issue since that is not related to this PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

created #235377 to track dashboard selector optimizations

@nreese
Copy link
Contributor Author

nreese commented Sep 16, 2025

@elasticmachine merge upstream

@nreese nreese requested a review from a team as a code owner September 16, 2025 16:06
@nreese nreese requested a review from dej611 September 16, 2025 16:10
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #16 / InfraOps App feature controls infrastructure security global infrastructure all privileges infrastructure landing page with data shows Wafflemap

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
visualizations 542 548 +6

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
visualizations 838 836 -2

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
maps 3.1MB 3.1MB -81.0B
visualizations 351.7KB 338.4KB -13.3KB
total -13.4KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
visualizations 37.8KB 37.9KB +124.0B
Unknown metric groups

API count

id before after diff
visualizations 870 868 -2

async chunk count

id before after diff
visualizations 18 17 -1

History

@nreese
Copy link
Contributor Author

nreese commented Sep 18, 2025

@elasticmachine merge upstream

Copy link
Contributor

@dej611 dej611 left a comment

Choose a reason for hiding this comment

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

Checked locally 👍

Copy link
Contributor

@jsanz jsanz left a comment

Choose a reason for hiding this comment

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

Presentation team changes look good to me (code review)

@nreese nreese merged commit 40c654a into elastic:main Sep 19, 2025
12 checks passed
CAWilson94 pushed a commit to CAWilson94/kibana that referenced this pull request Sep 24, 2025
…erver (elastic#234249)

PR moves visualize embeddable reference handling to the server.

dashboard CRUD APIs no longer contain references from visualize panels.
In the screen shot below, notice how `savedSearchId` and `index` fields
contain saved object ids and are not references. Notice how the
reference array for the dashboard is empty.
<img width="2047" height="1020" alt="Screenshot 2025-09-10 at 6 04
00 AM"
src="https://github.com/user-attachments/assets/eb0671e8-5dec-4285-b20d-0a5928b0aa93"
/>

References are extracted on server and stored in dashboard saved object.
In the screen shot below, notice how `savedSearchId` has been replaced
with `savedSearchRefName` and points to a reference that contains the
saved objec tid. Notice how `index` has been replaced with
`indexRefName` and points to a reference that contains the saved object
id.
<img width="2045" height="1015" alt="Screenshot 2025-09-10 at 6 07
27 AM"
src="https://github.com/user-attachments/assets/3442615d-d78d-4fc4-9980-073a7229ac30"
/>

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
niros1 pushed a commit that referenced this pull request Sep 30, 2025
…erver (#234249)

PR moves visualize embeddable reference handling to the server.

dashboard CRUD APIs no longer contain references from visualize panels.
In the screen shot below, notice how `savedSearchId` and `index` fields
contain saved object ids and are not references. Notice how the
reference array for the dashboard is empty.
<img width="2047" height="1020" alt="Screenshot 2025-09-10 at 6 04
00 AM"
src="https://github.com/user-attachments/assets/eb0671e8-5dec-4285-b20d-0a5928b0aa93"
/>

References are extracted on server and stored in dashboard saved object.
In the screen shot below, notice how `savedSearchId` has been replaced
with `savedSearchRefName` and points to a reference that contains the
saved objec tid. Notice how `index` has been replaced with
`indexRefName` and points to a reference that contains the saved object
id.
<img width="2045" height="1015" alt="Screenshot 2025-09-10 at 6 07
27 AM"
src="https://github.com/user-attachments/assets/3442615d-d78d-4fc4-9980-073a7229ac30"
/>

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
rylnd pushed a commit to rylnd/kibana that referenced this pull request Oct 17, 2025
…erver (elastic#234249)

PR moves visualize embeddable reference handling to the server.

dashboard CRUD APIs no longer contain references from visualize panels.
In the screen shot below, notice how `savedSearchId` and `index` fields
contain saved object ids and are not references. Notice how the
reference array for the dashboard is empty.
<img width="2047" height="1020" alt="Screenshot 2025-09-10 at 6 04
00 AM"
src="https://github.com/user-attachments/assets/eb0671e8-5dec-4285-b20d-0a5928b0aa93"
/>

References are extracted on server and stored in dashboard saved object.
In the screen shot below, notice how `savedSearchId` has been replaced
with `savedSearchRefName` and points to a reference that contains the
saved objec tid. Notice how `index` has been replaced with
`indexRefName` and points to a reference that contains the saved object
id.
<img width="2045" height="1015" alt="Screenshot 2025-09-10 at 6 07
27 AM"
src="https://github.com/user-attachments/assets/3442615d-d78d-4fc4-9980-073a7229ac30"
/>

---------

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
nreese added a commit that referenced this pull request Nov 5, 2025
…es lost when dashboard updated from listing page (#241893)

Closes #241891 for 9.2 branch.
Fix is same as #241381 althought
the root cause is different. This regression is cause by moving
reference handling to the server in
[links](#228511),
[maps](#234806), and [legacy
vis](#234249)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting Project:Dashboards API release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas t// Team:Visualizations Team label for Lens, elastic-charts, Graph, legacy editors (TSVB, Visualize, Timelion) t// v9.2.0

4 participants