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

[D&D] Add index pattern info when loading embeddable #2363

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions src/plugins/wizard/common/wizard_saved_object_attributes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,7 @@ export interface WizardSavedObjectAttributes extends SavedObjectAttributes {
visualizationState?: string;
styleState?: string;
version: number;
searchSourceFields?: {
index?: string;
};
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,8 +116,15 @@ export class WizardEmbeddable extends Embeddable<SavedObjectEmbeddableInput, Wiz
return;
}
const { visualization, style } = this.serializedState;

const vizStateWithoutIndex = JSON.parse(visualization);
const visualizationState = {
searchField: vizStateWithoutIndex.searchField,
activeVisualization: vizStateWithoutIndex.activeVisualization,
indexPattern: this.savedWizard?.searchSourceFields?.index,
};
const rootState = {
visualization: JSON.parse(visualization),
visualization: visualizationState,
style: JSON.parse(style),
};
const visualizationName = rootState.visualization?.activeVisualization?.name ?? '';
Expand Down