mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-27 18:26:00 +00:00
fix
This commit is contained in:
@@ -129,7 +129,7 @@ module.exports = {
|
|||||||
exportChart_meta: 'post',
|
exportChart_meta: 'post',
|
||||||
async exportChart({ filePath, title, config, image }) {
|
async exportChart({ filePath, title, config, image }) {
|
||||||
const fileName = path.parse(filePath).base;
|
const fileName = path.parse(filePath).base;
|
||||||
const imageFile = `${fileName}.png`;
|
const imageFile = fileName.replace('.html', '-preview.png');
|
||||||
const html = getChartExport(title, config, imageFile);
|
const html = getChartExport(title, config, imageFile);
|
||||||
await fs.writeFile(filePath, html);
|
await fs.writeFile(filePath, html);
|
||||||
if (image) {
|
if (image) {
|
||||||
@@ -137,7 +137,7 @@ module.exports = {
|
|||||||
if (index > 0) {
|
if (index > 0) {
|
||||||
const data = image.substr(index + 'base64,'.length);
|
const data = image.substr(index + 'base64,'.length);
|
||||||
const buf = Buffer.from(data, 'base64');
|
const buf = Buffer.from(data, 'base64');
|
||||||
await fs.writeFile(filePath + '.png', buf);
|
await fs.writeFile(filePath.replace('.html', '-preview.png'), buf);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
|
|||||||
@@ -34,8 +34,6 @@ const getChartExport = (title, config, imageFile) => {
|
|||||||
</script>
|
</script>
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
</html>
|
|
||||||
|
|
||||||
<body onload="showChart()">
|
<body onload="showChart()">
|
||||||
<img src="${imageFile}" id="myImage" />
|
<img src="${imageFile}" id="myImage" />
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user