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

[Maps] Support by value saved objects. #82486

Merged
merged 46 commits into from
Nov 10, 2020
Merged

[Maps] Support by value saved objects. #82486

merged 46 commits into from
Nov 10, 2020

Conversation

nreese
Copy link
Contributor

@nreese nreese commented Nov 3, 2020

This PR updates map embeddable and map application to support saved objects by value, allowing users to store map saved objects directly in dashboard without needed to create and maintain a separate saved object.

Testing instructions

  1. Add dashboard.allowByValueEmbeddables: true in kibana.dev.yml
  2. Create new dashboard
  3. Use create new to add a panel and select maps.
  4. Create your map and save with Save return
  5. save your dashboard. Inspect dashboard saved object. Notice how map saved object is stored directly in dashboard.

@nreese nreese added release_note:enhancement WIP Work in progress [Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation v8.0.0 v7.11.0 labels Nov 3, 2020
@nreese nreese requested a review from a team as a code owner November 3, 2020 19:38
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-gis (Team:Geo)

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

Tested locally in chrome.

Code LGTM. Everything looks super clean.

Adding to library, cloning panel, and unlinking all work flawlessly with by reference and by value panels!

One issue I found is that editing 'by reference' maps from a dashboard then hitting 'save and return' doesn't apply the changes properly. You need to press 'save to maps' to see your changes. Not totally sure what's going on there.

I also have some tiny UX nits that could maybe be addressed in a followup:

  • When editing a 'by reference' map from a dashboard, the button to the left of 'save and return' still says 'save to maps'. If you're editing though that means it's already been saved to maps. In Lens, in that case, the button reads 'save as'.

  • When editing a 'by reference' panel from dashboard I would say that it makes sense to have the 'maps' breadcrumb also present - so it would be Dashboard / Maps / My cool Map when editing from dashboard in by reference mode.

  • In both visualize and lens, new by value panels are saved with no title at all. Editing them shows something like Dashboard / Edit visualization in the breadcrumbs, and when you're in view mode on the dashboard, those blank titles just aren't shown. In Maps so far, by value maps are all named New Map, which means the users will have customize each panel's title, or hide the panel titles - else they will potentially have a bunch of 'New Map' on their dashboard.

Additionally, while testing I noticed that saving a map with filters applied doesn't actually apply when they are on a dashboard. This behaviour was the same in maps in 7.10 BC 4, and in 7.9.2 but I'm not sure if it's intentional or not. If not, maybe a separate issue.

Overall, this is a huge change, and will contribute a lot to the seamless feeling we hope to capture when we release Time to Visualize!

description: '',
};
} else {
this._attributes = await getMapAttributeService().unwrapAttributes(this._mapEmbeddableInput);
Copy link
Contributor

Choose a reason for hiding this comment

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

This is looking really clean!

@nreese
Copy link
Contributor Author

nreese commented Nov 5, 2020

Additionally, while testing I noticed that saving a map with filters applied doesn't actually apply when they are on a dashboard. This behaviour was the same in maps in 7.10 BC 4, and in 7.9.2 but I'm not sure if it's intentional or not. If not, maybe a separate issue.

This is as expected behavior. Query, filters, and time saved with a map are not transferred to Dashboard

Copy link
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

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

this is such a fun PR to play with. kibana and maps feel twice as fast.

the simplifcation in the Maps-code is impressive.

Any ideas on how to test? It'd make sense to add some functional test for the new flow.

@ThomThomson
Copy link
Contributor

ThomThomson commented Nov 6, 2020

@thomasneirynck - great timing with the question of adding functional tests. This PR #82441 was recently merged which should allow us to start writing tests with dashboard.allowByValueEmbeddables on.

@nreese
Copy link
Contributor Author

nreese commented Nov 9, 2020

@elasticmachine merge upstream

@nreese
Copy link
Contributor Author

nreese commented Nov 9, 2020

One issue I found is that editing 'by reference' maps from a dashboard then hitting 'save and return' doesn't apply the changes properly. You need to press 'save to maps' to see your changes. Not totally sure what's going on there.

Thanks for pointing this out. I had a logic error where a "by reference" map was calling wrapAttributes with useRefType as false so it was getting updated "by value". I have resolved the problem

@nreese
Copy link
Contributor Author

nreese commented Nov 9, 2020

@ThomThomson Thanks for all the great feedback on the little stuff like breadcrumbs, button labels, and page titles. These are great things to make consistent with Lens to provide a cohesive user experience. I have addressed the following.

When editing a 'by reference' map from a dashboard, the button to the left of 'save and return' still says 'save to maps'. If you're editing though that means it's already been saved to maps. In Lens, in that case, the button reads 'save as'.

Resolved. Added proper logic to set button label when "by value" or "by reference"

When editing a 'by reference' panel from dashboard I would say that it makes sense to have the 'maps' breadcrumb also present - so it would be Dashboard / Maps / My cool Map when editing from dashboard in by reference mode.

Resolved. Added proper logic to include "Maps" in path when "by reference"

In both visualize and lens, new by value panels are saved with no title at all. Editing them shows something like Dashboard / Edit visualization in the breadcrumbs, and when you're in view mode on the dashboard, those blank titles just aren't shown. In Maps so far, by value maps are all named New Map, which means the users will have customize each panel's title, or hide the panel titles - else they will potentially have a bunch of 'New Map' on their dashboard.

Resolved. Map title now defaults to empty string like lens. When you create a new map either from Maps or Dashboard, the page title is "Create". When you edit a map "by value", the page title is "Edit map". When you edit a map "by reference", the page title is the saved object title.

Copy link
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

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

lgtm. So great, this flow feels really fast. Thanks for simplifying how the maps is bootstrapped in the page of the Maps-app and inside the embeddable.

Copy link
Contributor

@ThomThomson ThomThomson left a comment

Choose a reason for hiding this comment

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

Tested again on Chrome. Everything works great! Thanks again for looking into those consistency nits.

LGTM

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
maps 624 627 +3

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
apm 3.1MB 3.1MB +22.0B
maps 2.8MB 2.8MB -6.2KB
securitySolution 7.8MB 7.8MB -32.0B
uptime 983.1KB 983.1KB -34.0B
total -6.3KB

Page load bundle

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

id before after diff
canvas 908.9KB 908.9KB +22.0B
maps 155.6KB 150.7KB -4.9KB
total -4.9KB

History

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

@nreese nreese merged commit 104f9aa into elastic:master Nov 10, 2020
nreese added a commit to nreese/kibana that referenced this pull request Nov 10, 2020
* [Maps] saved objects by value

* inject references when unwrapping

* clean up map embeddable initialize

* use attribute service to load savedMap

* clean up

* remove clear ui since each route has its own store instance

* save

* update for API changes

* pass input to stateTransfer

* remove map saved object loader

* remove unused store_operations

* add saved objects to recently accessed

* provide default description

* break originatingApp connection when not returnToOrigin

* clean up file structure

* clean up adding help menu

* use SavedMap in map_embeddable to remove dupicated load attributes code

* clean up

* restore imports

* clean up breadcrumbs to match lens

* fix check for duplicate title

* tslint

* make title map saved object attribute required

* fix jest tests

* fix logic for hasSaveAndReturnConfig to not show save and return button with new map and allowByValueEmbeddables disabled

* tslint

* fix functional test by triggering MapApp render after save

* rename map_app_container to map_page

* move MapApp and redux connector into folder

* review feedback

* use MAP_PATH constant

* update by reference saved object on save and return

* cleanup breadcrumbs and title

* properly handle deleted map saved objects

* tslint cleanup

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
nreese added a commit that referenced this pull request Nov 10, 2020
* [Maps] saved objects by value

* inject references when unwrapping

* clean up map embeddable initialize

* use attribute service to load savedMap

* clean up

* remove clear ui since each route has its own store instance

* save

* update for API changes

* pass input to stateTransfer

* remove map saved object loader

* remove unused store_operations

* add saved objects to recently accessed

* provide default description

* break originatingApp connection when not returnToOrigin

* clean up file structure

* clean up adding help menu

* use SavedMap in map_embeddable to remove dupicated load attributes code

* clean up

* restore imports

* clean up breadcrumbs to match lens

* fix check for duplicate title

* tslint

* make title map saved object attribute required

* fix jest tests

* fix logic for hasSaveAndReturnConfig to not show save and return button with new map and allowByValueEmbeddables disabled

* tslint

* fix functional test by triggering MapApp render after save

* rename map_app_container to map_page

* move MapApp and redux connector into folder

* review feedback

* use MAP_PATH constant

* update by reference saved object on save and return

* cleanup breadcrumbs and title

* properly handle deleted map saved objects

* tslint cleanup

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

Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
[Deprecated-Use Team:Presentation]Team:Geo Former Team Label for Geo Team. Now use Team:Presentation release_note:enhancement review Team:APM All issues that need APM UI Team support Team:Uptime - DEPRECATED Synthetics & RUM sub-team of Application Observability v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants