From ab3ff1d7015061b263152fd51e955df80552ba02 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 18 Apr 2025 19:04:02 +0200 Subject: [PATCH] fix run script preview for bundle scripts --- frontend/src/lib/components/ModulePreview.svelte | 2 +- frontend/src/lib/components/TestJobLoader.svelte | 3 ++- frontend/src/lib/scripts.ts | 8 +++++--- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/frontend/src/lib/components/ModulePreview.svelte b/frontend/src/lib/components/ModulePreview.svelte index 4d6c433bd8..2abcb938ee 100644 --- a/frontend/src/lib/components/ModulePreview.svelte +++ b/frontend/src/lib/components/ModulePreview.svelte @@ -70,7 +70,7 @@ args, $flowStore?.tag ?? (val.tag_override ? val.tag_override : script.tag), script.lock, - val.hash + val.hash ?? script.hash ) } else if (val.type == 'flow') { await testJobLoader?.abstractRun(() => diff --git a/frontend/src/lib/components/TestJobLoader.svelte b/frontend/src/lib/components/TestJobLoader.svelte index a7f911aff7..10b0fcfb7f 100644 --- a/frontend/src/lib/components/TestJobLoader.svelte +++ b/frontend/src/lib/components/TestJobLoader.svelte @@ -142,7 +142,8 @@ args, language: lang as Preview['language'], tag, - lock + lock, + script_hash: hash } }) ) diff --git a/frontend/src/lib/scripts.ts b/frontend/src/lib/scripts.ts index d5516a69bc..3d8299bf09 100644 --- a/frontend/src/lib/scripts.ts +++ b/frontend/src/lib/scripts.ts @@ -47,7 +47,7 @@ export function scriptLangToEditorLang( return 'nu' } else if (lang == 'java') { return 'java' - // for related places search: ADD_NEW_LANG + // for related places search: ADD_NEW_LANG } else if (lang == undefined) { return 'typescript' } else { @@ -130,7 +130,7 @@ const scriptLanguagesArray: [SupportedLanguage | 'docker' | 'bunnative', string] ['docker', 'Docker'], ['nu', 'Nu'], ['java', 'Java'] - // for related places search: ADD_NEW_LANG + // for related places search: ADD_NEW_LANG ] export function processLangs(selected: string | undefined, langs: string[]): string[] { if (selected === 'nativets') { @@ -140,7 +140,7 @@ export function processLangs(selected: string | undefined, langs: string[]): str //those languages are newer and may not be in the saved list let nl = ['bunnative', 'rust', 'ansible', 'csharp', 'nu', 'java'] - // for related places search: ADD_NEW_LANG + // for related places search: ADD_NEW_LANG nl.forEach((lang) => { if (!ls.includes(lang)) { ls.push(lang) @@ -162,6 +162,7 @@ export async function getScriptByPath(path: string): Promise<{ concurrency_time_window_s: number | undefined lock?: string created_at?: string + hash?: string }> { if (path.startsWith('hub/')) { const { content, language, schema, lockfile } = await ScriptService.getHubScriptByPath({ path }) @@ -190,6 +191,7 @@ export async function getScriptByPath(path: string): Promise<{ concurrent_limit: script.concurrent_limit, concurrency_time_window_s: script.concurrency_time_window_s, lock: script.lock, + hash: script.hash, created_at: script.created_at } }