feat(frontend): merge main

This commit is contained in:
Faton Ramadani
2023-03-06 13:59:08 +01:00
3 changed files with 32 additions and 16 deletions
+3 -2
View File
@@ -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
@@ -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)
}
}
</script>
@@ -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,