Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
Metabase
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Engineering Digital Service
Metabase
Commits
8fe94af9
Unverified
Commit
8fe94af9
authored
11 months ago
by
Aleksandr Lesnenko
Committed by
GitHub
11 months ago
Browse files
Options
Downloads
Patches
Plain Diff
asynchronously load libraries for png and pdf exports (#41036)
parent
f7b7bda7
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
frontend/src/metabase/visualizations/lib/save-chart-image.ts
+1
-1
1 addition, 1 deletion
frontend/src/metabase/visualizations/lib/save-chart-image.ts
frontend/src/metabase/visualizations/lib/save-dashboard-pdf.ts
+2
-3
2 additions, 3 deletions
...end/src/metabase/visualizations/lib/save-dashboard-pdf.ts
with
3 additions
and
4 deletions
frontend/src/metabase/visualizations/lib/save-chart-image.ts
+
1
−
1
View file @
8fe94af9
import
{
css
}
from
"
@emotion/react
"
;
import
html2canvas
from
"
html2canvas
"
;
export
const
SAVING_DOM_IMAGE_CLASS
=
"
saving-dom-image
"
;
export
const
SAVING_DOM_IMAGE_HIDDEN_CLASS
=
"
saving-dom-image-hidden
"
;
...
...
@@ -22,6 +21,7 @@ export const saveChartImage = async (selector: string, fileName: string) => {
node
.
classList
.
add
(
SAVING_DOM_IMAGE_CLASS
);
const
{
default
:
html2canvas
}
=
await
import
(
"
html2canvas
"
);
const
canvas
=
await
html2canvas
(
node
,
{
useCORS
:
true
,
});
...
...
This diff is collapsed.
Click to expand it.
frontend/src/metabase/visualizations/lib/save-dashboard-pdf.ts
+
2
−
3
View file @
8fe94af9
import
html2canvas
from
"
html2canvas
"
;
import
jspdf
from
"
jspdf
"
;
import
{
color
}
from
"
metabase/lib/colors
"
;
import
{
SAVING_DOM_IMAGE_CLASS
}
from
"
./save-chart-image
"
;
...
...
@@ -17,6 +14,7 @@ export const saveDashboardPdf = async (
return
;
}
const
{
default
:
html2canvas
}
=
await
import
(
"
html2canvas
"
);
const
image
=
await
html2canvas
(
node
,
{
useCORS
:
true
,
onclone
:
(
doc
:
Document
,
node
:
HTMLElement
)
=>
{
...
...
@@ -35,6 +33,7 @@ export const saveDashboardPdf = async (
const
pdfWidth
=
imageWidth
;
const
pdfHeight
=
imageHeight
+
80
;
const
{
default
:
jspdf
}
=
await
import
(
"
jspdf
"
);
const
pdf
=
new
jspdf
({
unit
:
"
px
"
,
hotfixes
:
[
"
px_scaling
"
],
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment