You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@superset.apache.org by GitBox <gi...@apache.org> on 2020/09/24 16:18:07 UTC

[GitHub] [incubator-superset] bkyryliuk commented on a change in pull request #10963: feat: enable ETag header for dashboard GET requests

bkyryliuk commented on a change in pull request #10963:
URL: https://github.com/apache/incubator-superset/pull/10963#discussion_r494446189



##########
File path: superset/views/utils.py
##########
@@ -298,6 +306,46 @@ def get_time_range_endpoints(
 CONTAINER_TYPES = ["COLUMN", "GRID", "TABS", "TAB", "ROW"]
 
 
+def get_dashboard(dashboard_id_or_slug: str,) -> Dashboard:
+    session = db.session()
+    qry = session.query(Dashboard)
+    if dashboard_id_or_slug.isdigit():
+        qry = qry.filter_by(id=int(dashboard_id_or_slug))
+    else:
+        qry = qry.filter_by(slug=dashboard_id_or_slug)
+    dashboard = qry.one_or_none()
+
+    if not dashboard:
+        abort(404)
+
+    return dashboard
+
+
+def get_datasources_from_dashboard(
+    dashboard: Dashboard,
+) -> DefaultDict[Any, List[Any]]:
+    datasources = defaultdict(list)
+    for slc in dashboard.slices:
+        datasource = slc.datasource
+        if datasource:
+            datasources[datasource].append(slc)
+    return datasources
+
+
+def get_dashboard_latest_changed_on(_self: Any, dashboard_id_or_slug: str) -> datetime:
+    """
+    Get latest changed datetime for a dashboard. The change could be dashboard

Review comment:
       s/Get latest changed datetime for a dashboard.
   /Get latest changed datetime for a dashboard and it's charts




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@superset.apache.org
For additional commands, e-mail: notifications-help@superset.apache.org