-
Notifications
You must be signed in to change notification settings - Fork 8.4k
[ML] Adds documentation links in the help menu for machine learning #85366
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
Conversation
x-pack/plugins/ml/public/application/components/help_menu/index.tsx
Outdated
Show resolved
Hide resolved
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.
Took an early test of this one, and great to see the ML content in the Help menu! Left a few comments on the code.
useEffect(() => { | ||
chrome.setHelpExtension({ | ||
appName: i18n.translate('xpack.ml.chrome.help.appName', { | ||
defaultMessage: 'Machine learning', |
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.
Would capitalized Learning
be appropriate here, to match the display of the ML plugin in the top and side nav, and also the title on the doc page Machine Learning in the Elastic Stack
?
content: i18n.translate('xpack.ml.chrome.helpMenu.documentation', { | ||
defaultMessage: 'Documentation', | ||
}), | ||
href: docLinks.links.ml.guide, |
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.
Do we always want to link to the top level ML guide from every page in the ML app, or should the href
be passed in to the HelpMenu
component?
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.
Yes, I was thinking it would be nice to have that functionality, but wasn't sure of the best way to accomplish that. I'll maybe reach out to pick your brain on the right code to accomplish it.
|
||
import React, { useEffect } from 'react'; | ||
import { i18n } from '@kbn/i18n'; | ||
import { useKibana } from '../../../../../../../src/plugins/kibana_react/public'; |
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.
@jgowdyelastic would it be better to use useMlKibana
for access to the docLinks
service here?
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.
for consistency with our other components, yes useMlKibana
would be better.
but chrome
and docLinks
are available in either.
Pinging @elastic/ml-ui (:ml) |
@elasticmachine merge upstream |
Great addition, @lcawl! 😄 Might be worth renaming the files so that the This would keep it consistent with the other components in the plugin. |
href: docLink, | ||
iconType: 'documents', | ||
linkType: 'custom', | ||
target: '_blank', |
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.
Despite setting target to _blank
, the link opens in the same tab for me. Same thing happens with the links for the Security solution I see. But for Dashboard, it opens in a different tab (which seems a better option). I can't work out why that it is, as the structure of the <a>
tag looks identical.
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.
@lcawl Looks like the linkType
here needs to be 'documentation'. That should fix the issue.
https://github.com/elastic/kibana/blob/master/src/core/public/chrome/ui/header/header_help_menu.tsx#L287
docLink: string; | ||
} | ||
|
||
export const HelpMenu: FC<HelpMenuProps> = React.memo(({ docLink }) => { |
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.
To be consistent with the other components in the ml/public/application/components
folder, it is probably better to move this content into help_menu.tsx
and then create a simple index.tsx
which exports out HelpMenu
(copy structure of ml/public/application/components/create_job_link_card
).
💚 Build SucceededMetrics [docs]Module Count
Async chunks
Distributable file count
History
To update your PR or re-run it, just comment with: |
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.
Tested latest edits and LGTM. Thanks for setting this up!
Summary
Related to #85088
This PR adds a link to the machine learning guide in the help menu on the "Overview" page in the ML app:
The method for accomplishing this drop-down menu link is copied from how it's done in:
kibana/x-pack/plugins/security_solution/public/common/components/help_menu/index.tsx
Line 24 in aa2525c
kibana/x-pack/plugins/security_solution/public/app/home/index.tsx
Line 100 in aa2525c
If we like this layout, I think we can add appropriate links for each of the other pages in the app.
Checklist
Delete any items that are not applicable to this PR.
For maintainers