fix(Dashboard): Copying a Dashboard does not commit the transaction (#29776)

This commit is contained in:
Geido
2024-07-31 19:40:23 +03:00
committed by GitHub
parent 06c9f3368a
commit 4c52ecc4d8
4 changed files with 123 additions and 2 deletions

View File

@@ -34,10 +34,12 @@ from werkzeug.wsgi import FileWrapper
from superset import db, is_feature_enabled, thumbnail_cache
from superset.charts.schemas import ChartEntityResponseSchema
from superset.commands.dashboard.copy import CopyDashboardCommand
from superset.commands.dashboard.create import CreateDashboardCommand
from superset.commands.dashboard.delete import DeleteDashboardCommand
from superset.commands.dashboard.exceptions import (
DashboardAccessDeniedError,
DashboardCopyError,
DashboardCreateFailedError,
DashboardDeleteFailedError,
DashboardForbiddenError,
@@ -1606,9 +1608,11 @@ class DashboardRestApi(BaseSupersetModelRestApi):
return self.response_400(message=error.messages)
try:
dash = DashboardDAO.copy_dashboard(original_dash, data)
dash = CopyDashboardCommand(original_dash, data).run()
except DashboardForbiddenError:
return self.response_403()
except DashboardCopyError:
return self.response_400()
return self.response(
200,