Initial commit
This commit is contained in:
@@ -8,22 +8,22 @@
|
||||
*/
|
||||
|
||||
import type { NodeTemplate } from '../types';
|
||||
import type { GraphTaskElement, TaskNodeRect } from '../builder/element';
|
||||
import type { GraphTaskElement, GraphTaskRect } from '../builder/element';
|
||||
import { generateKey } from '@/utils/strings';
|
||||
|
||||
export const createGraphTaskElementFromTemplate = (
|
||||
template: NodeTemplate,
|
||||
rect?: TaskNodeRect,
|
||||
rect?: GraphTaskRect,
|
||||
): GraphTaskElement => {
|
||||
let realRect = { width: 200, height: 100, x: 0, y: 0, ...rect || {} }
|
||||
console.info('rect',rect)
|
||||
return {
|
||||
id: 0,
|
||||
key: generateKey(template.type),
|
||||
status: null,
|
||||
type: 'task',
|
||||
template: template.id,
|
||||
type: template.type,
|
||||
name: template.name,
|
||||
category: template.type,
|
||||
description: template.description,
|
||||
position: {
|
||||
x: realRect.x ?? 0,
|
||||
@@ -31,10 +31,9 @@ export const createGraphTaskElementFromTemplate = (
|
||||
},
|
||||
width: realRect.width,
|
||||
height: realRect.height,
|
||||
// settings: JSON.parse(JSON.stringify(template.parameter_defs ?? [])),
|
||||
inputs: null,
|
||||
outputs: null,
|
||||
parameters: {},
|
||||
parameters: [],
|
||||
variables: [
|
||||
{
|
||||
key: generateKey('var_'),
|
||||
|
||||
Reference in New Issue
Block a user