Skip to content
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

Merged
merged 14 commits into from
Jan 10, 2020

Conversation

jkelastic
Copy link
Contributor

@jkelastic jkelastic commented Dec 20, 2019

Fixes #50476

Release note

The Index Lifecycle Policy editor now permits the minimum age to be 0.

@cjcenizal cjcenizal self-requested a review December 20, 2019 19:24
@cjcenizal cjcenizal added Feature:ILM release_note:fix Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.6.0 v8.0.0 labels Dec 20, 2019
@elasticmachine
Copy link
Contributor

Pinging @elastic/es-ui (Team:Elasticsearch UI)

Copy link
Contributor

@cjcenizal cjcenizal left a 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.

@kibanamachine
Copy link
Contributor

💔 Build Failed

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@elastic elastic deleted a comment from elasticmachine Dec 21, 2019
@jkelastic
Copy link
Contributor Author

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.

@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 store/defaults/delete_phase.js (line 18)?

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
@kibanamachine
Copy link
Contributor

💔 Build Failed

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💔 Build Failed

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💔 Build Failed

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@jkelastic
Copy link
Contributor Author

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

@jkelastic
Copy link
Contributor Author

@elasticmachine merge upstream

@jkelastic
Copy link
Contributor Author

@elasticmachine merge upstream

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a 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', () => {
Copy link
Contributor

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?

Copy link
Contributor Author

@jkelastic jkelastic Jan 2, 2020

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), and store/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.

Copy link
Contributor

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.

Copy link
Contributor Author

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

@@ -123,9 +130,9 @@ export const validatePhase = (type, phase, errors) => {
} else if (
Copy link
Contributor

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?

Copy link
Contributor Author

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.

Copy link
Contributor

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?

Copy link
Contributor Author

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, [])

Copy link
Contributor

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.

Copy link
Contributor Author

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
@jkelastic
Copy link
Contributor Author

@elasticmachine merge upstream

@alisonelizabeth
Copy link
Contributor

@elasticmachine merge upstream

@alisonelizabeth
Copy link
Contributor

@elasticmachine merge upstream

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

To update your PR or re-run it, just comment with:
@elasticmachine merge upstream

Copy link
Contributor

@alisonelizabeth alisonelizabeth left a 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!

@alisonelizabeth
Copy link
Contributor

@cjcenizal do you think you could take another look at @jkelastic's latest changes?

Copy link
Contributor

@cjcenizal cjcenizal 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 @jkelastic! Thanks for doing this.

@jkelastic
Copy link
Contributor Author

Great work @jkelastic! Thanks for doing this.

No problem! Thanks for giving me the opportunity! I had a great time, fun, and learned lots!

gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 13, 2020
* 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)
  ...
gmmorris added a commit to gmmorris/kibana that referenced this pull request Jan 13, 2020
* 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)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ILM release_note:fix Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.6.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Kibana should allow a min_age setting of 0ms in ILM policy phases
5 participants