diff --git a/frontend/src/lib/components/flows/content/FlowConstants.svelte b/frontend/src/lib/components/flows/content/FlowConstants.svelte index aa1dda1052..d26341d1ed 100644 --- a/frontend/src/lib/components/flows/content/FlowConstants.svelte +++ b/frontend/src/lib/components/flows/content/FlowConstants.svelte @@ -13,14 +13,50 @@ let hideOptional = false const { flowStateStore, flowStore } = getContext('FlowEditorContext') - $: steps = ( - dfs($flowStore.value.modules, (x) => x) - .map((x) => [x.value, x] as [FlowModuleValue, FlowModule]) - .filter((x) => x[0].type == 'script' || x[0].type == 'rawscript') as [ - PathScript | RawScript, - FlowModule - ][] - ) + $: scriptModules = dfs($flowStore.value.modules, (x) => x) + .map((x) => [x.value, x] as [FlowModuleValue, FlowModule]) + .filter((x) => x[0].type == 'script' || x[0].type == 'rawscript') as [ + PathScript | RawScript, + FlowModule + ][] + + $: resources = Object.fromEntries( + scriptModules + .map(([v, m]) => [ + m.id, + Object.entries(v.input_transforms) + .map((x) => { + let schema = $flowStateStore[m.id]?.schema + let val: { argName: string; type: string } | undefined = undefined + + const [k, inputTransform] = x + const v = schema.properties[k] + + if ( + v.format?.includes('resource') && + inputTransform.type === 'static' && + (inputTransform.value === '' || + inputTransform.value === undefined || + inputTransform.value === null) + ) { + val = { + argName: k, + type: v.format.split('-')[1] + } + } + return val + }) + .filter(Boolean) + ]) + .filter((x) => x[1].length > 0) + ) as { + [k: string]: { + argName: string + type: string + }[] + } + + $: steps = scriptModules .map( ([v, m]) => [ @@ -55,6 +91,21 @@ useful when forking a flow to get an overview of all the variables to parametrize that are not exposed directly as flow inputs. + {#if Object.keys(resources).length > 0} + + The following resources are missing and the flow will not be fully runnable until they are + set. Add your own resources: + {#each Object.entries(resources) as [id, r]} + {#each r as resource} +
+ {id} is missing a resource of type{' '} + {resource?.type} for the input{' '} + {resource?.argName} +
+ {/each} + {/each} +
+ {/if} {#if steps.length == 0}
{#if $flowStore.value.modules.length == 0} diff --git a/frontend/src/routes/(root)/(logged)/flows/add/+page.svelte b/frontend/src/routes/(root)/(logged)/flows/add/+page.svelte index 7f2ccbf2a6..8c69463069 100644 --- a/frontend/src/routes/(root)/(logged)/flows/add/+page.svelte +++ b/frontend/src/routes/(root)/(logged)/flows/add/+page.svelte @@ -96,7 +96,7 @@ Object.assign(flow, hub.flow) flow = flow goto('?', { replaceState: true }) - selectedId = 'settings-metadata' + selectedId = 'constants' } } await initFlow(flow, flowStore, flowStateStore)