Skip to content

Use SavedObjectsClient for Courier Index Pattern#12719

Merged
tylersmalley merged 12 commits intoelastic:masterfrom
tylersmalley:12670-index-pattern
Jul 11, 2017
Merged

Use SavedObjectsClient for Courier Index Pattern#12719
tylersmalley merged 12 commits intoelastic:masterfrom
tylersmalley:12670-index-pattern

Conversation

@tylersmalley
Copy link
Member

@tylersmalley tylersmalley commented Jul 8, 2017

  • Index pattern is created, by default, with a random ID by Elasticsearch
  • Updated all references requiring the pattern itself to use indexPattern.title
  • Advanced options toggle added to index pattern creation page to provide a specified ID
  • If an index pattern tied to a visualization does not exist, the user is given a link to create a pattern with the referenced ID.

@tylersmalley tylersmalley force-pushed the 12670-index-pattern branch 6 times, most recently from eec2e06 to 8991e22 Compare July 8, 2017 23:23
* Index pattern is created, by default, with a random ID by Elasticsearch
* Updated all references requiring the pattern itself to use indexPattern.title
* Advanced options toggle added to index pattern creation page to provide a specified ID
* If an index pattern does not exist, the user is given a link to create a pattern with the referenced ID.

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@tylersmalley tylersmalley force-pushed the 12670-index-pattern branch from 8991e22 to 3025f46 Compare July 9, 2017 01:10
@tylersmalley tylersmalley changed the title [WIP] Use SavedObjectsClient for Courier Index Pattern Use SavedObjectsClient for Courier Index Pattern Jul 9, 2017
@tylersmalley
Copy link
Member Author

This PR is similar to #12407

Copy link
Contributor

@thomasneirynck thomasneirynck left a comment

Choose a reason for hiding this comment

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

Lgtm from my end.

I did notice the following UX difference:

When a user creates a new index pattern, and uses a matching-pattern that already exists, the user is no longer presented with a dialog that ask whether they want to override the pattern. The practical result it that it is possible now to create multiple index-pattern that have identical titles:

image

@tylersmalley
Copy link
Member Author

@tbragin - what are your thoughts on @thomasneirynck's comment? Technically users can add index patterns with the same pattern but I could see how this could lead to customer confusion.

If they attempt to create a pattern with the same name, what are your thoughts on presenting them with a popup linking them to the index pattern to manage? In my opinion, the "force overwrite" is confusing. Is it merging the attributes with the existing pattern, or completely swapping the pattern out and removing any scripts, etc?

@alexfrancoeur
Copy link

@tylersmalley @thomasneirynck I agree, duplicate index patterns could be pretty confusing to a user. Is there any reason why a user would want duplicate index pattern names? It seems as if it'd be best to avoid this situation as much as possible. We handled duplicate dashboard names (slightly different use case) with a simple warning. If we agree that there is no need to have duplicate index pattern names, I think the proposed solution with a warning and link to the index pattern management page makes sense. Though we may want to get UX's input here.

I do have one question. Do we consider it a regression to remove the ability to override an index pattern?

@kobelb kobelb self-requested a review July 10, 2017 13:37
@kobelb
Copy link
Contributor

kobelb commented Jul 10, 2017

When creating a new visualization, the index pattern ID is displayed as opposed to the title:

screen shot 2017-07-10 at 10 36 59 am

However, it looks right after Saving.

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@kobelb
Copy link
Contributor

kobelb commented Jul 10, 2017

When clicking on the "Discover" app in the left navigation, I'm getting the following warning:
screen shot 2017-07-10 at 11 29 02 am

@kobelb
Copy link
Contributor

kobelb commented Jul 10, 2017

When saving a new Saved Search, I'm immediately redirected to the Saved Objects Management screen and displayed the following error:

screen shot 2017-07-10 at 11 45 36 am

Copy link
Contributor

@kobelb kobelb left a comment

Choose a reason for hiding this comment

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

There appear to be a number of bugs associated with switching from the index id to the title. Is there any possibility of avoiding this switch while still using the SavedObjectsClient?

if (!config.get('defaultIndex')) {
config.set('defaultIndex', id);
}
if (!config.get('defaultIndex')) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We're no longer refreshing the kibana index, do you mind explaining why this changed?

Copy link
Member Author

Choose a reason for hiding this comment

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

The saved objects API uses refresh: wait_for when modifying objects instead of calling the refresh API directly to ensure the consistency.

attributes: {
title: 'testIndexPattern'
},
_version: 2
Copy link
Contributor

Choose a reason for hiding this comment

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

It doesn't impact the test, but _version is actually version.

Copy link
Member Author

Choose a reason for hiding this comment

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

It's actually _version since it comes from SavedObject - we can revisit later if that's ok.

// Load the kibana app dependencies.

