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

[Lens] Saved object should register reference to index patterns to keep exports/imports consistent #55906

Closed
wylieconlon opened this issue Jan 24, 2020 · 4 comments · Fixed by #74523
Assignees
Labels
Feature:Lens Feature:Saved Objects Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@wylieconlon
Copy link
Contributor

wylieconlon commented Jan 24, 2020

Related issues:

This has the following parts:

  • Extend getPersistableState to return saved objects references as well. The persistable state object shouldn't include any actual saved object ids, only the names referenced in the reference array. E.g. getPersistableState(state: T) => { persistableState: T2, references: SavedObjectReference[]}
  • Extend initialize by taking that reference array to put the actual saved object ids back into the state. e.g. initialize(persistedState: T2, references: SavedObjectReference[]) => Promise<T>
  • Do the same thing for the frame level state (filters). Might be possible to reuse some logic from the data plugin, but not necessarily
  • Concatenate all saved object reference arrays before saving the saved object
  • Do not save the expression in the saved object. Instead refactor the embeddable to initialize the right visualization and data source based on the state and call toExpression on them to get the expression. x-pack/plugins/lens/public/editor_frame_service/editor_frame/expression_helpers.ts contains helpers to piece together the expression
  • Add a migration to remove the expression from all saved objects
  • Add a migration to pull out saved object references from existing saved objects (basically run the getPersistableState function)
@wylieconlon wylieconlon added Feature:Lens Feature:Saved Objects Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Jan 24, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-app (Team:KibanaApp)

@wylieconlon
Copy link
Contributor Author

@timroes I don't have a clear idea of the implications of this change on our saved object format. It seems like we will need to write some logic that keeps references and our app state consistent.

@timroes timroes self-assigned this Feb 4, 2020
@timroes timroes removed their assignment May 19, 2020
@timroes
Copy link
Contributor

timroes commented Jul 21, 2020

The final implementation of this service outlined in (#59960) will be part of the persistable state service (#62950) - also see Expression Roadmap (#46909). Since this implementation will still take some time, we've decided to provide a minimal simplified inject/extract inside Lens, that will extract references from the esaggs and the kibana_context (inside filters) function. This functions should ideally follow the API outlined in #59960 so we can later simply replace them by the real API once ready.

@timroes
Copy link
Contributor

timroes commented Jul 21, 2020

The related PR: #72438

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Lens Feature:Saved Objects Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants