Skip to content

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

Merged
cjcenizal merged 5 commits intoelastic:masterfrom
alisonelizabeth:fix/templates-cloud
Aug 28, 2019
Merged

[IM] prevent users from editing and deleting cloud-managed templates#43901
cjcenizal merged 5 commits intoelastic:masterfrom
alisonelizabeth:fix/templates-cloud

Conversation

@alisonelizabeth
Copy link
Copy Markdown
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 t// labels Aug 23, 2019
@elasticmachine
Copy link
Copy Markdown
Contributor

Pinging @elastic/es-ui

@alisonelizabeth
Copy link
Copy Markdown
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
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
Contributor

💚 Build Succeeded

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

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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

💔 Build Failed

@elasticmachine
Copy link
Copy Markdown
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 t// v7.4.0 v8.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants