-
Notifications
You must be signed in to change notification settings - Fork 8.3k
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
Kibana should allow a min_age setting of 0ms in ILM policy phases #53719
Conversation
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
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 am so stoked to see this get fixed! Thanks @jkelastic.
Can we improve the UX by setting the default value for "min age" to 0? This requires changing three files: store/defaults/cold_phase.js
(line 20), store/defaults/warm_phase.js
(line 26), and store/defaults/cold_phase.js
(line 18). All three lines need to be changed to:
[PHASE_ROLLOVER_MINIMUM_AGE]: 0,
Now when you go into the form, all of these inputs should be prepopulated with 0 and you should be able to save the form.
💔 Build FailedHistory
To update your PR or re-run it, just comment with: |
@cjcenizal No problem, I'm having a lot of fun and glad to be able to contribute to the EUI team. Third file you mentioned , do you mean I changed a few check conditions in the edit_policy.js to allow equal to and above 0. I also removed the warm phase test to check empty values as we've defaulted the input to be 0. Therefore, we'll always have a value and it wouldn't be empty. |
…default values of [PHASE_ROLLOVER_MINIMUM_AGE]: 0 in [cold,warm,delete_phase].js. 3) Set phase[numberedAttribute] <= 0 in lifecycle.js
💔 Build FailedTo update your PR or re-run it, just comment with: |
💚 Build SucceededTo update your PR or re-run it, just comment with: |
💔 Build FailedTo update your PR or re-run it, just comment with: |
💔 Build FailedTo update your PR or re-run it, just comment with: |
💚 Build SucceededTo update your PR or re-run it, just comment with: |
@elasticmachine merge upstream |
💚 Build SucceededTo update your PR or re-run it, just comment with: |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
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.
@jkelastic nice job! Tested locally and verified fix. I did have a couple questions about the code though if you could take a look. Thanks!
@@ -238,22 +237,14 @@ describe('edit policy', () => { | |||
}); | |||
}); | |||
describe('warm phase', () => { | |||
test('should show number required error when trying to save empty warm phase', () => { |
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 think this is still a valid test. Is there a reason why you deleted it?
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 deleted it because we set a default value of 0 from the request below. Therefore, I don't think the test is valid anymore as will not have an empty value.
I am so stoked to see this get fixed! Thanks @jkelastic.
Can we improve the UX by setting the default value for "min age" to 0? This requires changing three files:
store/defaults/cold_phase.js
(line 20),store/defaults/warm_phase.js
(line 26), andstore/defaults/delete_phase.js
(line 18). All three lines need to be changed to:[PHASE_ROLLOVER_MINIMUM_AGE]: 0,Now when you go into the form, all of these inputs should be prepopulated with 0 and you should be able to save the form.
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 believe the user could still delete the default value, in which case, the validation would still occur.
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.
thank you, updated my code
x-pack/legacy/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.js
Show resolved
Hide resolved
x-pack/legacy/plugins/index_lifecycle_management/__jest__/components/edit_policy.test.js
Show resolved
Hide resolved
@@ -123,9 +130,9 @@ export const validatePhase = (type, phase, errors) => { | |||
} else if ( |
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 was looking through the code again, and I'm wondering if this block of code is necessary. I don't think it will ever reach this point, as we're already checking for negative numbers on L121.
} else if (phase[numberedAttribute] < 0) {
phaseErrors[numberedAttribute] = [positiveNumberRequiredMessage];
}
Can you confirm?
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.
It will reach this point. Initially I thought the negative numbers on L121 would have caught it too, but it didn't.
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.
Can you share how you were testing it to reach this?
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.
Sure, no problem. Initially I set <=0
} else if (phase[numberedAttribute] <= 0) {
phaseErrors[numberedAttribute] = [positiveNumberRequiredMessage];
}
This will generate an error when I enter 0 through the Index Lifecycle Policy cold phase page. It was still not permitting 0. When I set < 0
} else if (phase[numberedAttribute] < 0) {
phaseErrors[numberedAttribute] = [positiveNumberRequiredMessage];
}
I will not get an error when I enter 0 on the ILP page on the cold phase. Then when I run the jest test I will get a received
error of 0 as 0 is now a valid value, but I will get anexpected
error of 1.
expect(received).toBe(expected) // Object.is equality
Expected: 1
Received: 0
74 | const expectedErrorMessages = (rendered, expectedErrorMessages) => {
75 | const errorMessages = rendered.find('.euiFormErrorText');
> 76 | expect(errorMessages.length).toBe(expectedErrorMessages.length);
| ^
77 | expectedErrorMessages.forEach(expectedErrorMessage => {
78 | let foundErrorMessage;
79 | for (let i = 0; i < errorMessages.length; i++) {
Therefore, I edited the jest test case to allow no error to be returned by setting as the value 0 is permitted now
expectedErrorMessages(rendered, [])
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.
Sorry, I wasn't very clear in my comment. I was referring to your statement:
Initially I thought the negative numbers on L121 would have caught it too, but it didn't.
I was wondering what steps you were taking in the UI to reach this point. I am not able to reproduce.
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.
Sorry, my misunderstanding. Fixed the issue now.
…nditions from lifecycle.js & the positiveNumbersEqualAboveZeroErrorMessage variable
@elasticmachine merge upstream |
@elasticmachine merge upstream |
@elasticmachine merge upstream |
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
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.
Latest changes LGTM. Thanks @jkelastic!
@cjcenizal do you think you could take another look at @jkelastic's latest changes? |
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.
Great work @jkelastic! Thanks for doing this.
No problem! Thanks for giving me the opportunity! I had a great time, fun, and learned lots! |
* master: (69 commits) [Graph] Fix various a11y issues (elastic#54097) Add ApplicationService app status management (elastic#50223) logs in one time (elastic#54447) Deprecate using `elasticsearch.ssl.certificate` without `elasticsearch.ssl.key` and vice versa (elastic#54392) [Optimizer] Fix a stack overflow with watch_cache when it attempts to delete very large folders. (elastic#54457) Security - Role Mappings UI (elastic#53620) [SIEM] [Detection engine] Permission II (elastic#54292) Allow User to Cleanup Repository from UI (elastic#53047) [Detection engine] Some UX for rule creation (elastic#54471) share specific instances of some ui packages (elastic#54079) [ML] APM modules configs for RUM Javascript and NodeJS (elastic#53792) [APM] Delay rendering invalid license notification (elastic#53924) [Graph] Improve error message on graph requests (elastic#54230) [ILM] Kibana should allow a min_age setting of 0ms in ILM policy phases (elastic#53719) Unit Tests for common/lib (elastic#53736) [Graph] Only show explorable fields (elastic#54101) remove linting rule exception for markdown (elastic#54232) [Monitoring] Fetch shard data more efficiently (elastic#54028) [Maps] Add hiddenLayers option to embeddable map input (elastic#54355) Pass termOrder and hasTermsAgg properties to serializeThresholdWatch function (elastic#54391) ...
* master: (69 commits) [Graph] Fix various a11y issues (elastic#54097) Add ApplicationService app status management (elastic#50223) logs in one time (elastic#54447) Deprecate using `elasticsearch.ssl.certificate` without `elasticsearch.ssl.key` and vice versa (elastic#54392) [Optimizer] Fix a stack overflow with watch_cache when it attempts to delete very large folders. (elastic#54457) Security - Role Mappings UI (elastic#53620) [SIEM] [Detection engine] Permission II (elastic#54292) Allow User to Cleanup Repository from UI (elastic#53047) [Detection engine] Some UX for rule creation (elastic#54471) share specific instances of some ui packages (elastic#54079) [ML] APM modules configs for RUM Javascript and NodeJS (elastic#53792) [APM] Delay rendering invalid license notification (elastic#53924) [Graph] Improve error message on graph requests (elastic#54230) [ILM] Kibana should allow a min_age setting of 0ms in ILM policy phases (elastic#53719) Unit Tests for common/lib (elastic#53736) [Graph] Only show explorable fields (elastic#54101) remove linting rule exception for markdown (elastic#54232) [Monitoring] Fetch shard data more efficiently (elastic#54028) [Maps] Add hiddenLayers option to embeddable map input (elastic#54355) Pass termOrder and hasTermsAgg properties to serializeThresholdWatch function (elastic#54391) ...
Fixes #50476
Release note
The Index Lifecycle Policy editor now permits the minimum age to be 0.