Use saved object references for dashboard drilldowns#82602
Use saved object references for dashboard drilldowns#82602Dosant merged 6 commits intoelastic:masterfrom
Conversation
There was a problem hiding this comment.
Not sure about this, but this seem to be working.
I had to decouple injectReferences from client side DashboardSavedObject class to reuse this on server.
Don't see any other way
There was a problem hiding this comment.
Do we have a naming convention for reference names?
There was a problem hiding this comment.
not yet, i agree it would be useful to have one
There was a problem hiding this comment.
can we create an issue to move this inside embeddable reference extraction (rather than having it here on dashboard) ?
There was a problem hiding this comment.
I added a comment and created a placeholder issue: 9cd13a8
I am not 100% sure though that it is possible without breaking changes and if this is required. This extract/inject now operates on dashboard panel specific data model and not on embeddable model.
9cd13a8 to
03ee1a6
Compare
| gridData: panelState.gridData, | ||
| panelIndex: panelState.explicitInput.id, | ||
| embeddableConfig: omit(panelState.explicitInput, ['id', 'savedObjectId']), | ||
| embeddableConfig: omit(panelState.explicitInput, ['id', 'savedObjectId', 'title']), |
There was a problem hiding this comment.
nit:
I noticed that title was not omitted even though it is copied on a root level of the object.
This is causing duplicate title in each panel of dashboard SO which caught my eye in new unit tests.
| Object { | ||
| "attributes": Object { | ||
| "foo": true, | ||
| "panelsJSON": "[{\\"embeddableConfig\\":{},\\"title\\":\\"Title 1\\",\\"panelRefName\\":\\"panel_0\\"},{\\"embeddableConfig\\":{},\\"title\\":\\"Title 2\\",\\"panelRefName\\":\\"panel_1\\"}]", |
There was a problem hiding this comment.
In each of these snapshots embeddableConfig:{} is added because now underlying code converts to EmbeddablePanel and then back. We don't clean up embeddableConfig when we convert from EmbeddablePanel to DashboardSavedPanel. I think having embeddableConfig is technically more correct and initial doc is just not in a complete shape.
Other option could be to remove embeddableConfig in convertSavedDashboardPanelToPanelState if there is no keys.
| export type PanelId = string; | ||
| export type SavedObjectId = string; | ||
|
|
||
| export interface DashboardPanelState< |
There was a problem hiding this comment.
Had to move this to common from public/type/i_container
Didn't move the whole file because it contains references to client side types
| plugins.uiActionsEnhanced.registerActionFactory({ | ||
| id: EMBEDDABLE_TO_DASHBOARD_DRILLDOWN, | ||
| inject: createInject({ drilldownId: EMBEDDABLE_TO_DASHBOARD_DRILLDOWN }), | ||
| extract: createExtract({ drilldownId: EMBEDDABLE_TO_DASHBOARD_DRILLDOWN }), |
There was a problem hiding this comment.
This is an important bit:
We register a EMBEDDABLE_TO_DASHBOARD_DRILLDOWN server side counter part which provides extract/inject functions which will be used by dashboard migrations via EmbeddablePersistableStateService
| "hits": 0, | ||
| "description": "", | ||
| "panelsJSON": "[{}]", | ||
| "panelsJSON": "[]", |
There was a problem hiding this comment.
{} is definitely invalid panel shape :D
New dashboard migration failed because of this.
Previously this would have failed on dashboard app open.
Alternatively we could make sure that migration can swallow {}, but I am not sure what is a recommended approach?
There was a problem hiding this comment.
Similarly there is single change in x-pack/test/functional/es_archives/reporting/hugedata/data.json.gz which started failing during import. There was a typo in a reference name: Fanel_1 reference instead of panel_1 which led to test failures.
I just updated the data as I guess we should fail the migration in such case.
| "version": 1 | ||
| }, | ||
| "references": [ | ||
| { "id": "sample_visualization", "name": "panel_0", "type": "visualization" }, |
There was a problem hiding this comment.
Same as #82602 (comment) and other x-pack/test/ingest_manager_api_integration/apis/fixtures/test_packages/all_assets/*. The sample dashboard JSON was incorrect as was missing references array and new migration failed when importing these sample dashboards.
proc [kibana] log [19:25:34.199] [error][ingestManager][plugins] Error: Could not find reference "panel_0"
[00:05:19] │ proc [kibana] at panels.forEach.panel (/dev/shm/workspace/kibana-build-xpack-9/src/plugins/dashboard/common/saved_dashboard_references.js:105:13)
|
Pinging @elastic/kibana-app-arch (Team:AppArch) |
ThomThomson
left a comment
There was a problem hiding this comment.
Code LGTM - plenty of test coverage! Tested in chrome and everything still works as expected. Ensured saved object references were being registered properly for dashboard drilldowns. Didn't test the migrations, but the tests seem robust!
|
Tested the following cases after creating drilldowns in 7.10 and running ES 8.0.0 with data pointed towards 7.10. Thanks @ThomThomson cc @LeeDr
|
|
@elasticmachine merge upstream |
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Distributable file count
Page load bundle
History
To update your PR or re-run it, just comment with: |
* master:
[Ingest Manager] Lift up registry/{stream,extract} functions (elastic#83239)
[Reporting] Move "common" types and constants to allow cross-plugin integration (elastic#83198)
[Lens] Add suffix formatter (elastic#82852)
[App Search] Version documentation links (elastic#83245)
Use saved object references for dashboard drilldowns (elastic#82602)
Btsymbala/registered av (elastic#81910)
[APM] Errors table for service overview (elastic#83065)
Summary
Closes #71409
This PR integrates embeddables persistable state service with dashboard app to handle references to other dashboards created by dashboard drilldowns.
In addition to extracting and injecting references on a client-side dashboard, this pr also adds a
7.11.0dashboard migration that extracts dashboardIds from existing drilldowns and puts them to dashboard's references. To achieve this bunch of client-side dashboard/embeddable code had to be moved to common to be reused on the client-side.Release Notes
Dashboards connected via drilldowns are now exported or copied to a different space together.
Checklist
Delete any items that are not applicable to this PR.
For maintainers