You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by dp...@apache.org on 2021/03/02 10:50:12 UTC
[superset] branch master updated: fix(alerts&reports): Alerts &
Reports will use values from WEBDRIVER_WINDOW option (#13157)
This is an automated email from the ASF dual-hosted git repository.
dpgaspar pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/superset.git
The following commit(s) were added to refs/heads/master by this push:
new b04aebf fix(alerts&reports): Alerts & Reports will use values from WEBDRIVER_WINDOW option (#13157)
b04aebf is described below
commit b04aebfa99be2815f5e9d9adeaf63f0b1b8ee17f
Author: İbrahim Ercan <ib...@gmail.com>
AuthorDate: Tue Mar 2 13:49:22 2021 +0300
fix(alerts&reports): Alerts & Reports will use values from WEBDRIVER_WINDOW option (#13157)
* fix: thumbnails and reports will be use WEBDRIVER_WINDOW option
* changes reformatted
* config change reverted. thumbnails sizes changed to original
* typo fix
* bugfix
defining defaults in thumbnails.py caused thumbnail caches invalidated.
they moved to init.
Co-authored-by: Ibrahim Ercan <ib...@vlmedia.com.tr>
---
superset/reports/commands/execute.py | 12 ++++++++++--
superset/utils/screenshots.py | 26 ++++++++++++++++++++++----
2 files changed, 32 insertions(+), 6 deletions(-)
diff --git a/superset/reports/commands/execute.py b/superset/reports/commands/execute.py
index 774f2c8..cf226ec 100644
--- a/superset/reports/commands/execute.py
+++ b/superset/reports/commands/execute.py
@@ -156,11 +156,19 @@ class BaseReportState:
screenshot: Optional[BaseScreenshot] = None
if self._report_schedule.chart:
url = self._get_url(standalone="true")
- screenshot = ChartScreenshot(url, self._report_schedule.chart.digest)
+ screenshot = ChartScreenshot(
+ url,
+ self._report_schedule.chart.digest,
+ window_size=app.config["WEBDRIVER_WINDOW"]["slice"],
+ thumb_size=app.config["WEBDRIVER_WINDOW"]["slice"],
+ )
else:
url = self._get_url()
screenshot = DashboardScreenshot(
- url, self._report_schedule.dashboard.digest
+ url,
+ self._report_schedule.dashboard.digest,
+ window_size=app.config["WEBDRIVER_WINDOW"]["dashboard"],
+ thumb_size=app.config["WEBDRIVER_WINDOW"]["dashboard"],
)
image_url = self._get_url(user_friendly=True)
user = self._get_screenshot_user()
diff --git a/superset/utils/screenshots.py b/superset/utils/screenshots.py
index 2604361..73e0c8c 100644
--- a/superset/utils/screenshots.py
+++ b/superset/utils/screenshots.py
@@ -195,12 +195,30 @@ class BaseScreenshot:
class ChartScreenshot(BaseScreenshot):
thumbnail_type: str = "chart"
element: str = "chart-container"
- window_size: WindowSize = (800, 600)
- thumb_size: WindowSize = (800, 600)
+
+ def __init__(
+ self,
+ url: str,
+ digest: str,
+ window_size: Optional[WindowSize] = None,
+ thumb_size: Optional[WindowSize] = None,
+ ):
+ super().__init__(url, digest)
+ self.window_size = window_size or (800, 600)
+ self.thumb_size = thumb_size or (800, 600)
class DashboardScreenshot(BaseScreenshot):
thumbnail_type: str = "dashboard"
element: str = "grid-container"
- window_size: WindowSize = (1600, int(1600 * 0.75))
- thumb_size: WindowSize = (800, int(800 * 0.75))
+
+ def __init__(
+ self,
+ url: str,
+ digest: str,
+ window_size: Optional[WindowSize] = None,
+ thumb_size: Optional[WindowSize] = None,
+ ):
+ super().__init__(url, digest)
+ self.window_size = window_size or (1600, 1200)
+ self.thumb_size = thumb_size or (800, 600)