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] Remove URL Generator #121832

Merged
merged 16 commits into from
Feb 8, 2022

Conversation

ThomThomson
Copy link
Contributor

@ThomThomson ThomThomson commented Dec 21, 2021

Summary

Part of #121823
Part of #103846

Removes the deprecated URL Generator from the dashboard API

@ThomThomson ThomThomson changed the title Remove deprecated and unused dashboard URL generator code [Dashboard] Remove URL Generator Dec 28, 2021
@ThomThomson
Copy link
Contributor Author

Closing for now, blocked on #122300

@ThomThomson ThomThomson closed this Jan 4, 2022
@ThomThomson ThomThomson reopened this Feb 2, 2022
@ThomThomson ThomThomson marked this pull request as ready for review February 4, 2022 15:30
@ThomThomson ThomThomson requested review from a team as code owners February 4, 2022 15:30
@ThomThomson ThomThomson added v8.2.0 Feature:Dashboard Dashboard related features release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.1.0 labels Feb 4, 2022
@elasticmachine
Copy link
Contributor

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

@ThomThomson ThomThomson added impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort labels Feb 4, 2022
@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

@qn895
Copy link
Member

qn895 commented Feb 4, 2022

Testing the ML changes and I think there must have been a regression or format change with the new Dashboard locator, where the query is not being reflected the generated url. Potentially out of the scope of this PR, but good to address in 8.1.

For the same payload:

{
    "dashboardId": "edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b",
    "timeRange": {
        "from": "$earliest$",
        "to": "$latest$",
        "mode": "absolute"
    },
    "filters": [],
    "query": {
        "language": "kuery",
        "query": "clientip:\"$clientip$\""
    },
    "useHash": false
}

With the url generator (using main branch):

/abc/app/dashboards#/view/edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b?_a=(filters:!(),query:(language:kuery,query:'clientip:%22$clientip$%22'))&_g=(filters:!(),time:(from:'$earliest$',mode:absolute,to:'$latest$'))

With the new locator (notice there's no 'query' here):

/abc/app/dashboards#/view/edf84fe0-e1a0-11e7-b6d5-4dc382ef7f5b?_g=(filters:!(),time:(from:%27$earliest$%27,mode:absolute,to:%27$latest$%27))

@ThomThomson
Copy link
Contributor Author

Yes you are correct, there has been a format change! The Locator is capable of sending state via the router state rather than sending everything through the URL. This is causing this issue, which is being fixed.

When you click through the link, the query comes through correctly, right? It may not work so far when you open in new tab, but we will work on that when we fix the issue above.

@ThomThomson
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@stephmilovic stephmilovic left a comment

Choose a reason for hiding this comment

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

SIEM changes LGTM!

Copy link
Contributor

@crob611 crob611 left a comment

Choose a reason for hiding this comment

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

Looks good to me. One small little nit but nothing major

const createDashboardUrl = useKibana().services.dashboard?.dashboardUrlGenerator?.createUrl;
const savedObjectsClient = useKibana().services.savedObjects.client;
const {
dashboard,
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you further destructure locator out of here, since I think that's the only part of dashboard that it uses. Then the hook can only have a dependency on the locator?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately we can't destructure locator out of dashboard, because the dashboard service is optional.

@qn895
Copy link
Member

qn895 commented Feb 7, 2022

When you click through the link, the query comes through correctly, right? It may not work so far when you open in new tab, but we will work on that when we fix the issue above.

Indeed that seems to be the case but this behavior is a blocker for us since it doesn't make sense specifically in our UI (for this use case) to open the link in the same tab. More importantly, we rely on this service in order to generate custom url formats for Anomaly detection alerts, so ideally the url generated should be correct. I'll give this PR a test #124770 but our preference is that the fix should be merged before this PR goes in.

@ThomThomson
Copy link
Contributor Author

@qn895, I actually removed all the ML changes in this PR, because the change was already merged in here #124285

As soon as #124770 is merged we can take advantage of that change to make the entire URL available in ML.

@kibana-ci
Copy link
Collaborator

💚 Build Succeeded

Metrics [docs]

Module Count

Fewer modules leads to a faster build time

id before after diff
dashboard 260 259 -1

Public APIs missing comments

Total count of every public API that lacks a comment. Target amount is 0. Run node scripts/build_api_docs --plugin [yourplugin] --stats comments for more detailed information.

id before after diff
dashboard 142 136 -6

Async chunks

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

id before after diff
dashboard 293.1KB 293.1KB -21.0B
securitySolution 4.7MB 4.7MB -48.0B
total -69.0B

Page load bundle

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

id before after diff
dashboard 66.1KB 64.5KB -1.7KB
Unknown metric groups

API count

id before after diff
dashboard 155 138 -17

References to deprecated APIs

id before after diff
dashboard 100 84 -16
securitySolution 49 48 -1
total -17

Unreferenced deprecated APIs

id before after diff
dashboard 2 0 -2

History

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

@ThomThomson ThomThomson merged commit 4394293 into elastic:main Feb 8, 2022
ThomThomson added a commit to ThomThomson/kibana that referenced this pull request Feb 8, 2022
* Remove deprecated and unused dashboard URL generator code

Co-authored-by: Steph Milovic <stephanie.milovic@elastic.co>
(cherry picked from commit 4394293)
@ThomThomson ThomThomson removed the v8.1.0 label Feb 8, 2022
@kibanamachine kibanamachine added the backport missing Added to PRs automatically when the are determined to be missing a backport. label Feb 10, 2022
@kibanamachine
Copy link
Contributor

Friendly reminder: Looks like this PR hasn’t been backported yet.
To create backports run node scripts/backport --pr 121832 or prevent reminders by adding the backport:skip label.

@ThomThomson ThomThomson added backport:skip This commit does not require backporting and removed backport missing Added to PRs automatically when the are determined to be missing a backport. labels Feb 10, 2022
@bhavyarm
Copy link
Contributor

@ThomThomson how do I test this PR please? Thanks!

@ThomThomson
Copy link
Contributor Author

Hey @bhavyarm, there aren't really any user-facing tests you can run against this. It's mostly a behind-the-scenes change.

If you wanted to verify that everything still works, you could could test the sharing functionality of the dashboard, snapshot and saved object share, as well as dashboard to dashboard drilldowns.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Dashboard Dashboard related features impact:medium Addressing this issue will have a medium level of impact on the quality/strength of our product. loe:medium Medium Level of Effort release_note:skip Skip the PR/issue when compiling release notes Team:Presentation Presentation Team for Dashboard, Input Controls, and Canvas v8.2.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants