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: Show sqllab state when deleting databases #17331

Merged
merged 7 commits into from
Nov 5, 2021
Merged

Conversation

hughhhh
Copy link
Member

@hughhhh hughhhh commented Nov 3, 2021

SUMMARY

Provide more context on the SQL Tab States for any database that is about to be deleted. Before we'd only show charts and dashboards, now we show the number of tab states currently saved in the metastore. These tabs would block database deletion and raise a non informative message after the request.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

Before

Screen Shot 2021-06-23 at 2 45 15 PM

After

Screen Shot 2021-11-03 at 8 49 28 PM

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

@codecov
Copy link

codecov bot commented Nov 3, 2021

Codecov Report

Merging #17331 (c583ae2) into master (03a2c6e) will decrease coverage by 0.13%.
The diff coverage is 44.00%.

❗ Current head c583ae2 differs from pull request most recent head 28e44fb. Consider uploading reports for the commit 28e44fb to get more accurate results
Impacted file tree graph

@@            Coverage Diff             @@
##           master   #17331      +/-   ##
==========================================
- Coverage   77.19%   77.06%   -0.14%     
==========================================
  Files        1036     1036              
  Lines       55696    55729      +33     
  Branches     7627     7627              
==========================================
- Hits        42994    42945      -49     
- Misses      12446    12528      +82     
  Partials      256      256              
Flag Coverage Δ
javascript 71.41% <ø> (ø)
presto ?

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

Impacted Files Coverage Δ
...tend/src/views/CRUD/data/database/DatabaseList.tsx 78.07% <ø> (ø)
superset/connectors/sqla/models.py 86.58% <ø> (-1.28%) ⬇️
superset/databases/dao.py 100.00% <ø> (ø)
superset/examples/bart_lines.py 25.80% <25.00%> (-1.78%) ⬇️
superset/examples/country_map.py 23.80% <25.00%> (-1.20%) ⬇️
superset/examples/energy.py 25.00% <25.00%> (-1.20%) ⬇️
superset/examples/flights.py 17.64% <25.00%> (-1.11%) ⬇️
superset/examples/long_lat.py 22.72% <25.00%> (-1.09%) ⬇️
superset/examples/multiformat_time_series.py 16.00% <25.00%> (-0.67%) ⬇️
superset/examples/paris.py 25.00% <25.00%> (-1.93%) ⬇️
... and 16 more

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 03a2c6e...28e44fb. Read the comment docs.

@hughhhh hughhhh changed the title WIP - Show sqllab state when deleting dataset fix: Show sqllab state when deleting dataset Nov 4, 2021
@hughhhh hughhhh force-pushed the hugh/show-tabstates branch 3 times, most recently from 94006e3 to fc6ac10 Compare November 4, 2021 00:50
@hughhhh hughhhh force-pushed the hugh/show-tabstates branch from fc6ac10 to bd3bf6e Compare November 4, 2021 01:10
@pull-request-size pull-request-size bot added size/M and removed size/S labels Nov 4, 2021
@hughhhh hughhhh changed the title fix: Show sqllab state when deleting dataset fix: Show sqllab state when deleting databases Nov 4, 2021
Copy link
Member

@betodealmeida betodealmeida left a comment

Choose a reason for hiding this comment

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

Looks great! I left a comment on the messaging, but we can do that later in a separate PR.

@@ -437,10 +439,11 @@ function DatabaseList({ addDangerToast, addSuccessToast }: DatabaseListProps) {
{databaseCurrentlyDeleting && (
<DeleteModal
description={t(
'The database %s is linked to %s charts that appear on %s dashboards. Are you sure you want to continue? Deleting the database will break those objects.',
'The database %s is linked to %s charts that appear on %s dashboards and users have %s SQL Lab tabs using this database open. Are you sure you want to continue? Deleting the database will break those objects.',
Copy link
Member

Choose a reason for hiding this comment

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

It would be nice to skip this message if all the counts are 0, something like:

const message = (
  databaseCurrentlyDeleting.chart_count +
  databaseCurrentlyDeleting.dashboard_count +
  databaseCurrentlyDeleting.sqllab_tab_count) === 0
  ? 'There are no charts, dashboards or queries associated with this database, it should be safe to delete.'
  : 'The database %s is linked to ...';

@hughhhh hughhhh merged commit e5fe186 into master Nov 5, 2021
AAfghahi pushed a commit that referenced this pull request Jan 10, 2022
* saving

* fix ts

* update test

* update test

* log unit

* updated test
@mistercrunch mistercrunch added 🏷️ bot A label used by `supersetbot` to keep track of which PR where auto-tagged with release labels 🚢 1.5.0 labels Mar 13, 2024
@mistercrunch mistercrunch deleted the hugh/show-tabstates branch March 26, 2024 17:56
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/M 🚢 1.5.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants