-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
[ML] avoid full page reload for links following CSV import #79539
Conversation
Pinging @elastic/ml-ui (:ml) |
|
||
let discoverUrlGenerator; | ||
try { | ||
discoverUrlGenerator = getUrlGenerator(DISCOVER_APP_URL_GENERATOR); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
getUrlGenerator throws when the id is not found. Adding code to avoid unhandled errors
if (!discoverUrlGenerator) { | ||
return; | ||
} | ||
const discoverUrl = await discoverUrlGenerator.createUrl(state); | ||
if (!unmounted) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Need to check for unmounted after await
, not before
@@ -142,9 +148,26 @@ export const ResultsLinks: FC<Props> = ({ | |||
} | |||
} | |||
|
|||
function openInDiscover(e: React.MouseEvent<HTMLButtonElement>) { | |||
e.preventDefault(); | |||
getApplication().navigateToUrl(discoverLink); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this fallback to something else instead of ''
if getUrlGenerator(DISCOVER_APP_URL_GENERATOR)
throws an error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Button is not visible if discoverLink is not provided so onClick could not be called.
...s/ml/public/application/datavisualizer/file_based/components/results_links/results_links.tsx
Outdated
Show resolved
Hide resolved
@elasticmachine merge upstream |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
💚 Build SucceededMetrics [docs]async chunks size
History
To update your PR or re-run it, just comment with: |
…9539) * [ML] avoid full page reload for links following CSV import * cleanup * review feedback Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
…79698) * [ML] avoid full page reload for links following CSV import * cleanup * review feedback Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com>
The current implementation of linking to Discover, Index management, and Index pattern management after a CSV import causes a full page reload. Clicking the buttons below should not cause a full page reload.
This PR updates the implementation to used navigateToApp and navigateToUrl to avoid the full page reload.