UPDATE: VERSION-20260315
This commit is contained in:
@@ -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,
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user