Skip to content
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

Conversation

justinpark
Copy link
Member

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

  • Has associated issue:
  • Required feature flags:
  • Changes UI
  • Includes DB Migration (follow approval process in SIP-59)
    • Migration is atomic, supports rollback & is backwards-compatible
    • Confirm DB migration upgrade and downgrade tested
    • Runtime estimates and downtime expectations provided
  • Introduces new feature or API
  • Removes existing feature or API

@@ -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}>
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

},
});
} else {
SupersetClient.postForm(redirectUrl, {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +44 to +47
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)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@john-bodley john-bodley changed the title fix(sqllab): Forcefully open sql in new browser tab fix(sqllab): Allow opening of SQL Lab in new browser tab Oct 10, 2023
Copy link
Member

@michael-s-molina michael-s-molina left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@justinpark justinpark merged commit 003001f into apache:master Oct 13, 2023
@justinpark justinpark deleted the fix--forcefully-open-sql-in-new-browser-tab branch October 13, 2023 15:16
cccs-rc pushed a commit to CybercentreCanada/superset that referenced this pull request Mar 6, 2024
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 3.1.0 labels Mar 8, 2024
sfirke pushed a commit to sfirke/superset that referenced this pull request Mar 22, 2024
vinothkumar66 pushed a commit to vinothkumar66/superset that referenced this pull request Nov 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels size/L 🚢 3.1.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants