You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by mi...@apache.org on 2023/01/05 19:57:29 UTC
[superset] 09/14: fix: dashboard api cache decorator (#21964)
This is an automated email from the ASF dual-hosted git repository.
michaelsmolina pushed a commit to branch 1.5
in repository https://gitbox.apache.org/repos/asf/superset.git
commit 9ee1138c979b632a548f6a7410e273f272b7b849
Author: Daniel Vaz Gaspar <da...@gmail.com>
AuthorDate: Mon Oct 31 10:26:48 2022 +0000
fix: dashboard api cache decorator (#21964)
(cherry picked from commit c9470cac91943599972d2854db747e3f4d25c206)
---
superset/dashboards/api.py | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/superset/dashboards/api.py b/superset/dashboards/api.py
index d97b5f78e3..75df1858cf 100644
--- a/superset/dashboards/api.py
+++ b/superset/dashboards/api.py
@@ -265,6 +265,8 @@ class DashboardRestApi(BaseSupersetModelRestApi):
self.appbuilder.app.config["VERSION_SHA"],
)
+ @expose("/<id_or_slug>", methods=["GET"])
+ @protect()
@etag_cache(
get_last_modified=lambda _self, id_or_slug: DashboardDAO.get_dashboard_changed_on( # pylint: disable=line-too-long,useless-suppression
id_or_slug
@@ -275,8 +277,6 @@ class DashboardRestApi(BaseSupersetModelRestApi):
),
skip=lambda _self, id_or_slug: not is_feature_enabled("DASHBOARD_CACHE"),
)
- @expose("/<id_or_slug>", methods=["GET"])
- @protect()
@safe
@statsd_metrics
@event_logger.log_this_with_context(
@@ -321,6 +321,8 @@ class DashboardRestApi(BaseSupersetModelRestApi):
result = self.dashboard_get_response_schema.dump(dash)
return self.response(200, result=result)
+ @expose("/<id_or_slug>/datasets", methods=["GET"])
+ @protect()
@etag_cache(
get_last_modified=lambda _self, id_or_slug: DashboardDAO.get_dashboard_and_datasets_changed_on( # pylint: disable=line-too-long,useless-suppression
id_or_slug
@@ -331,8 +333,6 @@ class DashboardRestApi(BaseSupersetModelRestApi):
),
skip=lambda _self, id_or_slug: not is_feature_enabled("DASHBOARD_CACHE"),
)
- @expose("/<id_or_slug>/datasets", methods=["GET"])
- @protect()
@safe
@statsd_metrics
@event_logger.log_this_with_context(
@@ -386,6 +386,8 @@ class DashboardRestApi(BaseSupersetModelRestApi):
except DashboardNotFoundError:
return self.response_404()
+ @expose("/<id_or_slug>/charts", methods=["GET"])
+ @protect()
@etag_cache(
get_last_modified=lambda _self, id_or_slug: DashboardDAO.get_dashboard_and_slices_changed_on( # pylint: disable=line-too-long,useless-suppression
id_or_slug
@@ -396,8 +398,6 @@ class DashboardRestApi(BaseSupersetModelRestApi):
),
skip=lambda _self, id_or_slug: not is_feature_enabled("DASHBOARD_CACHE"),
)
- @expose("/<id_or_slug>/charts", methods=["GET"])
- @protect()
@safe
@statsd_metrics
@event_logger.log_this_with_context(