Skip to content

Commit

Permalink
fix(ui): task creation failed on lowcode (#1134)
Browse files Browse the repository at this point in the history
  • Loading branch information
Skraye authored Apr 6, 2023
1 parent c1f985b commit bf6cac2
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
4 changes: 2 additions & 2 deletions ui/src/components/flows/TaskEditor.vue
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
data() {
return {
selectedTaskType: undefined,
taskObject: undefined,
taskObject: {},
isLoading: false,
plugin: undefined,
};
Expand All @@ -89,7 +89,7 @@
},
onTaskTypeSelect() {
this.load();
this.taskObject.type = this.selectedTaskType;
const value = {
type: this.selectedTaskType
};
Expand Down
2 changes: 1 addition & 1 deletion ui/src/components/graph/nodes/Edge.vue
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@
}
// If left node is a flowable task or is not a task, then we insert
// the new task before the right task node
const [taskId, insertPosition] = leftNodeIsTask && !leftNodeIsFlowable ? [props.id.split("|")[0], "after"] : [props.id.split("|")[1], "before"];
const [taskId, insertPosition] = leftNodeIsTask && !leftNodeIsFlowable ? [props.id.split("|")[0], "after"] : [props.data.nextTaskId, "before"];
return {taskId: taskId, taskYaml: taskYaml.value, insertPosition: insertPosition}
}
Expand Down
36 changes: 19 additions & 17 deletions ui/src/utils/yamlUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -225,26 +225,28 @@ export default class YamlUtils {
yaml.visit(yamlDoc, {
Seq(_, seq) {
for (const map of seq.items) {
if (added) {
return yaml.visit.BREAK;
}
if (map.get("id") === taskId) {
const index = seq.items.indexOf(map);
if (insertPosition === "before") {
if (index === 0) {
seq.items.unshift(newTaskNode)
} else {
seq.items.splice(index, 0, newTaskNode)
}
} else {
if (index === seq.items.length - 1) {
seq.items.push(newTaskNode)
if (isMap(map)) {
if (added) {
return yaml.visit.BREAK;
}
if (map.get("id") === taskId) {
const index = seq.items.indexOf(map);
if (insertPosition === "before") {
if (index === 0) {
seq.items.unshift(newTaskNode)
} else {
seq.items.splice(index, 0, newTaskNode)
}
} else {
seq.items.splice(index + 1, 0, newTaskNode)
if (index === seq.items.length - 1) {
seq.items.push(newTaskNode)
} else {
seq.items.splice(index + 1, 0, newTaskNode)
}
}
added = true;
return seq
}
added = true;
return seq
}
}
}
Expand Down

0 comments on commit bf6cac2

Please sign in to comment.