-
Notifications
You must be signed in to change notification settings - Fork 14.3k
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(explore): Fix chart standalone URL for report/thumbnail generation #20673
Conversation
|
||
# Testing overrides | ||
resp = self.get_resp("/superset/slice/{}/?standalone=true".format(slc.id)) | ||
assert '<div class="navbar' not in resp |
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.
if this is false now, what's the current value? Do we still have a standalone url without the nav?
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 that now that Explore is in the SPA, the response doc just contains the SPA wrapper. I was assuming that get_resp
doesn't download/execute the JS bundle, so I think these tests were only still passing by accident:
"Original value"
and"List Roles"
are contained in the embedded bootstrap data but I don't think that bootstrap data is used by Explore anymore (it uses API endpoints now)<div class="navbar'
isn't present in either standalone or non-standalone mode anymore
So, it seemed like these tests don't test anything meaningful anymore, with the exception of the 404 test below. I looked around for examples of backend tests for Dashboard, but didn't see much and assumed they had also been removed when Dashboard was brought into the SPA.
Should we make the url parameter case insensitive where it is consumed? |
4496c46
to
3003312
Compare
Codecov Report
@@ Coverage Diff @@
## master #20673 +/- ##
==========================================
- Coverage 66.84% 66.14% -0.70%
==========================================
Files 1750 1754 +4
Lines 65896 66684 +788
Branches 7017 7049 +32
==========================================
+ Hits 44048 44111 +63
- Misses 20062 20776 +714
- Partials 1786 1797 +11
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
@ktmud I think I'd lean slightly towards keeping it case-sensitive on the client side, just to keep the server-client contract as explicit as possible, but no strong feelings either way! |
In general, restrictions on multi-choice or boolean inputs on the client side should be more relaxed unless it has security implications or significantly increases code complexity. This helps with usability---"you know my intention, just give me what I want already." |
/testenv up |
@rusackas Container image not yet published for this PR. Please try again when build is complete. |
@rusackas Ephemeral environment creation failed. Please check the Actions logs for details. |
Hi @codyml, I look into the related codebase. I think you just change one line to fix it.
|
@codyml Thank you for the PR. Can we rebase this and check if there's any |
06410e8
to
e37caff
Compare
e37caff
to
e1ade31
Compare
Thanks for the fix! The code looks great to me, but I can't fully test it, because for some reason the reports don't work for me on localhost (unrelated to this PR) |
endpoint += f"&{ReservedUrlParameters.STANDALONE}={is_standalone_mode}" | ||
endpoint += f"&{ReservedUrlParameters.STANDALONE}=true" |
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 boolean type can be implicitly converted to string.
Python 3.8.6 (default, Nov 11 2020, 23:52:15)
[Clang 12.0.0 (clang-1200.0.32.21)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> str(True)
'True'
>>> str(False)
'False'
>>>
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.
For this one the implicit conversion to True
was part of why the URL wasn't working: the frontend expected it to be lowercase, so I wanted to make that explicit. But, I did update the frontend so if others use implicit conversion from Python bool
it should work!
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.
leave a no-blocking suggestion, others lgtm.
e4e2804
to
5051c24
Compare
Co-authored-by: Michael S. Molina <[email protected]>
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.
LGTM
a3a61aa
to
bc0c8cc
Compare
/testenv up FEATURE_THUMBNAILS=true |
@jinghua-qa Ephemeral environment spinning up at http://34.222.120.222:8080. Credentials are |
@michael-s-molina i am ok with merge this pr first if you think deck is low priority, and we probably need to cherry this in for release candidate. |
@jinghua-qa Let's merge this first and follow up with a fix to deck charts. |
Ephemeral environment shutdown and build artifacts deleted. |
🏷️ preset:2022.29 |
apache#20673) * Update explore URLs. * More URL fixes. * Make frontend accept true/false query params case-insensitively. * Fix URL mistake. Co-authored-by: Michael S. Molina <[email protected]> Co-authored-by: Michael S. Molina <[email protected]> (cherry picked from commit 84d4302)
SUMMARY
When Explore was moved into the SPA, it changed url from
/superset/explore
to/explore
. This PR updates (hopefully) all of the URL references to/superset/explore
that weren't updated accordingly. In detail:/superset/explore/?{queryparams}
-->/explore/?{queryparams}
/superset/explore/table/{id}
-->/explore/?dataset_type=table&dataset_id={id}
/superset/explore/p/{hash}
--> unchanged/superset/explore_json
--> unchangedThis should hopefully fix thumbnail and alert generation and other broken links.
The following tweaks are also included:
standalone
query param istrue
instead ofTrue
.True
as a query param for the above, just in case.BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
TESTING INSTRUCTIONS
/testenv up FEATURE_THUMBNAILS=true
)/testenv up FEATURE_ALERT_REPORTS=true
)/superset/slice/{id}/standalone=true
resolve correctly to a standalone-mode chartADDITIONAL INFORMATION