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

[IM] prevent users from editing and deleting cloud-managed templates #43901

Merged
merged 5 commits into from
Aug 28, 2019

Conversation

alisonelizabeth
Copy link
Contributor

@alisonelizabeth alisonelizabeth commented Aug 23, 2019

This PR prevents cloud-managed templates from being edited or deleted via the UI.

I followed a similar implementation done via #40104.

Testing instructions

  1. Add cluster.metadata.managed_index_templates setting via Dev Tools:
PUT /_cluster/settings
{
  "persistent": {
    "cluster.metadata.managed_index_templates": ".cloud-"
  }
}
  1. Create a template with the format: .cloud-<template_name> via Dev Tools.
PUT _template/.cloud-example
{
  "index_patterns": [ "foobar*"]
}

Note: both of these steps are for testing purposes only.

Screenshots

Edit/clone disabled via table
Screen Shot 2019-08-23 at 2 56 29 PM

Edit/clone disabled via details panel
Screen Shot 2019-08-23 at 2 56 42 PM

Error displays if you attempt to access the url directly to edit a cloud-managed template
Screen Shot 2019-08-23 at 2 57 26 PM

@alisonelizabeth alisonelizabeth added release_note:skip Skip the PR/issue when compiling release notes v7.4.0 v8.0.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more labels Aug 23, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui

@alisonelizabeth
Copy link
Contributor Author

FYI @zanbel @nachogiljaldo

@alisonelizabeth alisonelizabeth changed the title prevent users from editing and deleting cloud-managed templates [IM] prevent users from editing and deleting cloud-managed templates Aug 23, 2019
@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@cjcenizal cjcenizal added Feature:Index Management Index and index templates UI chore labels Aug 26, 2019
@nachogiljaldo
Copy link

The PR looks good running against Cloud.

Screenshot 2019-08-27 at 17 50 12

I personally would have loved if it supported multiple wildcards/prefixes so it's more future proof, but this one works indeed.

Copy link
Contributor

@jen-huang jen-huang left a 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 😄:

@cjcenizal
Copy link
Contributor

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).

image

Copy link
Contributor

@cjcenizal cjcenizal left a 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', {
Copy link
Contributor

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?

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Feature:Index Management Index and index templates UI NeededFor:Cloud release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.4.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants