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

[Watcher] Preserve the watch active status after updates #61999

Conversation

jloleysens
Copy link
Contributor

@jloleysens jloleysens commented Mar 31, 2020

Summary

Fix #61783

Checklist

For maintainers

@jloleysens jloleysens added v7.0.0 Feature:Watcher 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.8.0 labels Mar 31, 2020
@jloleysens jloleysens requested a review from sebelga March 31, 2020 15:26
@elasticmachine
Copy link
Contributor

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

@cjcenizal cjcenizal requested review from cjcenizal and removed request for sebelga April 1, 2020 15:24
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 spotted a small bug but I think it's an easy fix.

@@ -21,23 +20,11 @@ const bodySchema = schema.object(
{
type: schema.string(),
isNew: schema.boolean(),
isActive: schema.boolean({ defaultValue: true }),
Copy link
Contributor

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?

Copy link
Contributor Author

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 👍

Copy link
Contributor

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.
@jloleysens jloleysens requested a review from a team as a code owner April 2, 2020 09:10
@jloleysens jloleysens added v7.7.0 and removed v7.0.0 labels Apr 2, 2020
@jloleysens
Copy link
Contributor Author

@elasticmachine merge upstream

@cjcenizal
Copy link
Contributor

@elasticmachine merge upstream

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.

Tested locally, code LGTM!

@kibanamachine
Copy link
Contributor

💚 Build Succeeded

History

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

@jloleysens jloleysens merged commit 93971db into elastic:master Apr 10, 2020
@jloleysens jloleysens deleted the watcher/fix/maintain-active-state-after-update branch April 10, 2020 10:29
jloleysens added a commit to jloleysens/kibana that referenced this pull request Apr 10, 2020
* 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]>
jloleysens added a commit to jloleysens/kibana that referenced this pull request Apr 10, 2020
* 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]>
jloleysens added a commit that referenced this pull request Apr 10, 2020
…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]>
jloleysens added a commit that referenced this pull request Apr 10, 2020
…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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Watcher 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.7.0 v7.8.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Watcher] Saving a deactivated watch activates it
4 participants