-
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
[ILM] Fix set replicas serialization and validation #85233
[ILM] Fix set replicas serialization and validation #85233
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.
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 |
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.
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. |
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.
// 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 |
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.
nit: I think this might be a little more readable as numOfReplicas
💚 Build SucceededMetrics [docs]Async chunks
Distributable file count
History
To update your PR or re-run it, just comment with: |
* 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
* 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
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