Kibana should allow a min_age setting of 0ms in ILM policy phases#53719
Kibana should allow a min_age setting of 0ms in ILM policy phases#53719alisonelizabeth merged 14 commits intoelastic:masterfrom
Conversation
|
Pinging @elastic/es-ui (Team:Elasticsearch UI) |
cjcenizal
left a comment
There was a problem hiding this comment.
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 |
alisonelizabeth
left a comment
There was a problem hiding this comment.
@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!
| }); | ||
| }); | ||
| describe('warm phase', () => { | ||
| test('should show number required error when trying to save empty warm phase', () => { |
There was a problem hiding this comment.
I think this is still a valid test. Is there a reason why you deleted it?
There was a problem hiding this comment.
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.
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.
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.
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.
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.
Can you share how you were testing it to reach this?
There was a problem hiding this comment.
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.
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.
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: |
alisonelizabeth
left a comment
There was a problem hiding this comment.
Latest changes LGTM. Thanks @jkelastic!
|
@cjcenizal do you think you could take another look at @jkelastic's latest changes? |
cjcenizal
left a comment
There was a problem hiding this comment.
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.