diff --git a/frontend/src/lib/components/DisplayResultControlBar.svelte b/frontend/src/lib/components/DisplayResultControlBar.svelte
index 95d0a3414e..d45ca3f92d 100644
--- a/frontend/src/lib/components/DisplayResultControlBar.svelte
+++ b/frontend/src/lib/components/DisplayResultControlBar.svelte
@@ -3,6 +3,7 @@
import { Download, InfoIcon, ClipboardCopy, Expand } from 'lucide-svelte'
import Popover from './Popover.svelte'
import { copyToClipboard } from '$lib/utils'
+ import { downloadViaClient, shouldDownloadViaClient } from '$lib/utils/downloadFile'
import type { DisplayResultUi } from './custom_ui'
import { createEventDispatcher } from 'svelte'
@@ -37,21 +38,38 @@
return 'error stringifying object: ' + e.toString()
}
}
+
+ let resultApiPath = $derived(
+ workspaceId && jobId
+ ? nodeId
+ ? `/w/${workspaceId}/jobs/result_by_id/${jobId}/${nodeId}`
+ : `/w/${workspaceId}/jobs_u/completed/get_result/${jobId}`
+ : undefined
+ )
+ let downloadName = $derived(`${filename ?? 'result'}.json`)
{#if customUi?.disableDownload !== true}
-
-
-
+ {#if resultApiPath && shouldDownloadViaClient()}
+
+ {:else}
+
+
+
+ {/if}
{/if}
{#if disableTooltips !== true}
diff --git a/frontend/src/lib/components/JobArgs.svelte b/frontend/src/lib/components/JobArgs.svelte
index 68ca3c078f..77c94de11e 100644
--- a/frontend/src/lib/components/JobArgs.svelte
+++ b/frontend/src/lib/components/JobArgs.svelte
@@ -13,6 +13,7 @@
import HighlightTheme from './HighlightTheme.svelte'
import { deepEqual } from 'fast-equals'
import { isWindmillTooBigObject } from './job_args'
+ import { downloadViaClient, shouldDownloadViaClient } from '$lib/utils/downloadFile'
interface Props {
id?: string | undefined
@@ -27,6 +28,10 @@
let runLocally: Drawer | undefined = $state()
let jsonStr = $state('')
+ const argsDownloadName = 'windmill-args.json'
+ let argsApiPath = $derived(id && workspace ? `/w/${workspace}/jobs_u/get_args/${id}` : undefined)
+ let argsDataHref = $derived(`data:text/json;charset=utf-8,${encodeURIComponent(jsonStr)}`)
+
function pythonCode() {
return `
if __name__ == "__main__":
@@ -60,10 +65,12 @@ ${Object.entries(args)
{#if args && typeof args === 'object' && deepEqual( Object.keys(args ?? {}), ['reason'] ) && args['reason'] == 'PREPROCESSOR_ARGS_ARE_DISCARDED'}
Preprocessor args are discarded
{:else if id && workspace && args && typeof args === 'object' && deepEqual( Object.keys(args ?? {}), ['reason'] ) && args['reason'] == 'WINDMILL_TOO_BIG'}
- The args are too big in size to be able to fetch alongside job. Please download the JSON file to view them.
+ The args are too big in size to be able to fetch alongside job. Please {#if shouldDownloadViaClient()}{:else}download the JSON file to view them{/if}.
{:else}
@@ -120,17 +127,26 @@ ${Object.entries(args)
{#snippet actions()}
-
+ {#if argsApiPath && shouldDownloadViaClient()}
+
+ {:else}
+
+ {/if}
{:else}
{/if}