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

[maps] fix Upgraded maps panel displays Cannot create AbstractESSourceDescriptor when indexPatternId is not provided error and no data #199690

Merged
merged 2 commits into from
Nov 12, 2024

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Nov 11, 2024

Closes #191777

In 8.15, map embeddable was migrated from a legacy embeddable to a react embeddable. This changed reference injection. See below for details. TLDR is that legacy embeddables pass all references to the embeddable factory when no references for the panel exist. React embeddables just pass an empty reference list regardless of if panel references exist or not.

Reference injection with legacy embeddables

workingState.panels[key] = { ...panel };
const filteredReferences = getReferencesForPanelId(key, references);
const panelReferences = filteredReferences.length === 0 ? references : filteredReferences;

Reference injection with react embeddables

    const rawState = this.getInput().panels[childId].explicitInput;
    const { id, ...serializedState } = rawState;
    if (!rawState || Object.keys(serializedState).length === 0) return;
    const references = getReferencesForPanelId(childId, this.savedObjectReferences);
    return {
      rawState,
      references,
    };

Test instructions

  1. install dashboard from 7.17 saved objects from issue.
  2. Open dashboard. Verify data-view is found. Note, layer will not load since your install has no index 'logstash-*', but reference problem has been fixed

…eDescriptor when indexPatternId is not provided error and no data
@nreese nreese requested a review from a team as a code owner November 11, 2024 18:49
@nreese nreese added release_note:fix Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v9.0.0 backport:version Backport to applied version labels v8.17.0 v8.16.1 v8.15.5 labels Nov 11, 2024
@elasticmachine
Copy link
Contributor

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

@nreese
Copy link
Contributor Author

nreese commented Nov 11, 2024

@elasticmachine merge upstream

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

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

id before after diff
dashboard 646.0KB 646.1KB +56.0B

History

@nickpeihl nickpeihl self-requested a review November 12, 2024 12:58
Copy link
Member

@nickpeihl nickpeihl left a comment

Choose a reason for hiding this comment

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

lgtm! code review and tested with 7.17 saved object.

@nreese nreese merged commit 80a9f40 into elastic:main Nov 12, 2024
21 checks passed
@kibanamachine
Copy link
Contributor

Starting backport for target branches: 8.15, 8.16, 8.x

https://github.com/elastic/kibana/actions/runs/11803327214

kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 12, 2024
…eDescriptor when indexPatternId is not provided error and no data (elastic#199690)

Closes elastic#191777

In 8.15, map embeddable was migrated from a legacy embeddable to a react
embeddable. This changed reference injection. See below for details.
TLDR is that legacy embeddables pass all references to the embeddable
factory when no references for the panel exist. React embeddables just
pass an empty reference list regardless of if panel references exist or
not.

[Reference injection with legacy
embeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/common/dashboard_container/persistable_state/dashboard_container_references.ts#L53)
```
workingState.panels[key] = { ...panel };
const filteredReferences = getReferencesForPanelId(key, references);
const panelReferences = filteredReferences.length === 0 ? references : filteredReferences;
```

[Reference injection with react
embeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx#L835)
```
    const rawState = this.getInput().panels[childId].explicitInput;
    const { id, ...serializedState } = rawState;
    if (!rawState || Object.keys(serializedState).length === 0) return;
    const references = getReferencesForPanelId(childId, this.savedObjectReferences);
    return {
      rawState,
      references,
    };
```

### Test instructions
1) install dashboard from 7.17 saved objects from issue.
2) Open dashboard. Verify data-view is found. Note, layer will not load
since your install has no index 'logstash-*', but reference problem has
been fixed

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit 80a9f40)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 12, 2024
…eDescriptor when indexPatternId is not provided error and no data (elastic#199690)

Closes elastic#191777

In 8.15, map embeddable was migrated from a legacy embeddable to a react
embeddable. This changed reference injection. See below for details.
TLDR is that legacy embeddables pass all references to the embeddable
factory when no references for the panel exist. React embeddables just
pass an empty reference list regardless of if panel references exist or
not.

[Reference injection with legacy
embeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/common/dashboard_container/persistable_state/dashboard_container_references.ts#L53)
```
workingState.panels[key] = { ...panel };
const filteredReferences = getReferencesForPanelId(key, references);
const panelReferences = filteredReferences.length === 0 ? references : filteredReferences;
```

[Reference injection with react
embeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx#L835)
```
    const rawState = this.getInput().panels[childId].explicitInput;
    const { id, ...serializedState } = rawState;
    if (!rawState || Object.keys(serializedState).length === 0) return;
    const references = getReferencesForPanelId(childId, this.savedObjectReferences);
    return {
      rawState,
      references,
    };
```

### Test instructions
1) install dashboard from 7.17 saved objects from issue.
2) Open dashboard. Verify data-view is found. Note, layer will not load
since your install has no index 'logstash-*', but reference problem has
been fixed

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit 80a9f40)
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Nov 12, 2024
…eDescriptor when indexPatternId is not provided error and no data (elastic#199690)

Closes elastic#191777

In 8.15, map embeddable was migrated from a legacy embeddable to a react
embeddable. This changed reference injection. See below for details.
TLDR is that legacy embeddables pass all references to the embeddable
factory when no references for the panel exist. React embeddables just
pass an empty reference list regardless of if panel references exist or
not.

[Reference injection with legacy
embeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/common/dashboard_container/persistable_state/dashboard_container_references.ts#L53)
```
workingState.panels[key] = { ...panel };
const filteredReferences = getReferencesForPanelId(key, references);
const panelReferences = filteredReferences.length === 0 ? references : filteredReferences;
```

[Reference injection with react
embeddables](https://github.com/elastic/kibana/blob/8.15/src/plugins/dashboard/public/dashboard_container/embeddable/dashboard_container.tsx#L835)
```
    const rawState = this.getInput().panels[childId].explicitInput;
    const { id, ...serializedState } = rawState;
    if (!rawState || Object.keys(serializedState).length === 0) return;
    const references = getReferencesForPanelId(childId, this.savedObjectReferences);
    return {
      rawState,
      references,
    };
```

### Test instructions
1) install dashboard from 7.17 saved objects from issue.
2) Open dashboard. Verify data-view is found. Note, layer will not load
since your install has no index 'logstash-*', but reference problem has
been fixed

Co-authored-by: Elastic Machine <elasticmachine@users.noreply.github.com>
(cherry picked from commit 80a9f40)
@kibanamachine
Copy link
Contributor

💚 All backports created successfully

Status Branch Result
8.15
8.16
8.x

Note: Successful backport PRs will be merged automatically after passing CI.

Questions ?

Please refer to the Backport tool documentation

kibanamachine added a commit that referenced this pull request Nov 12, 2024
…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":"reese.nathan@elastic.co"},"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
<elasticmachine@users.noreply.github.com>","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
<elasticmachine@users.noreply.github.com>","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
<elasticmachine@users.noreply.github.com>","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 <reese.nathan@elastic.co>
kibanamachine added a commit that referenced this pull request Nov 12, 2024
…SSourceDescriptor when indexPatternId is not provided error and no data (#199690) (#199857)

# Backport

This will backport the following commits from `main` to `8.x`:
- [[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":"reese.nathan@elastic.co"},"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
<elasticmachine@users.noreply.github.com>","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
<elasticmachine@users.noreply.github.com>","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
<elasticmachine@users.noreply.github.com>","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 <reese.nathan@elastic.co>
kibanamachine added a commit that referenced this pull request Nov 12, 2024
…ESSourceDescriptor when indexPatternId is not provided error and no data (#199690) (#199856)

# Backport

This will backport the following commits from `main` to `8.16`:
- [[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":"reese.nathan@elastic.co"},"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
<elasticmachine@users.noreply.github.com>","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
<elasticmachine@users.noreply.github.com>","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
<elasticmachine@users.noreply.github.com>","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 <reese.nathan@elastic.co>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
4 participants