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

[ILM] Fix set replicas serialization and validation #85233

Conversation

jloleysens
Copy link
Contributor

Summary

Summarize your PR. If it involves visual changes include a screenshot or gif.

Address this comment (#85143 (review))

Fix #85226

Additionally, fixed validation for set replicas to allow the number 0 and updated initial value for toggle logic to check for value existence, not truthiness or falsiness.

Checklist

@jloleysens jloleysens added Feature:ILM v8.0.0 Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more release_note:skip Skip the PR/issue when compiling release notes v7.11.0 labels Dec 8, 2020
@jloleysens jloleysens requested a review from a team as a code owner December 8, 2020 09:26
@elasticmachine
Copy link
Contributor

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

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.

Thanks for fixing this @jloleysens! Tested locally. LGTM. Left a couple nits in the code.

@@ -142,7 +142,7 @@ export const ColdPhase: FunctionComponent = () => {
{ defaultMessage: 'Set replicas' }
),
initialValue: Boolean(
policy.phases.cold?.actions?.allocate?.number_of_replicas
policy.phases.cold?.actions?.allocate?.number_of_replicas != null
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I don't think this needs to be wrapped in Boolean() now


// First copy over all non-allocate and migrate actions.
const actions: SerializedActionWithAllocation = { ...otherActions };

// The UI only knows about include, exclude and require, so copy over all other values.
// The UI only knows about include, exclude and require and number_of_replicas so copy over all other values.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
// The UI only knows about include, exclude and require and number_of_replicas so copy over all other values.
// The UI only knows about include, exclude, require and number_of_replicas so copy over all other values.

/**
* The number of replicas value to set in the allocate action.
*/
nrOfReplicas?: number
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: I think this might be a little more readable as numOfReplicas

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

Metrics [docs]

Async chunks

Total size of all lazy-loaded chunks that will be downloaded as the user navigates the app

id before after diff
indexLifecycleManagement 242.1KB 243.2KB +1.1KB

Distributable file count

id before after diff
default 46934 47694 +760

History

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

@jloleysens jloleysens merged commit 8eae30c into elastic:master Dec 8, 2020
@jloleysens jloleysens deleted the ilm/fix-set-replicas-serialization-and-validation branch December 8, 2020 15:33
jloleysens added a commit to jloleysens/kibana that referenced this pull request Dec 8, 2020
* added fix for serializing replicas and updated validation to correctly check for non negative nr

* added tests and fixed incorrect use of warm phase setting in cold phase

* remove unused import

* clean up use of Boolean and rename nrOfReplicas -> numberOfReplicas

* fix comment
jloleysens added a commit that referenced this pull request Dec 9, 2020
* added fix for serializing replicas and updated validation to correctly check for non negative nr

* added tests and fixed incorrect use of warm phase setting in cold phase

* remove unused import

* clean up use of Boolean and rename nrOfReplicas -> numberOfReplicas

* fix comment
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:ILM release_note:skip Skip the PR/issue when compiling release notes Team:Kibana Management Dev Tools, Index Management, Upgrade Assistant, ILM, Ingest Node Pipelines, and more v7.11.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ILM] Replicas value persists when field is disabled in UI
4 participants