From 4cb79e50172cc857d73dc3ba76f9f2063d97d762 Mon Sep 17 00:00:00 2001 From: "Hugh A. Miles II" Date: Mon, 2 Aug 2021 16:37:34 -0400 Subject: [PATCH] fix: Fix long dashboards screenshot emails (#15954) * create serialize json function * create new setting for reports * cleanup * address comments * up the attributes --- .pylintrc | 2 +- .../DashboardBuilder/DashboardBuilder.tsx | 9 +++++---- superset-frontend/src/dashboard/util/constants.ts | 1 + superset/utils/webdriver.py | 14 ++++++++++++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/.pylintrc b/.pylintrc index 837291c5b6da0..b624dfbc5aaed 100644 --- a/.pylintrc +++ b/.pylintrc @@ -382,7 +382,7 @@ max-statements=50 max-parents=7 # Maximum number of attributes for a class (see R0902). -max-attributes=7 +max-attributes=8 # Minimum number of public methods for a class (see R0903). min-public-methods=2 diff --git a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx index 614ceb47cc33c..cc897b8df5740 100644 --- a/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx +++ b/superset-frontend/src/dashboard/components/DashboardBuilder/DashboardBuilder.tsx @@ -181,9 +181,10 @@ const DashboardBuilder: FC = () => { rootChildId !== DASHBOARD_GRID_ID ? dashboardLayout[rootChildId] : undefined; - const isStandalone = getUrlParam(URL_PARAMS.standalone); + const StandaloneMode = getUrlParam(URL_PARAMS.standalone); + const isReport = StandaloneMode === DashboardStandaloneMode.REPORT; const hideDashboardHeader = - isStandalone === DashboardStandaloneMode.HIDE_NAV_AND_TITLE; + StandaloneMode === DashboardStandaloneMode.HIDE_NAV_AND_TITLE || isReport; const barTopOffset = (hideDashboardHeader ? 0 : HEADER_HEIGHT) + @@ -210,7 +211,7 @@ const DashboardBuilder: FC = () => { const offset = FILTER_BAR_HEADER_HEIGHT + - (isSticky || isStandalone ? 0 : MAIN_HEADER_HEIGHT) + + (isSticky || StandaloneMode ? 0 : MAIN_HEADER_HEIGHT) + (filterSetEnabled ? FILTER_BAR_TABS_HEIGHT : 0); const filterBarHeight = `calc(100vh - ${offset}px)`; @@ -255,7 +256,7 @@ const DashboardBuilder: FC = () => {
{!hideDashboardHeader && } {dropIndicatorProps &&
} - {topLevelTabs && ( + {!isReport && topLevelTabs && ( Optional[bytes]: + from requests.models import PreparedRequest + + params = {"standalone": DashboardStandaloneMode.REPORT.value} + req = PreparedRequest() + req.prepare_url(url, params) + url = req.url or "" + driver = self.auth(user) driver.set_window_size(*self._window) driver.get(url)