-
Notifications
You must be signed in to change notification settings - Fork 4.4k
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
[WIP] Parameter input feedback #4197
Conversation
@arikfr how do you feel about this approach? Can also add "Invalid input" error (i.e. |
client/app/components/Parameters.jsx
Outdated
@@ -137,6 +143,8 @@ export class Parameters extends React.Component { | |||
|
|||
renderParameter(param, index) { | |||
const { editable } = this.props; | |||
const isEmpty = param.pendingValue === '' || param.pendingValue === null; |
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.
Some notes:
- After Introduce inheritance to the Parameter structure #4049 the
pendingValue
should be normalized as well and empty values will be standardized as null 🚀 - Should we check if the Parameter Value is empty in case there is no pendingValue? (e.g: https://deploy-preview-4197--redash-preview.netlify.com/queries/216 has empty values)
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.
This line of code is totally temporary.
@gabrieldutra wdyt of this for Parameter.js?
get isEmpty() {
const value = this.hasPendingValue ? this.pendingValue : this.value;
return this.isEmptyValue(value);
}
It makes sense to me that param.isEmpty
always responds with the currently selected 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.
Currently the most relevant usage of that (or the only one) is to determine the parameters with missing values prior to a query execution, so that would need to be updated (in this case it's necessary to consider the parameter value, not the pending value).
I'm actually "centered positioned" on that. Depends if it makes more sense for the Parameter structure to reflect the "actual Input" or the "Query Execution". For the first one the pendingValue is part of it, for the second one it's just a "state" the parameter has. Considering the existence of this.isEmptyValue(anyValue)
it doesn't matter the direction we choose.
BTW, considering "Can also add "Invalid input" error (i.e. NaN in InputNumber)", one idea is to remove the isEmpty
(no usage besides deciding if there is an error prior to the query execution) and work on a generalized getErrors
with anything that should return an UI error.
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 for param.getCurrentInputError()
which would return a string ("Required field", "Invalid input", etc) or null. I can add it in this PR 👍
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.
The indication on the field is the first part, but we also need to revise the big red message as well (either replace or remove).
Sure, it'll be removed when I publish the PR. |
fe4acbf
to
38400cf
Compare
I have a feeling removing it will be a big part of the work :) |
Preventing execution when invalid value on query or dashboard page init. Disabling execute button when invalid value.
Added specific error msg in case query or dashboard init with invalid params. Query: Dashboard widget link: |
@arikfr before I release this to be reviewed, here are a few points to be aware of:
Lmk if any of these are show stoppers. |
Now handled with dedicated param validation check. When changing param type to DateRangeWhen changing DateRange param to another type |
Swapped for a backend validation version #4264 |
Description
Fixes #2721.
Depends on #4049.
Here's the whole gang:
Notice that the Number param also checks that input is a number.
Notice dropdown can't be invalid so has no error.