mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-10 16:05:58 +00:00
handle loading erronous code in flows
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import type { FlowModule } from '$lib/gen'
|
||||
import { getScriptByPath } from '$lib/utils'
|
||||
import { getScriptByPath, valueToTsType } from '$lib/utils'
|
||||
import {
|
||||
faArrowDown,
|
||||
faClose,
|
||||
@@ -15,6 +15,7 @@
|
||||
import { Highlight } from 'svelte-highlight'
|
||||
import python from 'svelte-highlight/languages/python'
|
||||
import typescript from 'svelte-highlight/languages/typescript'
|
||||
import IconedResourceType from '../IconedResourceType.svelte'
|
||||
import Modal from '../Modal.svelte'
|
||||
import { isEmptyFlowModule } from './flowStateUtils'
|
||||
import { stepOpened } from './stepOpenedStore'
|
||||
@@ -46,7 +47,12 @@
|
||||
<div on:click={() => stepOpened.update(() => String(indexes.join('-')))}>
|
||||
<h3 class="text-sm font-bold text-gray-900">
|
||||
{#if 'path' in mod.value && mod.value.path}
|
||||
{mod.value.path}
|
||||
{#if mod.value.path.startsWith('hub/')}
|
||||
<IconedResourceType name={mod.value.path.split('/')[2]} silent={true} /> {mod.value
|
||||
.path}
|
||||
{:else}
|
||||
{mod.value.path}
|
||||
{/if}
|
||||
{:else if 'language' in mod.value && mod.value.language}
|
||||
Inline {mod.value.language}
|
||||
{:else}
|
||||
|
||||
@@ -17,10 +17,15 @@ export function emptyFlowModuleSchema(): FlowModuleSchema {
|
||||
}
|
||||
|
||||
export async function loadFlowModuleSchema(flowModule: FlowModule): Promise<FlowModuleSchema> {
|
||||
const { input_transform, schema } = await loadSchemaFromModule(flowModule)
|
||||
flowModule.input_transform = input_transform
|
||||
try {
|
||||
const { input_transform, schema } = await loadSchemaFromModule(flowModule)
|
||||
|
||||
return { flowModule, schema, previewResults: [] }
|
||||
flowModule.input_transform = input_transform
|
||||
|
||||
return { flowModule, schema, previewResults: [] }
|
||||
} catch (e) {
|
||||
return { flowModule, schema: emptySchema(), previewResults: [] }
|
||||
}
|
||||
}
|
||||
|
||||
export async function pickScript(path: string): Promise<FlowModuleSchema> {
|
||||
|
||||
Reference in New Issue
Block a user