未验证 提交 096fae77 编写于 作者: L labbomb 提交者: GitHub

feat: Locations Formats the layout if it does not exist (#11535)

上级 87898957
......@@ -89,6 +89,7 @@ export default defineComponent({
const graph = ref<Graph>()
provide('graph', graph)
context.expose(graph)
// Auto layout modal
const {
......
......@@ -80,7 +80,7 @@ export function useGraphAutoLayout(options: Options) {
* @returns
*/
function format(layoutConfig: LayoutConfig) {
if (!layoutConfig) {
if (Object.keys(layoutConfig).length === 0) {
layoutConfig = DEFAULT_LAYOUT_CONFIG
}
const graph = graphRef?.value
......
......@@ -33,6 +33,7 @@ import {
Location
} from '../../components/dag/types'
import Styles from './index.module.scss'
import { useGraphAutoLayout } from '../../components/dag/use-graph-auto-layout'
interface SaveData {
saveForm: SaveForm
......@@ -55,6 +56,7 @@ export default defineComponent({
const definition = ref<WorkflowDefinition>()
const readonly = ref(false)
const isLoading = ref(true)
const dagRef = ref()
const refresh = () => {
isLoading.value = true
......@@ -62,6 +64,13 @@ export default defineComponent({
readonly.value = res.processDefinition.releaseState === 'ONLINE'
definition.value = res
isLoading.value = false
if (!res.processDefinition.locations) {
setTimeout(() => {
const graph = dagRef.value
const { submit } = useGraphAutoLayout({ graph })
submit()
}, 1000)
}
})
}
......@@ -115,6 +124,7 @@ export default defineComponent({
>
{!isLoading.value && (
<Dag
ref={dagRef}
definition={definition.value}
onRefresh={refresh}
projectCode={projectCode}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册