-
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(sqllab): Allow opening of SQL Lab in new browser tab #25582
fix(sqllab): Allow opening of SQL Lab in new browser tab #25582
Conversation
@@ -294,12 +323,13 @@ class DatasourceControl extends React.PureComponent { | |||
)} | |||
<Menu.Item key={CHANGE_DATASET}>{t('Swap dataset')}</Menu.Item> | |||
{!isMissingDatasource && canAccessSqlLab && ( | |||
<Menu.Item> | |||
<Menu.Item key={VIEW_IN_SQL_LAB}> |
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.
}, | ||
}); | ||
} else { | ||
SupersetClient.postForm(redirectUrl, { |
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 form_data := request.form.get("form_data"): | ||
with contextlib.suppress(json.JSONDecodeError): | ||
payload["requested_query"] = json.loads(form_data) | ||
return self.render_app_template(payload) |
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.
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
SUMMARY
Fixes the addressed issue (no. 6) on #25151 (comment)
Since the #25151 replaces the SupersetClient.postForm by the router navigation, it loses the way to open the sql link in the new browser tab.
This commit recovers the way of opening sql in the new browser tab forcefully (when opening the link with the command/window key pressed).
BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
Before:
before--cmd-open.mov
After:
after--cmd-open.mov
TESTING INSTRUCTIONS
Go to Explore and open the control menu
Click the Open in SQL Lab link with the cmd key (cmd + click/win + click)
The editor with the populated sql will be opened in the new browser tab
ADDITIONAL INFORMATION