You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@superset.apache.org by be...@apache.org on 2025/01/30 21:58:49 UTC
(superset) branch enforce-max-screenshot-width created (now b41f330d00)
This is an automated email from the ASF dual-hosted git repository.
beto pushed a change to branch enforce-max-screenshot-width
in repository https://gitbox.apache.org/repos/asf/superset.git
at b41f330d00 fix: enforce ALERT_REPORTS_MAX_CUSTOM_SCREENSHOT_WIDTH
This branch includes the following new commits:
new b41f330d00 fix: enforce ALERT_REPORTS_MAX_CUSTOM_SCREENSHOT_WIDTH
The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails. The revisions
listed as "add" were already present in the repository and have only
been added to this reference.
(superset) 01/01: fix: enforce ALERT_REPORTS_MAX_CUSTOM_SCREENSHOT_WIDTH
Posted by be...@apache.org.
This is an automated email from the ASF dual-hosted git repository.
beto pushed a commit to branch enforce-max-screenshot-width
in repository https://gitbox.apache.org/repos/asf/superset.git
commit b41f330d001a905974048026236d42e87c6b9145
Author: Beto Dealmeida <ro...@dealmeida.net>
AuthorDate: Thu Jan 30 16:58:36 2025 -0500
fix: enforce ALERT_REPORTS_MAX_CUSTOM_SCREENSHOT_WIDTH
---
superset/commands/report/execute.py | 26 +++++++++++++++-----------
1 file changed, 15 insertions(+), 11 deletions(-)
diff --git a/superset/commands/report/execute.py b/superset/commands/report/execute.py
index 9e69258650..0c57d55bb5 100644
--- a/superset/commands/report/execute.py
+++ b/superset/commands/report/execute.py
@@ -300,13 +300,16 @@ class BaseReportState:
)
user = security_manager.find_user(username)
+ max_width = app.config["ALERT_REPORTS_MAX_CUSTOM_SCREENSHOT_WIDTH"]
+
if self._report_schedule.chart:
url = self._get_url()
+
window_width, window_height = app.config["WEBDRIVER_WINDOW"]["slice"]
- window_size = (
- self._report_schedule.custom_width or window_width,
- self._report_schedule.custom_height or window_height,
- )
+ width = min(max_width, self._report_schedule.custom_width or window_width)
+ height = self._report_schedule.custom_height or window_height
+ window_size = (width, height)
+
screenshots: list[Union[ChartScreenshot, DashboardScreenshot]] = [
ChartScreenshot(
url,
@@ -317,11 +320,12 @@ class BaseReportState:
]
else:
urls = self.get_dashboard_urls()
+
window_width, window_height = app.config["WEBDRIVER_WINDOW"]["dashboard"]
- window_size = (
- self._report_schedule.custom_width or window_width,
- self._report_schedule.custom_height or window_height,
- )
+ width = min(max_width, self._report_schedule.custom_width or window_width)
+ height = self._report_schedule.custom_height or window_height
+ window_size = (width, height)
+
screenshots = [
DashboardScreenshot(
url,
@@ -578,9 +582,9 @@ class BaseReportState:
SupersetError(
message=ex.message,
error_type=SupersetErrorType.REPORT_NOTIFICATION_ERROR,
- level=ErrorLevel.ERROR
- if ex.status >= 500
- else ErrorLevel.WARNING,
+ level=(
+ ErrorLevel.ERROR if ex.status >= 500 else ErrorLevel.WARNING
+ ),
)
)
if notification_errors: