mikebridge commented on code in PR #42845:
URL: https://github.com/apache/superset/pull/42845#discussion_r3833819242
##########
superset-frontend/src/pages/DatabaseList/index.tsx:
##########
@@ -101,6 +101,79 @@ interface DatabaseDeleteObject extends DatabaseObject {
dashboards: any;
sqllab_tab_count: number;
}
+
+/** How many dependent semantic views the delete confirmation lists by name. */
+const MAX_DEPENDENT_VIEWS_LISTED = 10;
+
+type SemanticLayerDeletePreview =
+ | { status: 'loading'; item: ConnectionItem }
+ | {
+ status: 'loaded';
+ item: ConnectionItem;
+ dependentViewCount: number;
+ dependentViewNames: string[];
+ }
+ | { status: 'failed'; item: ConnectionItem };
+
+type ResolvedSemanticLayerDeletePreview = Exclude<
+ SemanticLayerDeletePreview,
+ { status: 'loading' }
+>;
+
+function SemanticLayerCascadeWarning({
+ preview,
+}: {
+ preview: ResolvedSemanticLayerDeletePreview;
+}) {
+ if (preview.status === 'failed' || preview.dependentViewCount === 0) {
+ return (
+ <p>
+ {t(
+ 'Deleting this semantic layer also permanently deletes any semantic
views it contains, and charts built on those views will stop working. The
affected views could not be listed.',
+ )}
+ </p>
+ );
+ }
Review Comment:
Good catch, and thanks for checking the access-filtering angle so this could
be an honest empty state rather than another hedge. Applied as suggested in
bcca1b4e53 (empty/failed split + the test rename — the renamed test now
discriminates and fails against the folded condition), with the rest of the
review folded into f35a8fbf9b: the two-row stale-lookup race test (control-run
verified — deleting the guard lines fails it), the name list gated on a
non-empty page with collision-proof keys, the hoisted `isLoadingDependents`
predicate, and the PR body's test-count corrections. Styling modernization of
the copied modal markup left for the sibling-modal sweep as you suggested.
*Comment by Claude (AI) on behalf of @mikebridge.*
--
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]