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

[Dashboard] Export appropriate references from byValue panels #91567

Merged
merged 9 commits into from
Feb 24, 2021

Conversation

crob611
Copy link
Contributor

@crob611 crob611 commented Feb 16, 2021

If a dashboard has a byValue panel, since that panel is not backed by a saved object, any references from that panel should be added as a reference to the dashboard. This will ensure that the saved dashboard has the appropriate references for viewing relationships and exporting, etc.

#82602 added inject/extract from embeddable plugin persistable state service, so this PR just adds the extract method to lens, maps, and visualize embeddable factories.

We will need to follow up on this, as the extract methods should alter the input with the references removed, but , we will need to come up with a way for the reference names to be unique since there could be many in a single dashboard. (Example: visualize always uses 'kibanaSavedObjectMeta.searchSourceJSON.index' as the reference name for it's index patterns, so if there were multiple visualizations, with multiple index-patterns, after extract we would not know how to put them back together since they have the same name)

@crob611 crob611 marked this pull request as ready for review February 19, 2021 20:41
@crob611 crob611 requested a review from a team February 19, 2021 20:41
@crob611 crob611 added bug Fixes for quality problems that affect the customer experience Feature:Dashboard Dashboard related features loe:medium Medium Level of Effort review Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.12.0 v7.13.0 v8.0.0 labels Feb 19, 2021
@elasticmachine
Copy link
Contributor

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

@crob611 crob611 added the release_note:skip Skip the PR/issue when compiling release notes label Feb 19, 2021
@clintandrewhall
Copy link
Contributor

@elasticmachine merge upstream

Copy link
Contributor

@flash1293 flash1293 left a comment

Choose a reason for hiding this comment

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

Lens code LGTM, tested and index patterns gets reported as child of dashboard with embedded Lens.

let references: SavedObjectReference[] = [];
const typedState = (state as unknown) as LensEmbeddableInput;

if ((typedState as LensByValueInput).attributes !== undefined) {
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: You can get around these two type casts by checking for by value input like this:
'attributes' in typedState && typedState.attributes

It's turned into a type guard automatically by typescript, so you won't need to case again in the branch

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ohh nice. That's very handy to know.

@crob611 crob611 requested a review from a team February 22, 2021 14:12
Copy link
Contributor

@nreese nreese 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

@crob611
Copy link
Contributor Author

crob611 commented Feb 22, 2021

@elasticmachine merge upstream

@crob611
Copy link
Contributor Author

crob611 commented Feb 22, 2021

@elasticmachine merge upstream

@crob611
Copy link
Contributor Author

crob611 commented Feb 24, 2021

@elasticmachine merge upstream

@crob611 crob611 added the auto-backport Deprecated - use backport:version if exact versions are needed label Feb 24, 2021
@crob611
Copy link
Contributor Author

crob611 commented Feb 24, 2021

@elasticmachine merge upstream

@kibanamachine
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
maps 2.7MB 2.7MB -2.5KB

Page load bundle

Size of the bundles that are downloaded on every page load. Target size is below 100kb

id before after diff
lens 34.7KB 34.9KB +207.0B
maps 140.4KB 143.9KB +3.5KB
visualizations 113.9KB 114.8KB +994.0B
total +4.7KB

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@crob611 crob611 merged commit 510bc69 into elastic:master Feb 24, 2021
kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Feb 24, 2021
…c#91567)

* Adds references from byValue panels when saving dashboard

* Remove extra spaces

* Rework a type check

* Fix type check

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
@kibanamachine
Copy link
Contributor

💚 Backport successful

7.12 / #92713
7.x / #92714

Successful backport PRs will be merged automatically after passing CI.

kibanamachine added a commit to kibanamachine/kibana that referenced this pull request Feb 24, 2021
…c#91567)

* Adds references from byValue panels when saving dashboard

* Remove extra spaces

* Rework a type check

* Fix type check

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
kibanamachine added a commit that referenced this pull request Feb 24, 2021
#92713)

* Adds references from byValue panels when saving dashboard

* Remove extra spaces

* Rework a type check

* Fix type check

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Corey Robertson <corey.robertson@elastic.co>
kibanamachine added a commit that referenced this pull request Feb 24, 2021
#92714)

* Adds references from byValue panels when saving dashboard

* Remove extra spaces

* Rework a type check

* Fix type check

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>

Co-authored-by: Corey Robertson <corey.robertson@elastic.co>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Feb 25, 2021
* master: (38 commits)
  Fixes Cypress flake by adding pipe, click, and should (elastic#92762)
  [Discover] Fix filtering selected sidebar fields (elastic#91828)
  [ML] Fixes positions of calendar arrow buttons in start datafeed modal (elastic#92625)
  [dev/build_ts_refs] check that commit in outDirs matches mergeBase (elastic#92513)
  add dep on `@kbn/config` so it is built first
  [Expressions] [Lens] Add id and copyMetaFrom arg to mapColumn fn + add configurable onError argument to math fn (elastic#90481)
  [Lens] Fix Workspace hidden when using Safari (elastic#92616)
  [Lens] Fixes vertical alignment validation messages (elastic#91878)
  forbid x-elastic-product-origin header in elasticsearch configuration (elastic#92359)
  [Security Solution][Detections] Set default indicator path to reduce friction with new filebeat modules (elastic#92081)
  [ILM][Accessibility] Added A11y test for ILM new policy form. (elastic#92570)
  [Security Solution][Exceptions] - Fixes exceptions builder UI where invalid values can cause overwrites of other values (elastic#90634)
  Automatically generated Api documentation (elastic#86232)
  Increase index pattern select limit to 1000 (elastic#92093)
  [core.logging] Add RewriteAppender for filtering LogMeta. (elastic#91492)
  [Security Solution][Detection Rules] Update prebuilt rule threats to match schema (elastic#92281)
  [Security Solutions][Detection Engine] Fixes bug with not being able to duplicate indicator matches (elastic#92565)
  [Dashboard] Export appropriate references from byValue panels (elastic#91567)
  [Upgrade Assistant] Align code between branches (elastic#91862)
  [Security Solution][Case] Fix alerts push (elastic#91638)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
auto-backport Deprecated - use backport:version if exact versions are needed bug Fixes for quality problems that affect the customer experience Feature:Dashboard Dashboard related features loe:medium Medium Level of Effort release_note:skip Skip the PR/issue when compiling release notes review Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v7.12.0 v7.13.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants