未验证 提交 2531c222 编写于 作者: J Jiajie Zhong 提交者: GitHub

[Fix] Also auto formatter workflow instance if location is null (#12080)

* [fix] Also auto formatter workflow instance if location is null

In #11535(096fae77) and #11681(4dca488c), we already formatter
workflow definition, but I find out we forget formatter workflow
instance with definition's location is null, this patch also
formatter workflow instance.

* remove console log
上级 6eb1eb72
...@@ -33,6 +33,7 @@ import { ...@@ -33,6 +33,7 @@ import {
Location Location
} from '../../components/dag/types' } from '../../components/dag/types'
import Styles from './index.module.scss' import Styles from './index.module.scss'
import { useGraphAutoLayout } from '../../components/dag/use-graph-auto-layout'
interface SaveData { interface SaveData {
saveForm: SaveForm saveForm: SaveForm
...@@ -53,10 +54,18 @@ export default defineComponent({ ...@@ -53,10 +54,18 @@ export default defineComponent({
const definition = ref<WorkflowDefinition>() const definition = ref<WorkflowDefinition>()
const instance = ref<WorkflowInstance>() const instance = ref<WorkflowInstance>()
const dagInstanceRef = ref()
const refresh = () => { const refresh = () => {
queryProcessInstanceById(id, projectCode).then((res: any) => { queryProcessInstanceById(id, projectCode).then((res: any) => {
instance.value = res instance.value = res
if (!res.dagData.processDefinition.locations) {
setTimeout(() => {
const graph = dagInstanceRef.value
const { submit } = useGraphAutoLayout({ graph })
submit()
}, 1000)
}
if (res.dagData) { if (res.dagData) {
definition.value = res.dagData definition.value = res.dagData
} }
...@@ -109,6 +118,7 @@ export default defineComponent({ ...@@ -109,6 +118,7 @@ export default defineComponent({
]} ]}
> >
<Dag <Dag
ref={dagInstanceRef}
instance={instance.value} instance={instance.value}
definition={definition.value} definition={definition.value}
onRefresh={refresh} onRefresh={refresh}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册