-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Remove redundant (and wrong) hasData
check from ViewHeader component
#37566
Conversation
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
|
661496a
to
97bdc11
Compare
- This commit makes the test more explicit and more understandable. - Fix the test assumption In all other cases, we show the Save button to the nodata user, but we disable it. It was only in this test that we wrongly asserted that the button doesn't exist at all.
64d17c9
to
9504f8d
Compare
const isNewQuery = !question | ||
.legacyQuery({ useStructuredQuery: true }) | ||
.hasData(); |
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 condition was wrong all along. Or to be more precise, negating the hasData
check was wrong. It only worked because of a fallback condition.
https://github.com/metabase/metabase/pull/37566/files#diff-7eae47ba62c31da65c448230eacac88be86470a204d450011acb631d7bb74144L426
But even the fallback was wrong.
canEditQuery
shouldn't affect whether or not the button is shown. It only affects whether or not the button is disabled. This caused a bug where users without data permissions wouldn't even see the "Save" button.
The existing E2E test was originally written with that assumption in mind. I've updated the test.
"Nodata" user should see a disabled Save button.
hasData
checkhasData
check from ViewHeader component
@nemanjaglumac Did you forget to add a milestone to the issue for this PR? When and where should I add a milestone? |
This PR resolves #37516 by
migrating theremoving the redundant check altogether.hasData
check to MLv2 for cases when the query is the instance of a StructuredQueryWe might soon be able to do this for the native query check as well, but for now it has to use the old version of the lib.Once we migrate the second (native) part to MLv2, we can mark #37227 as done.
As it turned out that
hasData()
is not even needed in this file, it removes the need to handle structured and native queries separately.This PR also marks
hasData()
methods on StructuredQuery and NativeQuery as deprecated.