diff --git a/frontend/src/lib/components/DisplayResult.svelte b/frontend/src/lib/components/DisplayResult.svelte index bbf11ddcb9..e2b5445444 100644 --- a/frontend/src/lib/components/DisplayResult.svelte +++ b/frontend/src/lib/components/DisplayResult.svelte @@ -54,7 +54,7 @@ {#if result} {#if typeof result == 'object' && Object.keys(result).length > 0}
- The result keys are: {Object.keys(result).join(', ')} + The result keys are: {truncate(Object.keys(result).join(', '), 50)}
{/if} {#if resultKind == 'table-col'} diff --git a/frontend/src/lib/components/flows/utils.ts b/frontend/src/lib/components/flows/utils.ts index 61a12a194d..7972e665ec 100644 --- a/frontend/src/lib/components/flows/utils.ts +++ b/frontend/src/lib/components/flows/utils.ts @@ -65,8 +65,13 @@ export async function loadSchemaFromModule(module: FlowModule): Promise<{ if (mod.type === 'rawscript') { schema = emptySchema() await inferArgs(mod.language!, mod.content!, schema) - } else { + } else if (mod.path && mod.path != '') { schema = await loadSchema(mod.path!) + } else { + return { + input_transform: {}, + schema: emptySchema() + } } const keys = Object.keys(schema?.properties ?? {}) @@ -116,9 +121,8 @@ export function getDefaultExpr( previousExpr?: string ) { const expr = previousExpr ?? `previous_result.${key}` - return `import { previous_result, flow_input, step, variable, resource, params } from 'windmill${ - importPath ? `@${importPath}` : '' - }' + return `import { previous_result, flow_input, step, variable, resource, params } from 'windmill${importPath ? `@${importPath}` : '' + }' ${expr}` } @@ -182,23 +186,7 @@ export async function runFlowPreview(args: Record, flow: Flow) { } }) } -// function computeFlowInputPull(previewResult: any | undefined, flowInputAsObject: any) { -// const iteratorValues = -// previewResult && Array.isArray(previewResult) -// ? { -// iter: { -// value: previewResult[0], -// index: `iterations\'s index (0 to ${previewResult.length - 1})` -// } -// } -// : { -// iter: { -// value: 'iteration\'s object', -// index: 'iterations\'s index' -// } -// } -// return Object.assign(flowInputAsObject, iteratorValues) -// } + export function codeToStaticTemplate(code?: string): string | undefined { if (!code) return undefined