mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-03-10 01:48:18 +00:00
Merge branch 'components-panel' of gitlab.alibaba-inc.com:ali-lowcode/ali-lowcode-engine into components-panel
This commit is contained in:
commit
99df840e50
@ -14,6 +14,14 @@ const Codeout = ({ editor }: PluginProps) => {
|
|||||||
const handleClick = () => {
|
const handleClick = () => {
|
||||||
const designer = editor.get(Designer);
|
const designer = editor.get(Designer);
|
||||||
if (designer) {
|
if (designer) {
|
||||||
|
const assets = editor.get('assets');
|
||||||
|
console.log(assets.components);
|
||||||
|
|
||||||
|
const componentsMap = assets.components.map((c) => ({
|
||||||
|
componentName: c.componentName,
|
||||||
|
...(c.npm || {}),
|
||||||
|
}));
|
||||||
|
|
||||||
const fullSchema = {
|
const fullSchema = {
|
||||||
...designer.schema,
|
...designer.schema,
|
||||||
config: {
|
config: {
|
||||||
@ -23,30 +31,28 @@ const Codeout = ({ editor }: PluginProps) => {
|
|||||||
meta: {
|
meta: {
|
||||||
name: 'demoproject',
|
name: 'demoproject',
|
||||||
},
|
},
|
||||||
|
componentsMap,
|
||||||
};
|
};
|
||||||
|
|
||||||
console.info('codeout schema:', fullSchema);
|
console.info('codeout schema:', fullSchema);
|
||||||
// localStorage.setItem('lce-dev-store', JSON.stringify(designer.schema));
|
// fetch(`http://${CODEOUT_SERVICE_HOST}/api/generate/project`, {
|
||||||
fetch(`http://${CODEOUT_SERVICE_HOST}/api/generate/project`, {
|
// method: 'POST',
|
||||||
method: 'POST',
|
// body: JSON.stringify({ schema: JSON.stringify(fullSchema) }),
|
||||||
body: JSON.stringify({ schema: JSON.stringify(fullSchema) }),
|
// headers: new Headers({
|
||||||
headers: new Headers({
|
// 'Content-Type': 'application/json',
|
||||||
'Content-Type': 'application/json',
|
// }),
|
||||||
}),
|
// mode: 'cors',
|
||||||
mode: 'cors',
|
// }).then((res) => {
|
||||||
}).then((res) => {
|
// const fileStream = streamSaver.createWriteStream('demoProject.zip');
|
||||||
console.log(res);
|
// res.body.pipeTo(fileStream).then(
|
||||||
|
// () => {
|
||||||
const fileStream = streamSaver.createWriteStream('demoProject.zip');
|
// console.log('success');
|
||||||
res.body.pipeTo(fileStream).then(
|
// },
|
||||||
() => {
|
// (err) => {
|
||||||
console.log('success');
|
// console.log(err);
|
||||||
},
|
// },
|
||||||
(err) => {
|
// );
|
||||||
console.log(err);
|
// });
|
||||||
},
|
|
||||||
);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user