-
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
Advanced watch cleanup #34955
Advanced watch cleanup #34955
Conversation
@@ -1,30 +0,0 @@ | |||
/* |
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.
since this is only being used in one place, i removed it from the constants directory
} | ||
|
||
if (prevWatchString !== watch.watchString && errors.json.length === 0) { | ||
setWatchProperty('watch', JSON.parse(watch.watchString)); |
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 struggling with the best way to validate the watch json and update the watch accordingly. The ace editor requires a json string, and we also can't parse it and update the watch property unless it is valid json. This works, but not sure if there's a better approach.
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.
reworked this based on our discussion
💔 Build Failed |
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.
For the first Save modal, I'm worried that the title might get too long if the watch name is long. How about changing it to:
A watch with this ID already exists
Let's add a generic title to the other modal. Also, we'll need to edit the contents a bit
Save watch? --or-- Missing property value
This watch has a Slackmessage_default
setting without a "to" property. If this property is already set in your elasticsearch.yml file, you're all set. Otherwise, you can include it here in the watch JSON. Learn more.
@gchaps good suggestions! The latest commit contains the changes. |
💔 Build Failed |
@alisonelizabeth Is there a way to put text in code font (message_defaults) without highlighting it? |
💔 Build Failed |
@gchaps, good point. I checked the |
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.
Minor comment about not using ! logic.
@@ -38,7 +39,12 @@ const watchReducer = (state: any, action: any) => { | |||
case 'setWatch': | |||
return payload; | |||
case 'setProperty': | |||
return new (Watch.getWatchTypes())[state.type]({ ...state, ...payload }); | |||
const { property, value } = payload; | |||
if (!isEqual(state[property], value)) { |
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 would suggest flipping the logic here: if (isEqual(state[property], value)) {
...
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.
good point, fixed!
💔 Build Failed |
💚 Build Succeeded |
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.
LGTM
This PR reworks/fixes a few things:
lodash
where applicable@gchaps - screenshots w/ updated text: