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

Add visualization to Dashboard without saving - prototype #59645

Closed
1 task done
majagrubic opened this issue Mar 9, 2020 · 4 comments
Closed
1 task done

Add visualization to Dashboard without saving - prototype #59645

majagrubic opened this issue Mar 9, 2020 · 4 comments
Assignees
Labels
dev Feature:Dashboard Dashboard related features roadmap Team:Visualizations Visualization editors, elastic-charts and infrastructure

Comments

@majagrubic
Copy link
Contributor

majagrubic commented Mar 9, 2020

Context

When adding a visualization to the dashboard, we'd like to hide this visualization from the end user. From the end user perspective, this visualization doesn't exist in the Visualize app, but only in the context of the dashboard.

Rationale

The current way of adding visualizations to the dashboard is very cumbersome. the users need to create the visualization, name it, save it and then add it to the dashboard. we'd like to remove the last two steps from the end user. from user's point of view, they will be creating the visualization for the dashboard and that's it. we will still save it in the background with some autogenerated title (for now), but as far as the end user is concerned, this doesn't exist outside of the dashboard. if they delete it, yes, they'll need to recreate it. existing visualizations shouldn't be affected, no need to hide them.

Implementation Options

Option 1: visible flag on saved object

PR here: #59645

This is a pretty simple implementation except that it's not what we want in the long run.

Cons:

  • There is no way to simple migrate these hidden visualizations. The path forward would be to just remove the hidden flag and all visualizations would then become shown.
  • They require management/auto deletion is difficult and error prone. Dangling visualizations would be possible. An option to delete the "orphaned" visualizations would be to run the cleanup on the server start. Or the user would have to go to the saved object management screen to actually delete them (they would be visible there)

Option 2: Embeddables by value (#52682)

This is the implementation we want in the long run. Implementation steps:

  • Be able to easily retrieve serializable saved vis object from Visualize Editor
  • Create a new embeddable from Vis Editor and add to current dashboard (POC implementation of this communication here). @ppisljar also has some ideas on making this even more generic with a callback, so the same flow could hypothetically work from Canvas.
  • Export saved object references from Embeddables. This should be pretty simple, just adding a references object to the EmbeddableOutput interface and each implementation having to opt in to that. This is already needed for Canvas workpad exports to include all references.
  • Migration plan. We don't need to have a generic migration system implemented, though it's important for other reasons. In the mean time we do need to have a path forward. That path is creating a new embeddable type and adding ad hoc migrations within the embeddable itself. Would be something like:
class VisualizeByValueV2EmbeddableFactory {
  cereate(visSavedObjectV2: VisSavedObjectV2) {
    return getFactory(VisualizeByValueV2EmbeddableFactory).create(migrateVisSavedObjectV2ToV3(visSavedObjectV2));
  }

class VisualizeByValueV3EmbeddableFactory {
  create(visSavedObject: VisSavedObjectV3) {
    return new VisualizeByValueV3(visSavedObject)
  }

Anyone on Kibana App that might write a saved object migration needs to be aware that they will have to add this manually to the embeddable until we come up with a better generic system.

@majagrubic majagrubic added the Team:Visualizations Visualization editors, elastic-charts and infrastructure label Mar 9, 2020
@elasticmachine
Copy link
Contributor

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

@kobelb
Copy link
Contributor

kobelb commented Jun 9, 2020

Option 1 has potential ramifications for how the @elastic/kibana-security team has RBAC implemented currently and introduces complexities when it comes to sharing saved-objects with references. When discussing this approach previously, I was under the impression this had enough complexities that Option 2 was more favorable. Is this still correct?

@stacey-gammon
Copy link
Contributor

Yep! The team is going with Option 2. @majagrubic I feel like that discussion and decision was documented somewhere in github. Do you know if there is a more updated issue? Maybe this one can be closed and pointed to that one? or if not, the context of the discussion and decision posted here?

@majagrubic
Copy link
Contributor Author

I am not sure if we had another issue around this. I created an issue for tracking "Visualization By Value" track of work and have linked it above. Will close this issue in favor of that one.

@majagrubic majagrubic changed the title Add visualization to Dashboard without saving Add visualization to Dashboard without saving - prototype Jun 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
dev Feature:Dashboard Dashboard related features roadmap Team:Visualizations Visualization editors, elastic-charts and infrastructure
Projects
None yet
Development

No branches or pull requests

5 participants