-
Notifications
You must be signed in to change notification settings - Fork 8.2k
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
[Watcher] Preserve the watch active status after updates #61999
[Watcher] Preserve the watch active status after updates #61999
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 spotted a small bug but I think it's an easy fix.
x-pack/plugins/watcher/public/application/models/watch/threshold_watch.js
Outdated
Show resolved
Hide resolved
@@ -21,23 +20,11 @@ const bodySchema = schema.object( | |||
{ | |||
type: schema.string(), | |||
isNew: schema.boolean(), | |||
isActive: schema.boolean({ defaultValue: true }), |
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'm not sure a default value makes sense here. I think it would make the code clearer if we required the client to define active status, even for defaults. WDYT?
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 using this as a guide https://www.elastic.co/guide/en/elasticsearch/reference/current/watcher-api-put-watch.html#watcher-api-put-watch-query-params. I don't feel too strongly about it either way, but if we consider that our endpoint is already a bit different we can require the active flag 👍
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.
Hmm I see. My instinct is to optimize the API for our UI's use cases and not place emphasis on mirroring the ES API. So is the default value useful to the client? Just some thoughts, I think you should make the final call.
- Make the isActive flag required on the save watch endpoint - Move the isActive state to base_watch and serialize from there.
@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.
Tested locally, code LGTM!
💚 Build SucceededHistory
To update your PR or re-run it, just comment with: |
* Preserve the watch active status after updates * Use route validation params to set isActive * Fix Jest test * Implement PR feedback - Make the isActive flag required on the save watch endpoint - Move the isActive state to base_watch and serialize from there. * Fix Jest tests Co-authored-by: Elastic Machine <[email protected]>
* Preserve the watch active status after updates * Use route validation params to set isActive * Fix Jest test * Implement PR feedback - Make the isActive flag required on the save watch endpoint - Move the isActive state to base_watch and serialize from there. * Fix Jest tests Co-authored-by: Elastic Machine <[email protected]>
…3232) * Preserve the watch active status after updates * Use route validation params to set isActive * Fix Jest test * Implement PR feedback - Make the isActive flag required on the save watch endpoint - Move the isActive state to base_watch and serialize from there. * Fix Jest tests Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
…3231) * Preserve the watch active status after updates * Use route validation params to set isActive * Fix Jest test * Implement PR feedback - Make the isActive flag required on the save watch endpoint - Move the isActive state to base_watch and serialize from there. * Fix Jest tests Co-authored-by: Elastic Machine <[email protected]> Co-authored-by: Elastic Machine <[email protected]>
Summary
Fix #61783
Checklist
For maintainers