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

Advanced watch cleanup #34955

Merged

Conversation

alisonelizabeth
Copy link
Contributor

@alisonelizabeth alisonelizabeth commented Apr 11, 2019

This PR reworks/fixes a few things:

  • Made text updates based on feedback from Gail
  • Reworked form validation to align with threshold watch
  • Fixed bug where state wasn't persisted when toggling tabs back and forth
  • Fixed bug where actions table wasn't populated correctly on simulation results flyout when creating a new watch
  • Remove use of lodash where applicable

@gchaps - screenshots w/ updated text:

Screen Shot 2019-04-11 at 1 16 35 PM

Screen Shot 2019-04-11 at 1 16 51 PM

Screen Shot 2019-04-11 at 1 17 09 PM

Screen Shot 2019-04-11 at 1 17 31 PM

@@ -1,30 +0,0 @@
/*
Copy link
Contributor Author

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));
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'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.

Copy link
Contributor Author

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

@elasticmachine
Copy link
Contributor

💔 Build Failed

Copy link
Contributor

@gchaps gchaps left a 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.

@alisonelizabeth
Copy link
Contributor Author

@gchaps good suggestions! The latest commit contains the changes.

Screen Shot 2019-04-11 at 4 02 05 PM

Screen Shot 2019-04-11 at 4 02 54 PM

@elasticmachine
Copy link
Contributor

💔 Build Failed

@gchaps
Copy link
Contributor

gchaps commented Apr 11, 2019

@alisonelizabeth Is there a way to put text in code font (message_defaults) without highlighting it?

@elasticmachine
Copy link
Contributor

💔 Build Failed

@alisonelizabeth
Copy link
Contributor Author

@gchaps, good point. I checked the EUI component library, and there is! I updated my PR.

Copy link
Contributor

@bmcconaghy bmcconaghy left a 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)) {
Copy link
Contributor

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)) { ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good point, fixed!

@elasticmachine
Copy link
Contributor

💔 Build Failed

@elasticmachine
Copy link
Contributor

💚 Build Succeeded

Copy link
Contributor

@bmcconaghy bmcconaghy left a comment

Choose a reason for hiding this comment

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

LGTM

@alisonelizabeth alisonelizabeth merged commit b991618 into elastic:watcher-port Apr 15, 2019
@alisonelizabeth alisonelizabeth deleted the advanced-watch-cleanup branch April 15, 2019 14:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants