geido commented on code in PR #44392:
URL: https://github.com/apache/superset/pull/44392#discussion_r4062825543
##########
superset-frontend/src/pages/DatabaseList/index.tsx:
##########
@@ -1098,16 +1198,37 @@ function DatabaseList({
<DeleteModal
description={
<>
- <p>
- {t('The %s', databaseLabelLower())}{' '}
- <b>{databaseCurrentlyDeleting.database_name}</b>{' '}
- {t(
- '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.',
- databaseCurrentlyDeleting.charts.count,
- databaseCurrentlyDeleting.dashboards.count,
- databaseCurrentlyDeleting.sqllab_tab_count,
- )}
- </p>
+ {/* Datasets block the delete outright (the backend refuses while
+ any dataset still references the database), so the dataset
+ case must not promise a destructive outcome that cannot
+ happen -- it has to say the delete is blocked and name what
+ is blocking it. */}
+ {databaseCurrentlyDeleting.datasets.count >= 1 ? (
+ <p>
+ {t('The %s', databaseLabelLower())}{' '}
+ <b>{databaseCurrentlyDeleting.database_name}</b>{' '}
+ {tn(
+ 'cannot be deleted because %s dataset is still attached to
it. Delete or move that dataset first.',
+ 'cannot be deleted because %s datasets are still attached
to it. Delete or move those datasets first.',
Review Comment:
Good catch. I updated the blocked copy to point users to **Recently archived
→ Delete permanently**, and added coverage for the archived-only case.
##########
superset-frontend/src/pages/DatabaseList/index.tsx:
##########
@@ -1206,6 +1327,7 @@ function DatabaseList({
}}
onHide={() => setDatabaseCurrentlyDeleting(null)}
open
+ disablePrimaryButton={databaseCurrentlyDeleting.datasets.count >= 1}
Review Comment:
Agreed. I kept the modal structure consistent, but the confirmation input is
now disabled and no longer focused whenever deletion is blocked; the primary
action stays disabled too. Covered in both the shared modal and database-list
tests.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]