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(sql Lab tabs): Empty SQL Lab tabs #18817

Merged
merged 7 commits into from
Feb 25, 2022

Conversation

AAfghahi
Copy link
Member

@AAfghahi AAfghahi commented Feb 18, 2022

SUMMARY

This PR finishes the work that was done in #17700 by adding a new tab if a user exits out of their current tabs.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

After:
Screen Shot 2022-02-18 at 3 42 56 PM

Screen.Recording.2022-02-18.at.3.49.05.PM.mov

TESTING INSTRUCTIONS

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

@superset-github-bot superset-github-bot bot added the Superset-Community-Partners Preset community partner program participants label Feb 18, 2022
@AAfghahi AAfghahi force-pushed the arash/empty_sql_tab_state branch 2 times, most recently from a7bf598 to 7438bce Compare February 18, 2022 20:48
@AAfghahi AAfghahi changed the title Arash/empty sql tab state fix (sql Lab tabs): Empty SQL Lab tabs Feb 18, 2022
@AAfghahi AAfghahi changed the title fix (sql Lab tabs): Empty SQL Lab tabs fix(sql Lab tabs): Empty SQL Lab tabs Feb 18, 2022
@eschutho
Copy link
Member

/testenv up

@github-actions
Copy link
Contributor

@eschutho Ephemeral environment spinning up at http://34.211.67.82:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

const emptyTab = (
<EditableTabs.TabPane
key={Math.random()}
data-key={Math.random()}
Copy link
Member

@hughhhh hughhhh Feb 18, 2022

Choose a reason for hiding this comment

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

Do we need to have these key and data-key set?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yeah I was worried about hardcoding a number, but I think that you are right and that this would be the ebst way forward.

closable={false}
>
<StyledImage>
<img src={emptySqlChart} alt="No SQL tabs" />
Copy link
Member

Choose a reason for hiding this comment

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

can you write a small test making sure this renders when this.props.queryEditors?.length === 0

Copy link
Member Author

Choose a reason for hiding this comment

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

will do rn

@codecov
Copy link

codecov bot commented Feb 18, 2022

Codecov Report

Merging #18817 (b867472) into master (5752372) will increase coverage by 0.02%.
The diff coverage is 75.00%.

❗ Current head b867472 differs from pull request most recent head 01d1199. Consider uploading reports for the commit 01d1199 to get more accurate results

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #18817      +/-   ##
==========================================
+ Coverage   66.19%   66.21%   +0.02%     
==========================================
  Files        1633     1633              
  Lines       63210    63218       +8     
  Branches     6409     6412       +3     
==========================================
+ Hits        41839    41858      +19     
+ Misses      19711    19699      -12     
- Partials     1660     1661       +1     
Flag Coverage Δ
javascript 51.02% <75.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...d/src/SqlLab/components/TabbedSqlEditors/index.jsx 57.44% <75.00%> (+1.05%) ⬆️
superset-frontend/src/chart/Chart.jsx 51.78% <0.00%> (ø)
superset-frontend/src/chart/chartReducer.ts 25.00% <0.00%> (ø)
superset/views/core.py 77.50% <0.00%> (+0.44%) ⬆️
superset/models/core.py 88.91% <0.00%> (+0.72%) ⬆️
superset/db_engine_specs/mysql.py 97.59% <0.00%> (+3.61%) ⬆️
superset/common/utils/dataframe_utils.py 92.85% <0.00%> (+7.14%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5752372...01d1199. Read the comment docs.

Copy link
Member

@yousoph yousoph left a comment

Choose a reason for hiding this comment

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

  • Can we update the tab height in the blank state so that it doesn't jump when you add a new tab?
  • The image on the blank state looks blurry to me right now, do you mind taking a look?

@villebro
Copy link
Member

Thanks for working on this @AAfghahi! I pinged @kgabryje for a review; He's done similar work by introducing a new EmptyState component in #18676 which has been rolled out in several follow-up PRs (#18678, #18679, #18681 and #18712). By leveraging a similar approach here we could potentially address @yousoph's observation regarding the blurry empty state and consolidate code that deals with empty states.

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

Hey @AAfghahi! 3 comments:

  1. Can you please use 1 of the components from src/components/EmptyState? I think EmptyStateBig will fit well here.
  2. I'd suggest using svg instead of png. If you add the image to /superset-frontend/src/assets/images/, you can just pass the name of the file to the empty state component.
  3. Please export from figma just the image, without the text. EmptyState accepts title and description props

So you can add the empty state component like this:

<EmptyStateBig
          title={t('Add a new tab to create SQL query')}
          image="image-name.svg"
/>

<EditableTabs.TabPane
key={0}
data-key={0}
tab={<TabTitle>Add a New Tab</TabTitle>}
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
tab={<TabTitle>Add a New Tab</TabTitle>}
tab={<TabTitle>{t('Add a New Tab')}</TabTitle>}

Copy link
Member

@kgabryje kgabryje Feb 21, 2022

Choose a reason for hiding this comment

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

Also, I think we should use sentence case here, like Add a new tab

Copy link
Member Author

Choose a reason for hiding this comment

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

Thank you for this and the empty state, implemented them, just working on the last bit (making the tabs the right height).

Copy link
Member

@kgabryje kgabryje left a comment

Choose a reason for hiding this comment

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

Thanks for the improvements!
1 more comment - the text in empty tab doesn't seem to be centered
image

@AAfghahi
Copy link
Member Author

AAfghahi commented Feb 22, 2022

Thanks for the improvements! 1 more comment - the text in empty tab doesn't seem to be centered image

good catch! I need to add some padding to make it the same height as regular tab. This should be fixed now.

@eschutho eschutho added the need:qa-review Requires QA review label Feb 23, 2022
@apache apache deleted a comment from github-actions bot Feb 23, 2022
@apache apache deleted a comment from github-actions bot Feb 23, 2022
@AAfghahi
Copy link
Member Author

/testenv up FEATURE_SQLLAB_BACKEND_PERSISTENCE=True

@github-actions
Copy link
Contributor

@AAfghahi Ephemeral environment spinning up at http://34.210.152.193:8080. Credentials are admin/admin. Please allow several minutes for bootstrapping and startup.

Copy link
Member

@jinghua-qa jinghua-qa left a comment

Choose a reason for hiding this comment

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

LGTM!

@AAfghahi AAfghahi dismissed yousoph’s stale review February 25, 2022 16:00

spoke to her about it

@hughhhh hughhhh merged commit 147dc5a into apache:master Feb 25, 2022
@github-actions
Copy link
Contributor

Ephemeral environment shutdown and build artifacts deleted.

villebro pushed a commit that referenced this pull request Apr 3, 2022
* Empty SQL table message on zero tabs

* sql editor no editor tab bug fix

* Revert Error message

* empty state tab state

* added a unit test

* addressed reviews

* kasia feedback

Co-authored-by: Yahya Kayani <yahyakiani1@gmail.com>
(cherry picked from commit 147dc5a)
@mistercrunch mistercrunch added 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 2.0.0 labels Mar 13, 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 lts-v1 need:qa-review Requires QA review size/M 🍒 1.5.0 🍒 1.5.1 🍒 1.5.2 🍒 1.5.3 🚢 2.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

10 participants