-
Notifications
You must be signed in to change notification settings - Fork 14.1k
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
feat(explore-popover): Show disabled 'Save' button in explore popover #21318
Conversation
Codecov Report
@@ Coverage Diff @@
## master #21318 +/- ##
==========================================
+ Coverage 65.38% 66.88% +1.50%
==========================================
Files 1847 1805 -42
Lines 70561 69034 -1527
Branches 7737 7368 -369
==========================================
+ Hits 46137 46175 +38
+ Misses 22417 20953 -1464
+ Partials 2007 1906 -101
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
/testenv up |
@geido Ephemeral environment spinning up at http://54.202.131.27:8080. Credentials are |
Hello @agl-developer a few things. In other controls when the form is ready to be saved the buttons looks like the one in the screenshot. I think we shouldn't introduce inconsistencies unless we are going to change the behaviour for every control. Personally, I think what's shown in the screenshot is a clearer CTA. One more thing, when editing the SQL the control correctly allows me to save. However, if I revert the changes to the SQL statement to its original state before saving, it will still allow me to save even though there was no actual change compared to the previous state |
@@ -118,26 +118,14 @@ test('Clicking on "Close" should call onClose', () => { | |||
expect(props.onClose).toBeCalledTimes(1); | |||
}); | |||
|
|||
test('Clicking on "Save" should call onChange and onClose', () => { | |||
test('Clicking on "Save" should not call onChange and onClose', () => { |
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 believe we need to separate the tests here for both calling and not calling
wrapper | ||
.instance() | ||
.onAdhocFilterChange(simpleAdhocFilter.duplicateWith({ operator: null })); | ||
expect(wrapper.find(Button).find({ disabled: true })).toExist(); | ||
expect(wrapper.find(Button).find({ disabled: false })).toExist(); |
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.
Shouldn't the button be disabled at this point?
buttonStyle={ | ||
hasUnsavedChanges && stateIsValid ? 'primary' : 'default' | ||
} | ||
disabled={stateIsValid && !hasUnsavedChanges} |
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.
Shouldn't we account for an invalid state as well?
/testenv up |
@geido Ephemeral environment spinning up at http://35.93.39.51:8080. Credentials are |
… when no changes have been made
02b2668
to
2962bde
Compare
/testenv up |
@geido Ephemeral environment spinning up at http://54.245.47.220:8080. Credentials are |
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.
Thanks @michael-s-molina LGTM!
Ephemeral environment shutdown and build artifacts deleted. |
SUMMARY
In the popover that we show in control panel, if there are no changes made we turn it into secondary button and user is still able to "save" the popover.
If there are no changes made in the popover use primary button in state "disabled"
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
After:
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION