diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte index b001a3a435..ce4d2418ce 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/InlineScriptEditor.svelte @@ -294,7 +294,13 @@ > Format - + diff --git a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/RunButton.svelte b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/RunButton.svelte index a4be6ab2d8..dfea79d436 100644 --- a/frontend/src/lib/components/apps/editor/inlineScriptsPanel/RunButton.svelte +++ b/frontend/src/lib/components/apps/editor/inlineScriptsPanel/RunButton.svelte @@ -6,13 +6,14 @@ CancelablePromise, InlineScript } from '../../types' - import { Button } from '$lib/components/common' - import { CornerDownLeft, Loader2 } from 'lucide-svelte' + import { RunButton } from '$lib/components/common' export let id: string export let inlineScript: InlineScript | undefined = undefined export let runLoading = false export let hideShortcut = false + export let size: 'xs' | 'xs2' = 'xs' + export let btnClasses = '' const { runnableComponents } = getContext('AppViewerContext') const { runnableJobEditorPanel } = getContext('AppEditorContext') @@ -20,38 +21,23 @@ {#if $runnableComponents[id] != undefined} - {#if !runLoading} - - {:else} - - {/if} + { + cancelable?.forEach((f) => f.cancel()) + runLoading = false + }} + on:run={async () => { + runLoading = true + $runnableJobEditorPanel.focused = true + try { + cancelable = $runnableComponents[id]?.cb?.map((f) => f(inlineScript, true)) + await Promise.all(cancelable) + } catch {} + runLoading = false + }} + {size} + /> {/if}