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

[Graph] Switch to SavedObjectClient.resolve #109617

Merged
merged 9 commits into from
Sep 10, 2021

Conversation

mbondyra
Copy link
Contributor

@mbondyra mbondyra commented Aug 23, 2021

Summary

Fixes partially #105812

Screenshots

aliasMatch
Screenshot 2021-09-04 at 21 31 14
conflict
Screenshot 2021-09-04 at 21 31 44

How to test this

  1. Create your own graph and export the saved object or use this one:
    graph2.ndjson.zip

  2. Follow the instructions from here to get the staging data and add it via Dev Tools to your kibana.

  3. Using that staging data, I could test with these links (they are with my basePath wju, modify accordingly):

Graph, exactMatch - http://localhost:5601/wju/s/test1/app/graph#/workspace/ff959d40-b880-11e8-a6d9-e546fe2bba5f-test1
Graph, aliasMatch - http://localhost:5601/wju/s/test2/app/graph#/workspace/ff959d40-b880-11e8-a6d9-e546fe2bba5f-test2 -> redirects you to the new ID for that object
Graph, conflict - http://localhost:5601/wju/s/test3/app/graph#/workspace/ff959d40-b880-11e8-a6d9-e546fe2bba5f-test3 -> clicking the button redirects you to the conflicting object that has a new ID

Checklist

Delete any items that are not applicable to this PR.

Risk Matrix

Delete this section if it is not applicable to this PR.

Before closing this PR, invite QA, stakeholders, and other developers to identify risks that should be tested prior to the change/feature release.

When forming the risk matrix, consider some of the following examples and how they may potentially impact the change:

Risk Probability Severity Mitigation/Notes
Multiple Spaces—unexpected behavior in non-default Kibana Space. Low High Integration tests will verify that all features are still supported in non-default Kibana Space and when user switches between spaces.
Multiple nodes—Elasticsearch polling might have race conditions when multiple Kibana nodes are polling for the same tasks. High Low Tasks are idempotent, so executing them multiple times will not result in logical error, but will degrade performance. To test for this case we add plenty of unit tests around this logic and document manual testing procedure.
Code should gracefully handle cases when feature X or plugin Y are disabled. Medium High Unit tests will verify that any feature flag or plugin combination still results in our service operational.
See more potential risk examples

@mbondyra mbondyra added Feature:Graph Graph application feature Team:Visualizations Visualization editors, elastic-charts and infrastructure v8.0.0 release_note:skip Skip the PR/issue when compiling release notes labels Aug 23, 2021
@mbondyra mbondyra changed the title [Graph] replace get with resolve [Graph] Switch to SavedObjectClient.resolve Sep 4, 2021
@elastic elastic deleted a comment from kibanamachine Sep 4, 2021
@mbondyra mbondyra force-pushed the graph/savedObjectClientResolve branch 2 times, most recently from 2497a6e to 5ba1452 Compare September 6, 2021 13:50
@mbondyra mbondyra force-pushed the graph/savedObjectClientResolve branch from 5ba1452 to 8508c8a Compare September 7, 2021 13:00
@mbondyra mbondyra marked this pull request as ready for review September 7, 2021 13:02
@mbondyra mbondyra requested a review from a team as a code owner September 7, 2021 13:02
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-vis-editors (Team:VisEditors)

@mbondyra mbondyra requested a review from jportner September 7, 2021 13:02
@mbondyra mbondyra added Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. and removed Team:Visualizations Visualization editors, elastic-charts and infrastructure labels Sep 7, 2021
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-data-discovery (Team:DataDiscovery)

@LeeDr
Copy link

LeeDr commented Sep 7, 2021

Graph, exactMatch - http://localhost:5601/wju/s/test1/app/graph#/workspace/92c872e0-0cca-11ec-a0d4-73239d2f1d3c-test1
Graph, aliasMatch - http://localhost:5601/wju/s/test2/app/graph#/workspace/92c872e0-0cca-11ec-a0d4-73239d2f1d3c-test2 -> redirects you to the new ID for that object
Graph, conflict - http://localhost:5601/wju/s/test3/app/graph#/workspace/92c872e0-0cca-11ec-a0d4-73239d2f1d3c-test3 -> clicking the button redirects you to the conflicting object that has a new ID

I'm confused by this. There are 2 screenshots and 3 test cases. I guess the first test case doesn't have a screenshot because it's just the graph with no dialogs or messages on it?

It would be nice if the screenshots included the browser address bar so we could tell what URL was entered and what it was redirected to if that's what is happening.

I don't understand the complete flow for the 3rd case.

  1. How can one URL have 2 objects associated with it? I can't wrap my head around that statement. Do I only see this if I open a URL from a browser bookmark? Or do I also see it if I open a graph from the listing page?
  2. What happens if I click the Dismiss button? Will I see this every time I open this graph URL? If not, do other people who open the same link see it?
  3. What happens when I click Go to other graph?

I might answer some of these questions by reading the developer guide for sharing saved objects, but looking at this from the end-user perspective I'm very confused.

@mbondyra
Copy link
Contributor Author

mbondyra commented Sep 7, 2021

Hi @LeeDr, the behavior is shared across all the saved objects (not just Graph ones) so I didn't include all the information. To get some context, it is worth to look at Joe's Sharing Saved Object guide.

I've updated the screenshots with the labels, but basically exactMatch behaves as before, the app is just loaded. The aliasMatch gets redirected and shows redirection toast. The conflict shows a notification.

How can one URL have 2 objects associated with it? I can't wrap my head around that statement. Do I only see this if I open a URL from a browser bookmark? Or do I also see it if I open a graph from the listing page?

This is very well explained in this section of the guide and there's a great example here

What happens if I click the Dismiss button? Will I see this every time I open this graph URL? If not, do other people who open the same link see it?

If you click the Dismiss button, the notification disappears but when you refresh, it shows up again. You will see this everytime you open this graph. It happens because we want the user to be sure they look at the correct saved object. Quoting: "By informing the consumer that this is a conflict, the consumer can render an appropriate UI to the end-user explaining that this might not be the object they are actually looking for." so I understand it as we want the user to react and remove the one that is not correct (probably the other one).

What happens when I click Go to other graph?

You get redirected to the other graph.

@LeeDr
Copy link

LeeDr commented Sep 7, 2021

I reviewed the developer guide and chatted with Joe about the functionality again. It seems very unlikely anyone should hit the conflict case. They would probably either have to use the saved objects API in some strange way or hack docs in Es to get into that state. I'm still concerned that we don't really give users any clear way to "fix" the conflict case. They would either have to go into Saved Objects and delete the conflicting object. Or maybe delete an alias directly from the .kibana index. Likely would become a support case. In any case, this PR is just following the dev guide.

@jportner
Copy link
Contributor

jportner commented Sep 7, 2021

I'm still concerned that we don't really give users any clear way to "fix" the conflict case. They would either have to go into Saved Objects and delete the conflicting object. Or maybe delete an alias directly from the .kibana index. Likely would become a support case. In any case, this PR is just following the dev guide.

Agree this is not ideal, but also we decided not to invest too much time in building a UI that is probably never going to be used.
Since I designed the conflict callout, we also added a docs page for legacy URL aliases, which at least gives an escape hatch to manually fix the situation (by calling an API).
The docs team has asked me to make some tweaks to the callout body text, which is in the Spaces plugin, so I plan to do that here soon an add a link to those docs too.

@mbondyra mbondyra marked this pull request as draft September 7, 2021 20:38
@mbondyra mbondyra marked this pull request as ready for review September 7, 2021 20:38
Copy link
Contributor

@jportner jportner left a comment

Choose a reason for hiding this comment

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

Code review only, the test steps you have outlined look great.
Just a couple of nits in the comments below!

