You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2026/04/23 17:37:27 UTC
(superset) 10/25: Address comments
This is an automated email from the ASF dual-hosted git repository.
betodealmeida pushed a commit to branch backup/semantic-layer-rename-database-dataset-before-rebase-20260423-133321
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 1f43b3fa0ee39d9b41772eba0c5a60d0d7fee29f
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Mon Mar 30 20:05:07 2026 -0400
Address comments
---
superset-frontend/src/pages/DatasetList/index.tsx | 24 ++++++++++++++++++++++-
superset/semantic_layers/api.py | 13 +++++++++++-
2 files changed, 35 insertions(+), 2 deletions(-)
diff --git a/superset-frontend/src/pages/DatasetList/index.tsx b/superset-frontend/src/pages/DatasetList/index.tsx
index 49b2bdc4676..8302e165e2f 100644
--- a/superset-frontend/src/pages/DatasetList/index.tsx
+++ b/superset-frontend/src/pages/DatasetList/index.tsx
@@ -270,6 +270,9 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
null,
);
+ const [svCurrentlyDeleting, setSvCurrentlyDeleting] =
+ useState<Dataset | null>(null);
+
const [showAddSemanticViewModal, setShowAddSemanticViewModal] =
useState(false);
const [importingDataset, showImportModal] = useState<boolean>(false);
@@ -407,11 +410,18 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
[addDangerToast, setPreparingExport],
);
- const handleSemanticViewDelete = ({ id, table_name: tableName }: Dataset) => {
+ const handleSemanticViewDelete = (sv: Dataset) => {
+ setSvCurrentlyDeleting(sv);
+ };
+
+ const handleSemanticViewDeleteConfirm = () => {
+ if (!svCurrentlyDeleting) return;
+ const { id, table_name: tableName } = svCurrentlyDeleting;
SupersetClient.delete({
endpoint: `/api/v1/semantic_view/${id}`,
}).then(
() => {
+ setSvCurrentlyDeleting(null);
refreshData();
addSuccessToast(t('Deleted: %s', tableName));
},
@@ -1189,6 +1199,18 @@ const DatasetList: FunctionComponent<DatasetListProps> = ({
title={t('Delete Dataset?')}
/>
)}
+ {svCurrentlyDeleting && (
+ <DeleteModal
+ description={t(
+ 'Are you sure you want to delete %s?',
+ svCurrentlyDeleting.table_name,
+ )}
+ onConfirm={handleSemanticViewDeleteConfirm}
+ onHide={() => setSvCurrentlyDeleting(null)}
+ open
+ title={t('Delete Semantic View?')}
+ />
+ )}
{datasetCurrentlyEditing && (
<DatasourceModal
datasource={datasetCurrentlyEditing}
diff --git a/superset/semantic_layers/api.py b/superset/semantic_layers/api.py
index 20526c9e42b..d24b87e7c04 100644
--- a/superset/semantic_layers/api.py
+++ b/superset/semantic_layers/api.py
@@ -23,6 +23,7 @@ from flask import make_response, request, Response
from flask_appbuilder.api import expose, protect, rison, safe
from flask_appbuilder.api.schemas import get_list_schema
from flask_appbuilder.models.sqla.interface import SQLAInterface
+from flask_babel import lazy_gettext as t
from marshmallow import ValidationError
from pydantic import ValidationError as PydanticValidationError
@@ -545,7 +546,17 @@ class SemanticLayerRestApi(BaseSupersetApi):
try:
views = layer.implementation.get_semantic_views(runtime_data)
except Exception as ex: # pylint: disable=broad-except
- return self.response_400(message=str(ex))
+ logger.error(
+ "Error fetching semantic views for layer %s: %s",
+ uuid,
+ str(ex),
+ exc_info=True,
+ )
+ return self.response_400(
+ message=t(
+ "Unable to fetch semantic views. Check the layer configuration."
+ )
+ )
# Check which views already exist with the same runtime config
existing = SemanticViewDAO.find_by_semantic_layer(str(layer.uuid))