-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Management] Enable index pattern version conflicts #18937
[Management] Enable index pattern version conflicts #18937
Conversation
💔 Build Failed |
💚 Build Succeeded |
💚 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.
I can't get formatting to be cleared using two tabs like before, so that issue is taken care of! There are still two issues that I see:
Refresh requires two clicks
- Open two tabs to index pattern fields list.
- In tab 1, change a field's format to anything other than
default
, save. - In tab 2, click refresh fields - list is not updated with new format. Click refresh again - list is updated.
Default format can be overridden with old version
- Open two tabs to index pattern fields list - with at least one field that has a format other than default (will use
Number
for example) - In tab 1, change that field's
Number
format todefault
, save. - In tab 2, click refresh fields.
- In tab 1, reload page - that field's format is back to
Number
.
💔 Build Failed |
@jen-huang Great finds! After investigation, I opened #19037 to describe some of the issues I saw related to this. 94c71bb should address your issues as well as the earlier mentioned issue! |
💔 Build Failed |
jenkins, test this |
💔 Build Failed |
jenkins, test this |
💔 Build Failed |
Tests pass locally. This is a bummer jenkins, test this |
💔 Build Failed |
…y and resolve if we can
…nd force a fields refresh. This ensures we pick up on field format (and other) changes
94c71bb
to
af6fdda
Compare
💚 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.
@chrisronline Those changes fixed the two issues I was seeing! And I'm not seeing the issues described in #19037. Resetting to default works fine for me.
However, I am seeing an issue where versioning isn't kicking in once a field has been changed. Steps:
- Open two tabs to the same index pattern
- In tab 1, click Edit on a string field, change its format to String and save
- In tab 2, click refresh fields (the new String format for the edited field shows correctly)
- Stay in tab 2, click Edit in the same updated field, change its format to Truncated String and save
- In tab 1, DO NOT REFRESH FIELDS, click edit in the same field, change its format from String (outdated since we didn't refresh) to Url
- Observe that the save was successful. I would expect the toast about having to refresh fields to pop up at this point.
However, this might be an edge case. I think we've resolved the biggest issue of refreshing fields overwriting changes already, so PR LGTM!
@jen-huang That's a legit bug! Great find! |
💚 Build Succeeded |
✅ Confirmed changes fixed the bug! |
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
* Pass the version along so we can get version conflict errors, then try and resolve if we can * Update the version post save * Refactor slightly to match setId pattern * Tests and updates to ensure the actual changes aren't clobbered * Ensure we return the id * Avoid infinite recursion, welcome suggestions on how to unit test this * Change logic for refresh fields UI button. Now it will re-call init and force a fields refresh. This ensures we pick up on field format (and other) changes * Fix a couple issues with saving field formats, elastic#19037 * Use the right key for version
* Pass the version along so we can get version conflict errors, then try and resolve if we can * Update the version post save * Refactor slightly to match setId pattern * Tests and updates to ensure the actual changes aren't clobbered * Ensure we return the id * Avoid infinite recursion, welcome suggestions on how to unit test this * Change logic for refresh fields UI button. Now it will re-call init and force a fields refresh. This ensures we pick up on field format (and other) changes * Fix a couple issues with saving field formats, #19037 * Use the right key for version
Backport: 6.x: 55b8130 |
Resolves #18584, #15738, #19037
Summary
This PR adds support for index patterns to leverage optimistic concurrency which is already supported through the saved objects api.
The basic flow is:
Testing
There are three main test cases I've been using to test this:
Changing a field format
Not changing a field format in the second tab
Using discover
Add
orRemove
on any of the fields on the left (ensure it's the same index pattern). It should successfully go through and the field formatting changes made in step 3 should be preserved (verify by refreshing the page on tab 1 and clicking edit again)Questions/Areas of Note
The code around trying to resolve the conflicts manually feels a bit trappy but it felt like a good use case to support to avoid unnecessary page refreshes (honestly, maybe needing to refresh the page is up for debate too?). All reviewers: please spend extra time reviewing this. I added a unit test but would love some more validation here.
cc @tylersmalley