john-bodley commented on a change in pull request #9311: [cache warm_up]
warm_up slice with dashboard default_filters
URL:
https://github.com/apache/incubator-superset/pull/9311#discussion_r394102501
##########
File path: superset/views/utils.py
##########
@@ -262,3 +263,90 @@ def get_time_range_endpoints(
return (TimeRangeEndpoint(start), TimeRangeEndpoint(end))
return (TimeRangeEndpoint.INCLUSIVE, TimeRangeEndpoint.EXCLUSIVE)
+
+
+# see all dashboard components type in
+# /superset-frontend/src/dashboard/util/componentTypes.js
+CONTAINER_TYPES = ["COLUMN", "GRID", "TABS", "TAB", "ROW"]
+
+
+def get_dashboard_extra_filters(
+ slice_id: int, dashboard_id: int
+) -> List[Dict[str, Any]]:
+ session = db.session()
+ dashboard =
session.query(Dashboard).filter_by(id=dashboard_id).one_or_none()
+
+ # is chart in this dashboard?
+ if (
+ dashboard is None
+ or not dashboard.json_metadata
+ or not dashboard.slices
+ or slice_id not in [slc.id for slc in dashboard.slices]
Review comment:
This is probably preferred as it should short circuit,
```python
or not any([slc for slc in dashboard.slices if slc.id == slice_id])
```
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]