{
+ const { path, summary, kind, hash } = detail
+ const [module, state] = await pickScript(path, summary, flowModule.id, hash)
- if (kind == Script.kind.APPROVAL) {
- module.suspend = { required_events: 1, timeout: 1800 }
+ if (kind == Script.kind.APPROVAL) {
+ module.suspend = { required_events: 1, timeout: 1800 }
+ }
+
+ if (kind == Script.kind.TRIGGER) {
+ if (!$schedule.cron) {
+ $schedule.cron = '0 */15 * * *'
}
+ $schedule.enabled = true
- if (kind == Script.kind.TRIGGER) {
- if (!$schedule.cron) {
- $schedule.cron = '0 */15 * * *'
- }
- $schedule.enabled = true
-
- module.stop_after_if = {
- expr: 'result == undefined || Array.isArray(result) && result.length == 0',
- skip_if_stopped: true
- }
+ module.stop_after_if = {
+ expr: 'result == undefined || Array.isArray(result) && result.length == 0',
+ skip_if_stopped: true
}
+ }
- flowModule = module
- $flowStateStore[module.id] = state
- }}
- on:new={async ({ detail }) => {
- const { language, kind, subkind } = detail
+ flowModule = module
+ $flowStateStore[module.id] = state
+ }}
+ on:new={async ({ detail }) => {
+ const { language, kind, subkind } = detail
- const [module, state] = await createInlineScriptModule(
- language,
- kind,
- subkind,
- flowModule.id
- )
+ const [module, state] = await createInlineScriptModule(
+ language,
+ kind,
+ subkind,
+ flowModule.id
+ )
- if (kind == Script.kind.TRIGGER) {
- if (!$schedule.cron) {
- $schedule.cron = '0 */15 * * *'
- }
- $schedule.enabled = true
-
- module.stop_after_if = {
- expr: 'result == undefined || Array.isArray(result) && result.length == 0',
- skip_if_stopped: true
- }
+ if (kind == Script.kind.TRIGGER) {
+ if (!$schedule.cron) {
+ $schedule.cron = '0 */15 * * *'
}
+ $schedule.enabled = true
- if (kind == Script.kind.APPROVAL) {
- module.suspend = { required_events: 1, timeout: 1800 }
+ module.stop_after_if = {
+ expr: 'result == undefined || Array.isArray(result) && result.length == 0',
+ skip_if_stopped: true
}
+ }
- flowModule = module
- $flowStateStore[module.id] = state
- }}
- failureModule={$selectedId === 'failure'}
- />
- {/if}
- {:else if flowModule.value.type === 'rawscript' || flowModule.value.type === 'script' || flowModule.value.type === 'flow'}
-
{/if}
- {:else if flowModule.value.type === 'forloopflow'}
- {#each flowModule.value.modules as submodule, index (index)}
+ {:else if flowModule.value.type === 'rawscript' || flowModule.value.type === 'script' || flowModule.value.type === 'flow'}
+
+ {/if}
+{:else if flowModule.value.type === 'forloopflow'}
+ {#each flowModule.value.modules as submodule, index (index)}
+
+ {/each}
+{:else if flowModule.value.type === 'branchone'}
+ {#if $selectedId === `${flowModule?.id}-branch-default`}
+
+
Default branch
+ Nothing to configure, this is the default branch if none of the predicates are met.
+
+ {:else}
+ {#each flowModule.value.default as submodule, index}
{/each}
- {:else if flowModule.value.type === 'branchone'}
- {#if $selectedId === `${flowModule?.id}-branch-default`}
-
-
Default branch
- Nothing to configure, this is the default branch if none of the predicates are met.
-
+ {/if}
+ {#each flowModule.value.branches as branch, branchIndex (branchIndex)}
+ {#if $selectedId === `${flowModule?.id}-branch-${branchIndex}`}
+
{:else}
- {#each flowModule.value.default as submodule, index}
+ {#each branch.modules as submodule, index}
{/each}
{/if}
- {#each flowModule.value.branches as branch, branchIndex (branchIndex)}
- {#if $selectedId === `${flowModule?.id}-branch-${branchIndex}`}
-
- {:else}
- {#each branch.modules as submodule, index}
-
- {/each}
- {/if}
- {/each}
- {:else if flowModule.value.type === 'branchall'}
- {#each flowModule.value.branches as branch, branchIndex (branchIndex)}
- {#if $selectedId === `${flowModule?.id}-branch-${branchIndex}`}
-
- {:else}
- {#each branch.modules as submodule, index}
-
- {/each}
- {/if}
- {/each}
- {/if}
-{/key}
+ {/each}
+{:else if flowModule.value.type === 'branchall'}
+ {#each flowModule.value.branches as branch, branchIndex (branchIndex)}
+ {#if $selectedId === `${flowModule?.id}-branch-${branchIndex}`}
+
+ {:else}
+ {#each branch.modules as submodule, index}
+
+ {/each}
+ {/if}
+ {/each}
+{/if}