Skip to content

[IM] Index Templates UI details view#41602

Merged
alisonelizabeth merged 4 commits intomasterfrom
feature/index_templates
Jul 25, 2019
Merged

[IM] Index Templates UI details view#41602
alisonelizabeth merged 4 commits intomasterfrom
feature/index_templates

Conversation

@alisonelizabeth
Copy link
Contributor

@alisonelizabeth alisonelizabeth commented Jul 19, 2019

This PR is continuation of #39922, and adds the details view to the Index Templates UI.

Changes include:

  • Details flyout for an individual template
  • API tests for fetching an index template
  • Component integration tests for details view
  • Telemetry for details view

Release notes

This feature adds the details panel to the Index Templates UI. Users can also delete a template from this view.

Note: This is continuation of #39922.

Testing

There are several system index templates by default. To create your own index template, go to console and follow the ES API docs.

For example:

PUT _template/template_1
{
  "index_patterns": ["te*", "bar*"],
  "settings": {
    "number_of_shards": 1
  },
  "mappings": {
    "_source": {
      "enabled": false
    },
    "properties": {
      "host_name": {
        "type": "keyword"
      },
      "created_at": {
        "type": "date",
        "format": "EEE MMM dd HH:mm:ss Z yyyy"
      }
    }
  }
}

Screenshots

Summary view with multiple index patterns:
Screen Shot 2019-07-19 at 3 03 25 PM

Summary view with single index pattern, ILM policy and no mappings:
Screen Shot 2019-07-19 at 3 33 03 PM

Summary view with no aliases, mappings or settings:
Screen Shot 2019-07-19 at 3 17 03 PM

Settings tab
Screen Shot 2019-07-19 at 3 03 47 PM

Mappings tab
Screen Shot 2019-07-19 at 3 04 00 PM

Aliases tab
Screen Shot 2019-07-19 at 3 04 09 PM

@alisonelizabeth alisonelizabeth added release_note:enhancement Feature:Index Management Index and index templates UI v8.0.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more t// v7.4.0 labels Jul 19, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui

@alisonelizabeth alisonelizabeth changed the title Feature/index templates [IM] Index Templates UI details view Jul 19, 2019
@alisonelizabeth
Copy link
Contributor Author

FYI @yaronp68

@alisonelizabeth alisonelizabeth requested a review from sebelga July 19, 2019 19:37
@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@yaronp68
Copy link

LGTM

Copy link
Contributor

@sebelga sebelga left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great work @alisonelizabeth ! I tested locally and it works well. I made a few small comments, no blockers.

Do you know what are the limitation of an index template name though? I encoded special characters in the name and created the template PUT _template/template%25%24%263

It saved correctly. But then if I try to see the details in the UI it breaks.


return (
<Fragment>
<DeleteTemplatesModal
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am not a huge fan of this pattern where the child component is the one deciding if it is visible on the screen.

I prefer to have the parent deciding when a child component is visible:

{templateToDelete.length && (
  <DeleteTemplatesModal
    callback={data => {
      if (data && data.hasDeletedTemplates) {
        reload();
      }
      setTemplateToDelete([]);
      onClose();
    }}
    templatesToDelete={templateToDelete}
  />
)}

You don't need to change it, just sharing 😊

</EuiFlexItem>

<EuiFlexItem grow={false}>
{templateDetails && (
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wouldn't it make more sense to have the <EuiFlexItem grow={false}> wrapped inside?

const { name } = req.params;
const indexTemplateByName = await callWithRequest('indices.getTemplate', { name });

const {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shouldn't we add a check to make sure the template exists on the response before deconstructuring?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, fixed!

@alisonelizabeth alisonelizabeth requested a review from Bamieh July 23, 2019 12:31
Copy link
Contributor

@Bamieh Bamieh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i18n looks good, one nit with trackUiMetric that needs to be addressed I believe

<EuiLink
href={`#${BASE_PATH}templates/${name}`}
data-test-subj="templateDetailsLink"
onClick={trackUiMetric.bind(null, UIM_TEMPLATE_SHOW_DETAILS_CLICK)}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is changed now, its gonna be trackUiMetric('click', UIM_TEMPLATE_SHOW_DETAILS_CLICK)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed, thanks for catching this!

@alisonelizabeth alisonelizabeth force-pushed the feature/index_templates branch from 9bfabe2 to aa7649d Compare July 25, 2019 01:40
@alisonelizabeth
Copy link
Contributor Author

@sebelga thanks for your review!

I'm not aware of any limitations with the template name. I addressed the issue with creating a template name with special characters - thanks for catching that!

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

@elasticmachine
Copy link
Contributor

💔 Build Failed

@@ -20,9 +21,19 @@ import { TemplatesTable } from './templates_table';
import { loadIndexTemplates } from '../../../services/api';
import { Template } from '../../../../common/types';
import { trackUiMetric, METRIC_TYPE } from '../../../services/track_ui_metric';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestion: you might find this module's interface to be simpler if it exports trackClick, trackLoad, etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cjcenizal Thanks for suggestion! I will update on another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Feature:Index Management Index and index templates UI release_note:enhancement 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.

6 participants