Skip to content

Commit

Permalink
Fix type, downDload download
Browse files Browse the repository at this point in the history
REF: ZFE-78663

Update and simplify Loading screen
when we download the PDF

REF: ZFE-78663
Small update to increase by 3 seconds the time to load the screen.
  • Loading branch information
rguerraZero committed Nov 2, 2023
1 parent 0c37843 commit 79de56a
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
18 changes: 9 additions & 9 deletions superset-frontend/src/components/Loading/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ export type PositionOption =
| 'floating'
| 'inline'
| 'inline-centered'
| 'normal';
| 'normal'
| 'absolute';
export interface Props {
position?: PositionOption;
className?: string;
Expand Down Expand Up @@ -59,17 +60,16 @@ const LoaderImg = styled.img`
transform: translate(-50%, -50%);
}
&.download-pdf {
display: block !important;
top: 35vh;
top: 0px;
right: 0px;
bottom: 0px;
background: #f7f7f7;
padding-top: 48vh;
padding-bottom: 48vh;
padding-left: 48vw;
padding-right: 48vw;
margin: 15vh 0px 0px 0px;
width: 100%;
padding: 48vh 48vw;
width: 100vw;
visibility: hidden;
height: 100vh;
position: absolute;
margin: 0px;
}
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ const DashboardBuilder: FC<DashboardBuilderProps> = () => {
<FilterBar orientation={FilterBarOrientation.HORIZONTAL} />
)}
{dropIndicatorProps && <div {...dropIndicatorProps} />}
<Loading extraClass="download-pdf" />
<Loading extraClass="download-pdf" position="absolute" />
{!isReport && topLevelTabs && !uiConfig.hideNav && (
<WithPopoverMenu
shouldFocus={shouldFocusTabs}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ const MENU_KEYS = {
EDIT_PROPERTIES: 'edit-properties',
EDIT_CSS: 'edit-css',
DOWNLOAD_AS_IMAGE: 'download-as-image',
DOWNDLOAD_AS_PDF: 'download-as-pdf',
DOWNLOAD_AS_PDF: 'download-as-pdf',
TOGGLE_FULLSCREEN: 'toggle-fullscreen',
MANAGE_EMBEDDED: 'manage-embedded',
MANAGE_EMAIL_REPORT: 'manage-email-report',
Expand Down Expand Up @@ -195,7 +195,7 @@ class HeaderActionsDropdown extends React.PureComponent {
this.props.logEvent?.(LOG_ACTIONS_DASHBOARD_DOWNLOAD_AS_IMAGE);
break;
}
case MENU_KEYS.DOWNDLOAD_AS_PDF: {
case MENU_KEYS.DOWNLOAD_AS_PDF: {
// menu closes with a delay, we need to hide it manually,
// so that we don't capture it on the screenshot
const menu = document.querySelector(
Expand Down Expand Up @@ -357,7 +357,7 @@ class HeaderActionsDropdown extends React.PureComponent {
)}
{!editMode && (
<Menu.Item
key={MENU_KEYS.DOWNDLOAD_AS_PDF}
key={MENU_KEYS.DOWNLOAD_AS_PDF}
onClick={this.handleMenuClick}
>
{t('Download as pdf')}
Expand Down
2 changes: 1 addition & 1 deletion superset-frontend/src/logger/LogUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export const LOG_ACTIONS_CONFIRM_OVERWRITE_DASHBOARD_METADATA =
export const LOG_ACTIONS_DASHBOARD_DOWNLOAD_AS_IMAGE =
'dashboard_download_as_image';
export const LOG_ACTIONS_DASHBOARD_DOWNLOAD_AS_PDF =
'dashboard_downdload_as_pdf';
'dashboard_download_as_pdf';
export const LOG_ACTIONS_CHART_DOWNLOAD_AS_IMAGE = 'chart_download_as_image';
export const LOG_ACTIONS_SQLLAB_WARN_LOCAL_STORAGE_USAGE =
'sqllab_warn_local_storage_usage';
Expand Down
4 changes: 2 additions & 2 deletions superset-frontend/src/utils/downloadAsPDF.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,13 +79,13 @@ export default function downloadAsPDF(
setTimeout(() => {
tabsElements[index].click();
resolve('done');
}, 2000 * index);
}, 5000 * index);
});
const waitToScreenshotPromise = new Promise(function (resolve) {
setTimeout(() => {
tabsElements[index].click();
resolve('done');
}, 2000 * index + 1000);
}, 5000 * index + 1000);
});
promises.push(
clickTabPromise
Expand Down

0 comments on commit 79de56a

Please sign in to comment.