Skip to content

Commit

Permalink
[maps] fix Upgraded maps panel displays Cannot create AbstractESSourc…
Browse files Browse the repository at this point in the history
…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 <[email protected]>
(cherry picked from commit 80a9f40)
  • Loading branch information
nreese committed Nov 12, 2024
1 parent 780a9f2 commit f9ef006
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -876,7 +876,9 @@ export class DashboardContainer
const references = getReferencesForPanelId(childId, this.savedObjectReferences);
return {
rawState,
references,
// references from old installations may not be prefixed with panel id
// fall back to passing all references in these cases to preserve backwards compatability
references: references.length > 0 ? references : this.savedObjectReferences,
};
};

Expand Down

0 comments on commit f9ef006

Please sign in to comment.