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

[Fleet] Fix routing issues with getPath and history.push #101658

Merged
merged 2 commits into from
Jun 9, 2021

Conversation

kpollich
Copy link
Member

@kpollich kpollich commented Jun 8, 2021

Summary

Closes #101656

Fixes getPath method in Fleet app to prevent history.pushing redundant basePath value. This may have ramifications elsewhere, so I'll monitor CI and confirm.

@kpollich kpollich added v8.0.0 release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team auto-backport Deprecated - use backport:version if exact versions are needed 7.14 candidate labels Jun 8, 2021
@kpollich kpollich self-assigned this Jun 8, 2021
@kpollich kpollich requested a review from a team as a code owner June 8, 2021 18:31
@elasticmachine
Copy link
Contributor

Pinging @elastic/fleet (Team:Fleet)

@nchaulet nchaulet self-requested a review June 8, 2021 19:08
@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Page load bundle

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

id before after diff
fleet 425.1KB 425.1KB -47.0B

History

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

cc @kpollich

@kpollich
Copy link
Member Author

kpollich commented Jun 9, 2021

I went through a few other uses of getPath on master and verified this bug affected other areas of the Fleet UI, such as

  • The "Action -> Copy" button on the policy details page
  • The "Edit Package Policy" flow

Anywhere we're using usePath and history.push in conjunction, we're currently redirecting to the Fleet home page unintentionally because we duplicate the basePath value in the URL object pushed onto history.

I think this was an errant change I made as I updated cross-app navigation between integrations and Fleet. This PR fixes these issues.

@kpollich kpollich requested a review from jloleysens June 9, 2021 12:39
Copy link
Contributor

@jloleysens jloleysens left a comment

Choose a reason for hiding this comment

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

Tested the updated behaviour of getPath locally and this seems to address the #-routing mismatch. I'd update this PR title to reflect that this issue was more wide-spread (stemming from getPath). Great fix!

@kpollich kpollich changed the title [Fleet] Fix Create Agent Policy Button [Fleet] Fix routing issues with getPath and history.push Jun 9, 2021
Copy link
Member

@nchaulet nchaulet 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 and it worked as expected 🚀

@kpollich kpollich merged commit 58eb0d4 into elastic:master Jun 9, 2021
kibanamachine pushed a commit to kibanamachine/kibana that referenced this pull request Jun 9, 2021
…#101658)

* Fix getPath usage in Fleet app

* Fix pathname in failing test
@kibanamachine
Copy link
Contributor

💚 Backport successful

Status Branch Result
7.x

This backport PR will be merged automatically after passing CI.

@kpollich kpollich deleted the 101656-create-agent-button branch June 9, 2021 14:19
kibanamachine added a commit that referenced this pull request Jun 9, 2021
#101763)

* Fix getPath usage in Fleet app

* Fix pathname in failing test

Co-authored-by: Kyle Pollich <[email protected]>
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jun 9, 2021
* master:
  clarify which parts of TM are experimental (elastic#101757)
  Add sh scripts with _bulk_action route usage examples (elastic#101736)
  [Uptime] Only register route in side nav if uptime show capability is true (elastic#101709)
  Use KIBANA_DOCS in doc link service (elastic#101667)
  [Alerting][Event log] Persisting duration information for active alerts in event log (elastic#101387)
  Address design issues in Discover/Graph (elastic#101584)
  Optimize performance for document table (elastic#101715)
  Change file data visualizer links to point to new location in home application (elastic#101393)
  [Fleet] Tighten policy permissions, take II (elastic#97366)
  [ML] Add debounce to the severity control update  (elastic#101581)
  [Fleet] Fix routing issues with `getPath` and `history.push` (elastic#101658)
  [APM] Add link-to/transaction route (elastic#101731)
  [Index Patterns] Runtime fields CRUD REST API  (elastic#101164)
  [ILM] Refactor types and fix missing aria labels (elastic#101518)
  [Lens] New summary row feature for datatable (elastic#101075)
  Blocks save event filter with a white space name (elastic#101599)
  Improve security server types (elastic#101661)
  [APM] Replace side nav with tabs on Settings page (elastic#101460)
  [APM] Only register items in side nav if user has permissions to see app (elastic#101707)
  [Security solution][Endpoint] Add back button when to the event filters list (elastic#101280)
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 release_note:skip Skip the PR/issue when compiling release notes Team:Fleet Team label for Observability Data Collection Fleet team v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Fleet] Clicking "Create Agent Policy" redirects to Fleet home page
5 participants