describe('Validate index name directive', function () {
// Fox
Copy link
Contributor

Choose a reason for hiding this comment

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

Not sure what this comment means...

super(
`Could not locate that ${type}${idMsg}`,
SavedObjectNotFound);
let message = `Could not locate that ${type}${idMsg}`;
Copy link
Contributor

Choose a reason for hiding this comment

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

Using html directly here doesn't appear to give us the desired result:

screen shot 2017-07-10 at 11 34 40 am

Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
Copy link
Member Author

Choose a reason for hiding this comment

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

@spalger, there is a bug in marked that when a URL contains an asterisk it won't render the URL.

That project is really in a bad place - in the future we might want to find something else: https://github.com/chjj/marked/issues

@tylersmalley tylersmalley force-pushed the 12670-index-pattern branch from ff588bd to 36e24dc Compare July 11, 2017 19:24
Signed-off-by: Tyler Smalley <tyler.smalley@elastic.co>
@tylersmalley tylersmalley force-pushed the 12670-index-pattern branch from 36e24dc to 143921f Compare July 11, 2017 19:28
Copy link
Contributor

@kobelb kobelb left a comment

Choose a reason for hiding this comment

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

LGTM

@tylersmalley tylersmalley merged commit 0d502ae into elastic:master Jul 11, 2017
tylersmalley added a commit to tylersmalley/kibana that referenced this pull request Jul 11, 2017
* Index pattern is created, by default, with a random ID by Elasticsearch
* Updated all references requiring the pattern itself to use indexPattern.title
* Advanced options toggle added to index pattern creation page to provide a specified ID
* If an index pattern does not exist, the user is given a link to create a pattern with the referenced ID.
tylersmalley added a commit that referenced this pull request Jul 12, 2017
* Index pattern is created, by default, with a random ID by Elasticsearch
* Updated all references requiring the pattern itself to use indexPattern.title
* Advanced options toggle added to index pattern creation page to provide a specified ID
* If an index pattern does not exist, the user is given a link to create a pattern with the referenced ID.
@tylersmalley
Copy link
Member Author

5.x/5.6: 3c64283

@sophiec20
Copy link
Contributor

For info, just to mention, this change had a downstream effect on ML as we use the index pattern / saved object selector.

image

@tylersmalley
Copy link
Member Author

Thanks @sophiec20, looking into that now.

@jgowdyelastic
Copy link
Member

@tylersmalley This has been resolved now for ML under https://github.com/elastic/x-pack-kibana/pull/1954

@tylersmalley
Copy link
Member Author

tylersmalley commented Jul 18, 2017

Thanks @jgowdyelastic, apologies for the breaking change.

@lukasolson lukasolson mentioned this pull request Jul 19, 2017
@jimgoodwin jimgoodwin added release_note:roadmap release_note:enhancement Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// labels Jul 25, 2017
Bargs added a commit to Bargs/kibana that referenced this pull request Aug 25, 2017
ui-select-match's expression was expecting an IndexPattern object, but
the indexPatternList passed to ui-select-choices contained SavedObject
instances due to the [SavedObjectsClient refactor][1]. This wasn't a
problem most of the time because switching index patterns caused the
entire directive to get destroyed and re-created. However, when the
directive didn't get re-created (for example, when clicking the already
selected pattern) it would result in a blank select box.

Fixes elastic#13080

[1]: elastic#12719
Bargs added a commit that referenced this pull request Aug 28, 2017
ui-select-match's expression was expecting an IndexPattern object, but
the indexPatternList passed to ui-select-choices contained SavedObject
instances due to the [SavedObjectsClient refactor][1]. This wasn't a
problem most of the time because switching index patterns caused the
entire directive to get destroyed and re-created. However, when the
directive didn't get re-created (for example, when clicking the already
selected pattern) it would result in a blank select box.

Fixes #13080

[1]: #12719
Bargs added a commit that referenced this pull request Aug 28, 2017
ui-select-match's expression was expecting an IndexPattern object, but
the indexPatternList passed to ui-select-choices contained SavedObject
instances due to the [SavedObjectsClient refactor][1]. This wasn't a
problem most of the time because switching index patterns caused the
entire directive to get destroyed and re-created. However, when the
directive didn't get re-created (for example, when clicking the already
selected pattern) it would result in a blank select box.

Fixes #13080

[1]: #12719
Bargs added a commit that referenced this pull request Aug 28, 2017
ui-select-match's expression was expecting an IndexPattern object, but
the indexPatternList passed to ui-select-choices contained SavedObject
instances due to the [SavedObjectsClient refactor][1]. This wasn't a
problem most of the time because switching index patterns caused the
entire directive to get destroyed and re-created. However, when the
directive didn't get re-created (for example, when clicking the already
selected pattern) it would result in a blank select box.

Fixes #13080

[1]: #12719
Bargs added a commit that referenced this pull request Aug 28, 2017
ui-select-match's expression was expecting an IndexPattern object, but
the indexPatternList passed to ui-select-choices contained SavedObject
instances due to the [SavedObjectsClient refactor][1]. This wasn't a
problem most of the time because switching index patterns caused the
entire directive to get destroyed and re-created. However, when the
directive didn't get re-created (for example, when clicking the already
selected pattern) it would result in a blank select box.

Fixes #13080

[1]: #12719
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

blocker release_note:enhancement review Team:Core Platform Core services: plugins, logging, config, saved objects, http, ES client, i18n, etc t// v5.6.0 v6.0.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants