-
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: save active tabs in dashboard permalink #19983
Conversation
Codecov Report
@@ Coverage Diff @@
## master #19983 +/- ##
==========================================
- Coverage 66.85% 66.85% -0.01%
==========================================
Files 1749 1750 +1
Lines 65411 65424 +13
Branches 6906 6906
==========================================
+ Hits 43730 43737 +7
- Misses 19931 19937 +6
Partials 1750 1750
Flags with carried forward coverage won't be shown. Click here to find out more.
Continue to review full report at Codecov.
|
const canEdit = canUserEditDashboard(dashboardData, user); | ||
const canEdit = canUserEditDashboard(dashboard, user); | ||
|
||
console.log(activeTabs); |
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.
left over console log
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 for catching this! I'll keep iterating on this PR until #19966 is merged.
7b670a3
to
e50a8eb
Compare
8019609
to
d31f0a8
Compare
@eschutho This should be ready for re-review. @villebro @michael-s-molina in case you have an interest in this as well. |
onClick={e => { | ||
e.stopPropagation(); | ||
}} | ||
> |
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.
d31f0a8
to
61092e5
Compare
61092e5
to
dbe28d1
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.
a few comments, but nothing blocking i think
@@ -66,7 +75,14 @@ export default function URLShortLinkButton({ | |||
trigger="click" | |||
placement={placement} | |||
content={ | |||
<div id="shorturl-popover" data-test="shorturl-popover"> | |||
// eslint-disable-next-line jsx-a11y/no-static-element-interactions |
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.
hmm, shouldn't the stop propagation go on the copy to clipboard link instead? It's weird that we need to handle a click on a div
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 click event also triggers popover open. Since this is related to the popover, I thought it'd make more sense to handle the event on the direct children of the popover trigger. If we stop propagation on the icon, the popover may not even open.
.catch(response => | ||
// @ts-ignore | ||
getClientErrorObject(response).then(({ error, statusText }) => | ||
Promise.reject(error || statusText), | ||
), | ||
); |
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.
we'll never get an error here?
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.
Errors should be handled downstream---when it's about to be rendered. These adhoc handling of API errors makes it more difficult to handle errors consistently.
@@ -21,14 +21,16 @@ | |||
from superset import security_manager | |||
from superset.models.helpers import AuditMixinNullable, ImportExportMixin | |||
|
|||
VALUE_MAX_SIZE = 2**24 - 1 |
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.
heh, nice bycatch
from superset.migrations.shared.utils import paginated_update | ||
|
||
Base = declarative_base() | ||
VALUE_MAX_SIZE = 2**24 - 1 |
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.
can we import this from the model file instead of defining it twice?
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.
We shouldn't import things from modules for migrations as modules may be move around and these constant values may change but migrations need to be deterministic.
@@ -2001,13 +2001,13 @@ def dashboard_permalink( # pylint: disable=no-self-use | |||
return redirect("/dashboard/list/") | |||
if not value: | |||
return json_error_response(_("permalink state not found"), status=404) | |||
dashboard_id = value["dashboardId"] | |||
dashboard_id, state = value["dashboardId"], value.get("state", {}) |
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.
is this standard styling? i would just use 2 lines tbh
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.
Nah, just my style choice. Since they are both derived from the same variable. It's more concise to be written in one line. This is similar to object expansion in JS.
(cherry picked from commit cadd259)
SUMMARY
Save which tabs are selected in permalink state and restore the tab selection so we can restore the same tab selection when users open a dashboard using permalink.
Also renamed properties in the dashboard permalink state to make them easier to understand.
This is in preparation for #19354 where we allow users to set tab selection when generating email reports for dashboards. The next step is to generate dashboard screenshots from permalink as well and attach the permalink to the email reports (we will generate a new permalink in the backend based on reports metadata). The next next step is to allow saving filter states in dashboard reports, too.
Depends on #19966
This PR includes a db migration where we renamed a couple of properties in permalink states. The migration should be fairly low risk since we are only updating permalinks for dashboards. At Airbnb, after running Superset with the new permalink feature for 3 weeks, there are only about 1400 links generated.
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A
TESTING INSTRUCTIONS
ADDITIONAL INFORMATION