x-pack/plugins/graph/kibana.json Outdated Show resolved Hide resolved
x-pack/plugins/graph/public/plugin.ts Outdated Show resolved Hide resolved
@kertal kertal requested a review from dimaanj September 8, 2021 09:27
@mbondyra
Copy link
Contributor Author

mbondyra commented Sep 8, 2021

@elasticmachine merge upstream

@jportner jportner self-requested a review September 8, 2021 14:01
Copy link
Contributor

@jportner jportner left a comment

Choose a reason for hiding this comment

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

Test locally and LGTM!

Copy link
Contributor

@dimaanj dimaanj left a comment

Choose a reason for hiding this comment

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

Great work! Tested locally, found one issue with redirect. Once it solved, should be ready.

@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
graph 644.5KB 646.0KB +1.5KB

Page load bundle

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

id before after diff
graph 11.2KB 11.2KB +27.0B

History

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

Copy link
Contributor

@dimaanj dimaanj left a comment

Choose a reason for hiding this comment

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

LGTM! Tested locally one more time.

Copy link
Member

@kertal kertal left a comment

Choose a reason for hiding this comment

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

LGTM, also did a quick test in MacOS, Chrome

@mbondyra mbondyra added the auto-backport Deprecated - use backport:version if exact versions are needed label Sep 10, 2021
@mbondyra mbondyra merged commit 7fff05f into elastic:master Sep 10, 2021
@mbondyra mbondyra deleted the graph/savedObjectClientResolve branch September 10, 2021 13:47
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Sep 10, 2021
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

jloleysens added a commit to jloleysens/kibana that referenced this pull request Sep 13, 2021
…-link-to-kibana-app

* 'master' of github.com:elastic/kibana: (120 commits)
  [TSVB] Support custom field format (elastic#101245)
  [VisEditors] Add code ownership to the functional tests (elastic#111680)
  [Lens] Make Lens saved object share-capable (elastic#111403)
  [Graph] Make Graph saved object share-capable (elastic#111404)
  [Stack Monitoring] Add breadcrumb support (elastic#111850)
  Update Jira Cloud to use OAuth2.0 (elastic#111493)
  Show warning message when attempting to create an APM alert in stack management (elastic#111781)
  Skip suite blocking ES snapshot promotion (elastic#111907)
  Respect `auth_provider_hint` if session is not authenticated. (elastic#111521)
  Added in 'Responses' field in alert telemetry & updated test (elastic#111892)
  [Usage collection] refactor cloud detector collector (elastic#110439)
  Make classnames a shared dep (elastic#111636)
  Fix link to e2e tests in APM testing.md (elastic#111869)
  [Security Solution] Add host.os.name.caseless mapping and runtime field (elastic#111455)
  [APM] Removes the beta label from APM tutorial (elastic#111499) (elastic#111828)
  [RAC] [Observability] Expand Observability alerts page functional tests (elastic#111297)
  Fix extra white space on the alert table whe page size is 50 or 100 (elastic#111568)
  [Metrics UI] Add Inventory Timeline open/close state to context and URL state (elastic#111034)
  [Graph] Switch to SavedObjectClient.resolve  (elastic#109617)
  [APM] Adding lambda icon (elastic#111834)
  ...

# Conflicts:
#	x-pack/plugins/reporting/public/management/__snapshots__/report_listing.test.tsx.snap
@kibanamachine
Copy link
Contributor

Looks like this PR has a backport PR but it still hasn't been merged. Please merge it ASAP to keep the branches relatively in sync.

@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Sep 14, 2021
kibanamachine added a commit that referenced this pull request Sep 14, 2021
@kibanamachine kibanamachine removed the backport missing Added to PRs automatically when the are determined to be missing a backport. label Sep 14, 2021
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 Feature:Graph Graph application feature release_note:skip Skip the PR/issue when compiling release notes Team:DataDiscovery Discover, search (e.g. data plugin and KQL), data views, saved searches. For ES|QL, use Team:ES|QL. v7.16.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants