diff --git a/docker-compose.yml b/docker-compose.yml index 01c45edcfc..6bea31e0cf 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -38,7 +38,9 @@ services: depends_on: db: condition: service_healthy - + # volumes: + # - ./oauth.json/:/usr/src/app/oauth.json + windmill_worker: image: ghcr.io/windmill-labs/windmill:main deploy: @@ -61,7 +63,6 @@ services: # to mount the worker folder to debug,, KEEP_JOB_DIR=true and mount /tmp/windmill volumes: - worker_dependency_cache:/tmp/windmill/cache - # - ./oauth.json/:/usr/src/app/oauth.json lsp: image: ghcr.io/windmill-labs/windmill-lsp:latest diff --git a/frontend/src/lib/components/flows/map/FlowModuleSchemaMap.svelte b/frontend/src/lib/components/flows/map/FlowModuleSchemaMap.svelte index cdb5e35c3c..96ba4f674d 100644 --- a/frontend/src/lib/components/flows/map/FlowModuleSchemaMap.svelte +++ b/frontend/src/lib/components/flows/map/FlowModuleSchemaMap.svelte @@ -147,9 +147,14 @@ function removeBranch(module: FlowModule, index: number) { if (module.value.type === 'branchone' || module.value.type === 'branchall') { - const leaves = dfs(module.value.branches[index].modules, (mod) => mod.id) - leaves.forEach((leafId: string) => deleteFlowStateById(leafId)) - module.value.branches.splice(index, 1) + const offset = module.value.type === 'branchone' ? 1 : 0 + + if (module.value.branches[index - offset]?.modules) { + const leaves = dfs(module.value.branches[index - offset].modules, (mod) => mod.id) + leaves.forEach((leafId: string) => deleteFlowStateById(leafId)) + } + + module.value.branches.splice(index - offset, 1) } } diff --git a/frontend/src/lib/components/graph/FlowGraph.svelte b/frontend/src/lib/components/graph/FlowGraph.svelte index bb5122d20a..c85f25a5f9 100644 --- a/frontend/src/lib/components/graph/FlowGraph.svelte +++ b/frontend/src/lib/components/graph/FlowGraph.svelte @@ -140,10 +140,11 @@ return flowModuleToLoop(modules, module, parent, loopDepth) } else if (type === 'branchone') { const branches = [ - { summary: 'Default branch', modules: module.value.default }, + { summary: 'Default Branch', modules: module.value.default, removable: false }, ...module.value.branches.map((b, i) => ({ summary: defaultIfEmptyString(b.summary, 'Branch ' + (i + 1)), - modules: b.modules + modules: b.modules, + removable: true })) ] return flowModuleToBranch( @@ -158,7 +159,8 @@ } else if (type === 'branchall') { const branches = module.value.branches.map((b, i) => ({ summary: defaultIfEmptyString(b.summary, `Branch ${i + 1}`), - modules: b.modules + modules: b.modules, + removable: true })) return flowModuleToBranch(module, modules, branches, [], parent, loopDepth, true) } @@ -345,7 +347,7 @@ function flowModuleToBranch( module: FlowModule, modules: FlowModule[], - branches: { summary: string; modules: FlowModule[] }[], + branches: { summary: string; modules: FlowModule[]; removable: boolean }[], edgesLabel: string[], parent: string | NestedNodes | undefined = undefined, loopDepth: number, @@ -380,7 +382,7 @@ ]) } - branches.forEach(({ summary, modules }, i) => { + branches.forEach(({ summary, modules, removable }, i) => { const items: NestedNodes = [] items.push( createVirtualNode( @@ -393,7 +395,7 @@ loopDepth, 0, false, - { module, index: i } + removable ? { module, index: i } : undefined ) ) if (modules.length) { @@ -454,11 +456,19 @@ const stratify = dagStratify().id(({ id }: Node) => id) const dag = stratify(nodes) - const layout = sugiyama() - .decross(decrossOpt().large('medium')) - .coord(coordCenter()) - .nodeSize(() => [NODE.width + NODE.gap.horizontal, NODE.height + NODE.gap.vertical]) - const boxSize = layout(dag) + let boxSize: any + try { + const layout = sugiyama() + .decross(decrossOpt()) + .coord(coordCenter()) + .nodeSize(() => [NODE.width + NODE.gap.horizontal, NODE.height + NODE.gap.vertical]) + boxSize = layout(dag) + } catch { + const layout = sugiyama() + .coord(coordCenter()) + .nodeSize(() => [NODE.width + NODE.gap.horizontal, NODE.height + NODE.gap.vertical]) + boxSize = layout(dag) + } return { nodes: dag.descendants().map((des) => ({ ...des.data,