craig-rueda commented on a change in pull request #8947: [thumbnails]
thumbnails for dashboards and charts
URL:
https://github.com/apache/incubator-superset/pull/8947#discussion_r405159406
##########
File path: superset/models/dashboard.py
##########
@@ -184,6 +185,22 @@ def dashboard_link(self) -> Markup:
title = escape(self.dashboard_title or "<empty>")
return Markup(f'<a href="{self.url}">{title}</a>')
+ @property
+ def digest(self) -> str:
+ """
+ Returns a MD5 HEX digest that makes this dashboard unique
+ """
+ unique_string = f"{self.position_json}.{self.css}.{self.json_metadata}"
+ return utils.md5_hex(unique_string)
+
+ @property
+ def thumbnail_url(self) -> str:
+ """
+ Returns a thumbnail URL with a HEX digest. We want to avoid
browser cache
+ if the dashboard has changed
+ """
+ return f"/api/v1/dashboard/{self.id}/thumbnail/{self.digest}/"
Review comment:
I agree, is there a way to shape responses via Marshmallow?
----------------------------------------------------------------
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]