Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[8.15] [maps] fix Upgraded maps panel displays Cannot create Abstract…
…ESSourceDescriptor when indexPatternId is not provided error and no data (#199690) (#199855) # Backport This will backport the following commits from `main` to `8.15`: - [[maps] fix Upgraded maps panel displays Cannot create AbstractESSourceDescriptor when indexPatternId is not provided error and no data (#199690)](#199690) <!--- Backport version: 9.4.3 --> ### Questions ? Please refer to the [Backport tool documentation](https://github.com/sqren/backport) <!--BACKPORT [{"author":{"name":"Nathan Reese","email":"[email protected]"},"sourceCommit":{"committedDate":"2024-11-12T18:19:40Z","message":"[maps] fix Upgraded maps panel displays Cannot create AbstractESSourceDescriptor when indexPatternId is not provided error and no data (#199690)\n\nCloses https://github.com/elastic/kibana/issues/191777\r\n\r\nIn 8.15, map embeddable was migrated from a legacy embeddable to a react\r\nembeddable. This changed reference injection. See below for details.\r\nTLDR is that legacy embeddables pass all references to the embeddable\r\nfactory when no references for the panel exist. React embeddables just\r\npass an empty reference list regardless of if panel references exist or\r\nnot.\r\n\r\n[Reference injection with legacy\r\nembeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/common/dashboard_container/persistable_state/dashboard_container_references.ts#L53)\r\n```\r\nworkingState.panels[key] = { ...panel };\r\nconst filteredReferences = getReferencesForPanelId(key, references);\r\nconst panelReferences = filteredReferences.length === 0 ? references : filteredReferences;\r\n```\r\n\r\n[Reference injection with react\r\nembeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx#L835)\r\n```\r\n const rawState = this.getInput().panels[childId].explicitInput;\r\n const { id, ...serializedState } = rawState;\r\n if (!rawState || Object.keys(serializedState).length === 0) return;\r\n const references = getReferencesForPanelId(childId, this.savedObjectReferences);\r\n return {\r\n rawState,\r\n references,\r\n };\r\n```\r\n\r\n### Test instructions\r\n1) install dashboard from 7.17 saved objects from issue.\r\n2) Open dashboard. Verify data-view is found. Note, layer will not load\r\nsince your install has no index 'logstash-*', but reference problem has\r\nbeen fixed\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"80a9f40e25c1707d5c73c415b53648398febd646","branchLabelMapping":{"^v9.0.0$":"main","^v8.17.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:fix","Team:Presentation","v9.0.0","project:embeddableRebuild","backport:version","v8.17.0","v8.16.1","v8.15.5"],"title":"[maps] fix Upgraded maps panel displays Cannot create AbstractESSourceDescriptor when indexPatternId is not provided error and no data","number":199690,"url":"https://github.com/elastic/kibana/pull/199690","mergeCommit":{"message":"[maps] fix Upgraded maps panel displays Cannot create AbstractESSourceDescriptor when indexPatternId is not provided error and no data (#199690)\n\nCloses https://github.com/elastic/kibana/issues/191777\r\n\r\nIn 8.15, map embeddable was migrated from a legacy embeddable to a react\r\nembeddable. This changed reference injection. See below for details.\r\nTLDR is that legacy embeddables pass all references to the embeddable\r\nfactory when no references for the panel exist. React embeddables just\r\npass an empty reference list regardless of if panel references exist or\r\nnot.\r\n\r\n[Reference injection with legacy\r\nembeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/common/dashboard_container/persistable_state/dashboard_container_references.ts#L53)\r\n```\r\nworkingState.panels[key] = { ...panel };\r\nconst filteredReferences = getReferencesForPanelId(key, references);\r\nconst panelReferences = filteredReferences.length === 0 ? references : filteredReferences;\r\n```\r\n\r\n[Reference injection with react\r\nembeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx#L835)\r\n```\r\n const rawState = this.getInput().panels[childId].explicitInput;\r\n const { id, ...serializedState } = rawState;\r\n if (!rawState || Object.keys(serializedState).length === 0) return;\r\n const references = getReferencesForPanelId(childId, this.savedObjectReferences);\r\n return {\r\n rawState,\r\n references,\r\n };\r\n```\r\n\r\n### Test instructions\r\n1) install dashboard from 7.17 saved objects from issue.\r\n2) Open dashboard. Verify data-view is found. Note, layer will not load\r\nsince your install has no index 'logstash-*', but reference problem has\r\nbeen fixed\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"80a9f40e25c1707d5c73c415b53648398febd646"}},"sourceBranch":"main","suggestedTargetBranches":["8.x","8.16","8.15"],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/199690","number":199690,"mergeCommit":{"message":"[maps] fix Upgraded maps panel displays Cannot create AbstractESSourceDescriptor when indexPatternId is not provided error and no data (#199690)\n\nCloses https://github.com/elastic/kibana/issues/191777\r\n\r\nIn 8.15, map embeddable was migrated from a legacy embeddable to a react\r\nembeddable. This changed reference injection. See below for details.\r\nTLDR is that legacy embeddables pass all references to the embeddable\r\nfactory when no references for the panel exist. React embeddables just\r\npass an empty reference list regardless of if panel references exist or\r\nnot.\r\n\r\n[Reference injection with legacy\r\nembeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/common/dashboard_container/persistable_state/dashboard_container_references.ts#L53)\r\n```\r\nworkingState.panels[key] = { ...panel };\r\nconst filteredReferences = getReferencesForPanelId(key, references);\r\nconst panelReferences = filteredReferences.length === 0 ? references : filteredReferences;\r\n```\r\n\r\n[Reference injection with react\r\nembeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx#L835)\r\n```\r\n const rawState = this.getInput().panels[childId].explicitInput;\r\n const { id, ...serializedState } = rawState;\r\n if (!rawState || Object.keys(serializedState).length === 0) return;\r\n const references = getReferencesForPanelId(childId, this.savedObjectReferences);\r\n return {\r\n rawState,\r\n references,\r\n };\r\n```\r\n\r\n### Test instructions\r\n1) install dashboard from 7.17 saved objects from issue.\r\n2) Open dashboard. Verify data-view is found. Note, layer will not load\r\nsince your install has no index 'logstash-*', but reference problem has\r\nbeen fixed\r\n\r\nCo-authored-by: Elastic Machine <[email protected]>","sha":"80a9f40e25c1707d5c73c415b53648398febd646"}},{"branch":"8.x","label":"v8.17.0","branchLabelMappingKey":"^v8.17.0$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.16","label":"v8.16.1","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"},{"branch":"8.15","label":"v8.15.5","branchLabelMappingKey":"^v(\\d+).(\\d+).\\d+$","isSourceBranch":false,"state":"NOT_CREATED"}]}] BACKPORT--> Co-authored-by: Nathan Reese <[email protected]>
- Loading branch information