From a4b8626277bdd673652e11853f54ca4297b83519 Mon Sep 17 00:00:00 2001 From: Joshua Li Date: Fri, 14 May 2021 12:29:31 -0700 Subject: [PATCH] Remove visualization editor in visualization reports Signed-off-by: Joshua Li --- .../utils/visual_report/visualReportHelper.ts | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/dashboards-reports/server/routes/utils/visual_report/visualReportHelper.ts b/dashboards-reports/server/routes/utils/visual_report/visualReportHelper.ts index 5e30dc80..4177b807 100644 --- a/dashboards-reports/server/routes/utils/visual_report/visualReportHelper.ts +++ b/dashboards-reports/server/routes/utils/visual_report/visualReportHelper.ts @@ -140,10 +140,10 @@ export const createVisualReport = async ( }); let buffer: Buffer; - // remove top nav bar + // remove unwanted elements await page.evaluate( /* istanbul ignore next */ - () => { + (reportSource, REPORT_TYPE) => { // remove buttons document .querySelectorAll("[class^='euiButton']") @@ -152,8 +152,17 @@ export const createVisualReport = async ( document .querySelectorAll("[class^='euiHeader']") .forEach((e) => e.remove()); + // remove visualization editor + if (reportSource === REPORT_TYPE.visualization) { + document + .querySelector('[data-test-subj="splitPanelResizer"]') + ?.remove(); + document.querySelector('.visEditor__collapsibleSidebar')?.remove(); + } document.body.style.paddingTop = '0px'; - } + }, + reportSource, + REPORT_TYPE ); // force wait for any resize to load after the above DOM modification await page.waitFor(1000);