-
Notifications
You must be signed in to change notification settings - Fork 3.6k
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
fix: Disable saving threshold check if no threshold selected #15348
Conversation
bc80436
to
b67a262
Compare
ed64f29
to
7aaa322
Compare
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 had one question about false
vs null
, but other than that it looks awesome! Worked great for me.
const oneOrMoreThresholds = | ||
check.type === 'threshold' | ||
? check.thresholds && !!check.thresholds.length | ||
: 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.
i think this should be false
, not null
. CheckEOSaveButton
is expecting oneOrMoreThresholds
to be a boolean and making this explicitly false
will let us not rely on JS's sometimes confusing type casting. what do you think?
@@ -98,6 +98,10 @@ const CheckEOHeader: FC<Props> = ({ | |||
} | |||
|
|||
const {singleField, singleAggregateFunc} = isDraftQueryAlertable(draftQueries) | |||
const oneOrMoreThresholds = | |||
check.type === 'threshold' | |||
? check.thresholds && !!check.thresholds.length |
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.
do we prefer !!
over Boolean()
?
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.
no strong preference but !!
feels more readable?
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.
👍
* Prevent check saving if no thresholds * Add tests * Add changes to changelog * make optional props optional * use false instead of null for boolean
add test for hydrateVars dashboard variable dropdown test: inspect values, not just array length add RTL test for variable dropdown changes lint fix: Disable saving threshold check if no threshold selected (#15348) * Prevent check saving if no thresholds * Add tests * Add changes to changelog * make optional props optional * use false instead of null for boolean changelog fix(ui): ignore false change events in VariableForm (#15317) closes #15059 the issue is to persist user data across variable type selection interfaces within the variable editor. this commit pushes all of the variable editor information down to redux to allow persistence outside of the view state until the user clicks "cancel" or "create" in the interface.
Closes #15334
Describe your proposed changes here.
Disable saving threshold check if no threshold is selected