-
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
[Logs Explorer] Hide hard coded flyout actions using customization extension point #166638
[Logs Explorer] Hide hard coded flyout actions using customization extension point #166638
Conversation
🤖 GitHub commentsExpand to view the GitHub comments
Just comment with:
|
Pinging @elastic/infra-monitoring-ui (Team:Infra Monitoring UI) |
const { singleDocHref, contextViewHref, onOpenSingleDoc, onOpenContextView } = useNavigationProps( | ||
{ dataView, rowIndex: hit.raw._index, rowId: hit.raw._id, columns, filters, savedSearchId } | ||
); | ||
const { flyoutActions } = useFlyoutActions({ |
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.
note: this hook is purely helpful to split the computation of the actions list on top of the customization framework and the navigation helpers to keep cleaner the whole flyout rendering content.
href: string; | ||
} | ||
|
||
const staticViewDocumentItem = { |
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.
note: this entry represents the static "View" label at the beginning of the list, which will be prepended only in the presence of some enabled actions.
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.
This looks good to me and worked well in testing, but it looks like Security simultaneously added the same customization point in #166780. I think we should all align on one implementation before merging either.
One thing I like about this implementation is that it allows for selectively disabling the links if needed, and it provides a good base for future enhancements like a getActionItems()
option.
@kqualters-elastic What do you think about merging this PR first and adapting your PR to this implementation of the flyout
customization point?
id: 'flyout'; | ||
actions: { | ||
defaultActions?: FlyoutDefaultActions; | ||
getActionItems?: () => FlyoutActionItem[]; |
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.
getActionItems?: () => FlyoutActionItem[]; |
This would make sense, but it doesn't look like it's implemented or used currently, so I think we should drop this for now.
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.
You're right, I totally forgot to apply the custom action items into the rendered list 🙈
Thanks for the heads up, instead of removing it I used it when computing the actions list, as we'll probably need to use it soon for our customizations and to keep it aligned with the options available for the top_nav customization (disabling default entries, add custom entries)
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.
Infra changes LGTM, nice work!
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.
independently did basically the same thing in #166780 so lgtm 😂 commenting so i get a notification when it's merged ha
@davismcphee ya that sounds good to me, will update once this is merged |
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.
The latest changes look good to me, and it seems like we're all in agreement on merging this implementation. Would be great to have a unit test for getActionItems
too, but approving now since otherwise it all LGTM to me.
src/plugins/discover/public/components/discover_grid_flyout/use_flyout_actions.tsx
Show resolved
Hide resolved
💚 Build Succeeded
Metrics [docs]Module Count
Public APIs missing comments
Async chunks
Public APIs missing exports
Page load bundle
Unknown metric groupsAPI count
ESLint disabled line counts
Total ESLint disabled count
History
To update your PR or re-run it, just comment with: |
…ension point (elastic#166638) ## 📓 Summary Closes elastic#165217 This work implements a new extension point in the Discover customization framework to allow customizing the flyout content. Although it enables customizing only the actions displayed on top, it could be enhanced for additional flyout customizations in the future. To keep it simple and familiar to other customizations, it relies on a similar API as the `top_nav` customization, allowing one to disable default actions and insert additional ones. ```ts /** * Hide flyout actions to prevent rendering hard-coded actions. */ customizations.set({ id: 'flyout', actions: { defaultActions: { viewSingleDocument: { disabled: true }, viewSurroundingDocument: { disabled: true }, }, }, }); ``` ## 🧪 Testing - Navigate to `/app/observability-log-explorer` and expand the flyout for any grid entry. The actions on top of the flyout should not be displayed, only the title and the pagination control should appear. - Navigate to `/app/discover` and expand the flyout for any grid entry. The actions for viewing a single documents or surrounding documents should be displayed. --------- Co-authored-by: Marco Antonio Ghiani <[email protected]>
📓 Summary
Closes #165217
This work implements a new extension point in the Discover customization framework to allow customizing the flyout content. Although it enables customizing only the actions displayed on top, it could be enhanced for additional flyout customizations in the future.
To keep it simple and familiar to other customizations, it relies on a similar API as the
top_nav
customization, allowing one to disable default actions and insert additional ones.🧪 Testing
/app/observability-log-explorer
and expand the flyout for any grid entry.The actions on top of the flyout should not be displayed, only the title and the pagination control should appear.
/app/discover
and expand the flyout for any grid entry.The actions for viewing a single documents or surrounding documents should be displayed.