Closed
Description
🍒 Summary
Currently the custom equation field on the Timeslice Metric and Custom Metric only validates the string using a REGEX to ensure the user doesn't use any invalid characters: A-Z, +, -, /, *, (, ), ?, !, &, :, |, >, <, =
. This doesn't stop the user from creating an invalid equation, even though it validates the REGEX, like INVALID
.
🎯 Acceptance Criteria
- When a user types valid characters but not a valid equation, we should mark the equation as "invalid" when ES is returning an error for that invalid equation.
- Update the GetPreviewData API to return an optional error when the query fails.
{ data: Data[], error?: string }
🧠 Additional Thoughts
We should use the preview request to validate the equation since it runs the actual equation via painless. If we don't get a valid response, we should set the field to "invalid". Ideally, users wouldn't save an equation which doesn't work in the preview, we just need to enforce that.
Activity