mirror of
https://github.com/DeNNiiInc/dbgate.git
synced 2026-04-19 15:25:59 +00:00
export diagram to HTML
This commit is contained in:
@@ -6,6 +6,7 @@ const getChartExport = require('../utility/getChartExport');
|
||||
const hasPermission = require('../utility/hasPermission');
|
||||
const socket = require('../utility/socket');
|
||||
const scheduler = require('./scheduler');
|
||||
const getDiagramExport = require('../utility/getDiagramExport');
|
||||
|
||||
function serialize(format, data) {
|
||||
if (format == 'text') return data;
|
||||
@@ -152,4 +153,10 @@ module.exports = {
|
||||
}
|
||||
return true;
|
||||
},
|
||||
|
||||
exportDiagram_meta: true,
|
||||
async exportDiagram({ filePath, html, css }) {
|
||||
await fs.writeFile(filePath, getDiagramExport(html, css));
|
||||
return true;
|
||||
},
|
||||
};
|
||||
|
||||
21
packages/api/src/utility/getDiagramExport.js
Normal file
21
packages/api/src/utility/getDiagramExport.js
Normal file
@@ -0,0 +1,21 @@
|
||||
const getDiagramExport = (html,css) => {
|
||||
return `<html>
|
||||
<meta charset='utf-8'>
|
||||
|
||||
<head>
|
||||
<style>
|
||||
${css}
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href='https://cdn.jsdelivr.net/npm/@mdi/font@6.5.95/css/materialdesignicons.css' />
|
||||
</head>
|
||||
|
||||
<body class='theme-light'>
|
||||
${html}
|
||||
</body>
|
||||
|
||||
</html>`;
|
||||
};
|
||||
|
||||
module.exports = getDiagramExport;
|
||||
|
||||
Reference in New Issue
Block a user