Skip to content

Commit dfd26de

Browse files
perf: One click beautification within the loop node
1 parent c114eff commit dfd26de

4 files changed

Lines changed: 26 additions & 7 deletions

File tree

ui/src/workflow/common/NodeControl.vue

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
</el-button>
1010
<el-button
1111
@click="changeCursor(false)"
12-
style="border: none; padding: 4px; height: 24px;margin-left: 8px;"
12+
style="border: none; padding: 4px; height: 24px; margin-left: 8px"
1313
:class="{ 'is-drag-active': !isDrag }"
1414
>
1515
<AppIcon iconName="app-raisehand" :size="16"></AppIcon>
@@ -113,6 +113,12 @@ function fitView() {
113113
}
114114
const layout = () => {
115115
props.lf?.extension.dagre.layout()
116+
console.log(props.lf)
117+
props.lf?.graphModel.nodes.forEach((node: any) => {
118+
if (node.type === 'loop-body-node') {
119+
node?.loopLayout?.()
120+
}
121+
})
116122
}
117123
const retract = () => {
118124
props.lf?.graphModel.nodes.forEach((element: any) => {

ui/src/workflow/index.vue

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,6 @@ const renderGraphData = (data?: any) => {
108108
// 清除当前节点下面的子节点的所有缓存
109109
data.nodeModel.clear_next_node_field(false)
110110
})
111-
// lf.value.openSelectionSelect()
112-
// lf.value.extension.selectionSelect.setSelectionSense(true, false)
113111
setTimeout(() => {
114112
lf.value?.fitView()
115113
}, 500)

ui/src/workflow/nodes/loop-body-node/LoopBodyContainer.vue

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
/>
1717
<h4 class="ellipsis-1 break-all">{{ nodeModel.properties.stepName }}</h4>
1818
</div>
19+
1920
<!-- 放大缩小按钮 -->
2021
<el-button link @click="enlargeHandle">
2122
<AppIcon
@@ -121,6 +122,10 @@ import { WorkflowMode } from '@/enums/application'
121122
122123
provide('workflowMode', WorkflowMode.ApplicationLoop)
123124
125+
const props = defineProps<{
126+
nodeModel: any
127+
}>()
128+
124129
const titleFormRef = ref()
125130
const nodeNameDialogVisible = ref<boolean>(false)
126131
const form = ref<any>({
@@ -176,9 +181,6 @@ const showicon = ref<number | null>(null)
176181
177182
const height = ref<number>(600)
178183
179-
const props = defineProps<{
180-
nodeModel: any
181-
}>()
182184
const nodeFields = computed(() => {
183185
if (props.nodeModel.properties.config.fields) {
184186
const fields = props.nodeModel.properties.config.fields?.map((field: any) => {

ui/src/workflow/nodes/loop-body-node/index.vue

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,14 +156,27 @@ const renderGraphData = (data?: any) => {
156156
}, 500)
157157
}
158158
}
159+
160+
const loopLayout = () => {
161+
lf.value?.extension?.dagre.layout()
162+
}
159163
onMounted(() => {
160164
renderGraphData(cloneDeep(props.nodeModel.properties.workflow))
161165
set(props.nodeModel, 'validate', validate)
162166
set(props.nodeModel, 'set_loop_body', set_loop_body)
167+
set(props.nodeModel, 'loopLayout', loopLayout)
163168
})
164169
onUnmounted(() => {
165170
disconnectByFlow(lf.value.graphModel.flowId)
166171
lf.value = null
167172
})
168173
</script>
169-
<style lang="scss" scoped></style>
174+
<style lang="scss" scoped>
175+
.loop-beautify-button {
176+
position: absolute;
177+
top: 35px;
178+
right: 70px;
179+
border: none;
180+
z-index: 10;
181+
}
182+
</style>

0 commit comments

Comments
 (0)