temporary sync fix

This commit is contained in:
Guilhem
2024-10-16 08:25:58 +02:00
parent c8554c030f
commit 5e9ccdde82
3 changed files with 25 additions and 17 deletions
@@ -45,12 +45,14 @@ export async function pickScript(
path: string,
summary: string,
id: string,
hash?: string
hash?: string,
kind?: string
): Promise<[FlowModule & { value: PathScript }, FlowModuleState]> {
const flowModule: FlowModule & { value: PathScript } = {
id,
value: { type: 'script', path, hash, input_transforms: {} },
summary
summary,
isTrigger: kind === 'trigger'
}
return [flowModule, await loadFlowModuleState(flowModule)]
@@ -74,10 +74,17 @@
push(history, $flowStore)
var module = emptyModule($flowStateStore, $flowStore, kind == 'flow')
var state = emptyFlowModuleState()
$flowStateStore[module.id] = state
if (wsFlow) {
;[module, state] = await pickFlow(wsFlow.path, wsFlow.summary, module.id)
} else if (wsScript) {
;[module, state] = await pickScript(wsScript.path, wsScript.summary, module.id, wsScript.hash)
;[module, state] = await pickScript(
wsScript.path,
wsScript.summary,
module.id,
wsScript.hash,
kind
)
} else if (kind == 'forloop') {
;[module, state] = await createLoop(
module.id,
@@ -89,18 +96,7 @@
;[module, state] = await createBranches(module.id)
} else if (kind == 'branchall') {
;[module, state] = await createBranchAll(module.id)
}
$flowStateStore[module.id] = state
if (kind == 'trigger') {
module.summary = 'Trigger'
} else if (kind == 'approval') {
module.summary = 'Approval'
} else if (kind == 'end') {
module.summary = 'Terminate flow'
module.stop_after_if = { skip_if_stopped: false, expr: 'true' }
}
if (inlineScript) {
console.log('inlineScript', inlineScript)
} else if (inlineScript) {
const { language, kind, subkind } = inlineScript
;[module, state] = await createInlineScriptModule(
language,
@@ -109,8 +105,18 @@
module.id,
module.summary
)
$flowStateStore[module.id] = state
}
$flowStateStore[module.id] = state
if (kind == 'trigger') {
module.summary = 'Trigger'
} else if (kind == 'approval') {
module.summary = 'Approval'
} else if (kind == 'end') {
module.summary = 'Terminate flow'
module.stop_after_if = { skip_if_stopped: false, expr: 'true' }
}
if (!modules) return [module]
modules.splice(index, 0, module)
return modules
@@ -3,7 +3,6 @@
import TriggersWrapper from '../triggers/TriggersWrapper.svelte'
import type { GraphEventHandlers } from '../../graphBuilder'
import type { FlowModule } from '$lib/gen'
export let data: {
path: string
openSchedules: () => void
@@ -42,6 +41,7 @@
data?.eventHandlers.insert({
modules: data.modules,
index: 0,
kind: 'trigger',
script: e.detail
})
data?.eventHandlers.insert({