UPDATE: VERSION-20260315

This commit is contained in:
libertyspy
2026-03-15 20:20:56 +08:00
parent f2e81c6e5c
commit b97837ec6a
8 changed files with 112 additions and 164 deletions

View File

@@ -21,9 +21,12 @@ export const createGraphTaskElementFromScenario = (
id: 0,
key: generateKey(),
type: 'scenario',
template: platform.id,
name: platform.name,
platformId: platform.id,
scenarioId: platform.scenarioId,
components: platform.components ?? [],
template: 0,
templateType: null,
name: null,
category: null,
group: null,
description: platform.description,
@@ -40,3 +43,37 @@ export const createGraphTaskElementFromScenario = (
variables: [],
} as GraphTaskElement;
};
export const createGraphScenarioElement = (element: GraphTaskElement): any => {
let realHeight = 120;
let width: number = 250;
if (!realHeight) {
realHeight = 120;
}
if(element?.components){
if(element?.components?.length > 2){
realHeight = 90 + element?.components?.length * 25
} else if(element?.components?.length <=1){
realHeight = 120
}
}
return {
shape: 'scenario',
id: element.key,
position: {
x: element.position?.x || 0,
y: element.position?.y || 0,
},
size: {
width: width,
height: realHeight,
},
attrs: {
label: {
text: element.name,
},
},
data: element,
};
};