-
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
[IM] prevent users from editing and deleting cloud-managed templates #43901
[IM] prevent users from editing and deleting cloud-managed templates #43901
Conversation
Pinging @elastic/es-ui |
💔 Build Failed |
💚 Build Succeeded |
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.
Code LGTM! Didn't test locally.
Some non-blocker suggestions but heavily encouraged 😄:
-
I would love to see tooltips on the table action items that explain why they are disabled, but I know that is a limitation of using EUI's default action items props, which don't support tooltips when an action is disabled. It may be possible by rendering custom actions instead, though that may be tricky too since there are more than 2 actions here. I ran into a similar issue for SLM and ended up rendering one custom action that shows three button icons (screenshot).
-
If we don't render custom actions, then I think it would be great to add a warning callout to the detail panel of a managed template so that an explanation is given somewhere. As it currently stands, the only explanation is on the edit page which is largely inaccessible since Edit is disabled. I also wouldn't be opposed to rendering this callout regardless of if we are able to add tooltips! 🙂Example screenshot from managed repository, note that the repository also gets a
Managed
badge in the table. PR for handling managed repository: [SR] Add callout for managed repository and prevent deletion from UI #36947
Great suggestion @jen-huang! I added a callout using the primary color (warning seemed inappropriate since the UI already prevents the user from doing any harm). |
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!
selectable: ({ isManaged }: Template) => !isManaged, | ||
selectableMessage: (selectable: boolean) => { | ||
if (!selectable) { | ||
return i18n.translate('xpack.idxMgmt.templateList.table.deleteManagedTemplateTooltip', { |
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.
Where does this message get surfaced?
💔 Build Failed |
💚 Build Succeeded |
This PR prevents cloud-managed templates from being edited or deleted via the UI.
I followed a similar implementation done via #40104.
Testing instructions
cluster.metadata.managed_index_templates
setting via Dev Tools:.cloud-<template_name>
via Dev Tools.Note: both of these steps are for testing purposes only.
Screenshots
Edit/clone disabled via table
Edit/clone disabled via details panel
Error displays if you attempt to access the url directly to edit a cloud-managed template