- {#if !hideAsJson && !['json', 's3object'].includes(resultKind ?? '') && typeof result === 'object'} {
- forceJson = ev.detail === 'json'
- }}
- >
- {#if ['table-col', 'table-row', 'table-row-object'].includes(resultKind ?? '')}
-
- {:else}
-
- {/if}
-
-
- {/if}
-
-
-
- {#if !disableExpand && !noControls}
-
-
-
-
-
- The result renderer in Windmill supports rich display rendering, allowing you to
- customize the display format of your results.
-
-
-
-
-
-
copyToClipboard(toJsonStr(result))} class="-mt-1">
-
-
-
-
-
- {/if}
-
-
{#if !forceJson && resultKind === 'table-col'}
- {@const data = 'table-col' in result ? result['table-col'] : result}
-
- {:else if !forceJson && resultKind === 'table-row'}
- {@const data = 'table-row' in result ? result['table-row'] : result}
-
- {:else if !forceJson && resultKind === 'table-row-object'}
- {@const data = 'table-row-object' in result ? result['table-row-object'] : result}
-
- {:else if !forceJson && resultKind === 'html'}
-
- {#if !requireHtmlApproval || enableHtml}
- {@html result.html}
- {:else}
-
-
-
- Warning
-
-
Rendering HTML can expose you to XSS attacks . Only enable it if you trust the author of the script.
-
-
-
- (enableHtml = true)}>
- Enable HTML rendering
-
-
-
- {/if}
-
- {:else if !forceJson && resultKind === 'map'}
-
-
-
- {:else if !forceJson && resultKind === 'png'}
-
-
-
- {:else if !forceJson && resultKind === 'jpeg'}
-
-
-
- {:else if !forceJson && resultKind === 'svg'}
-
-
{@html result.svg}
- {:else if !forceJson && resultKind === 'gif'}
-
-
-
- {:else if !forceJson && resultKind === 'plain'}
{typeof result === 'string' ? result : result?.['result']} {#if !noControls}
-
-
- copyToClipboard(typeof result === 'string' ? result : result?.['result'])}
- color="light"
- size="xs"
- >
- Copy
-
-
- {/if}
-
- {:else if !forceJson && resultKind === 'file'}
-
- {:else if !forceJson && resultKind === 'error' && result?.error}
-
-
{#if result.error.name || result.error.message}{result.error.name}: {result.error
- .message}{:else}{JSON.stringify(result.error, null, 4)}{/if}
-
{result.error.stack ?? ''}
-
-
- {#if language === 'bun'}
-
-
- Bun script are bundled for performance reasons. If you see an odd error that doesn't
- appear when testing (which doesn't use bundling), try putting //nobundling at the top of your script to disable bundling and feel free to mention it to the Windmill's
- team.
-
- {/if}
- {:else if !forceJson && resultKind === 'approval'}
-
- fetch(result['resume'], {
- method: 'POST',
- body: JSON.stringify({}),
- headers: { 'Content-Type': 'application/json' }
- })}
- >
- Resume
-
fetch(result['cancel'])}
- >Cancel
-
-
- {:else if !forceJson && resultKind === 's3object'}
-
-
-
-
- {#if s3FileDisplayRawMode}
-
-
{
- s3FileViewer?.open?.(result)
- }}
- > object store explorerRequire admin privilege or "S3 resource details and content can be accessed
- by all users of this workspace" of S3 Storage to be set in the workspace
- settings
-
- {:else if !result?.disable_download}
-
-
{
- s3FileViewer?.open?.(result)
- }}
- > object store explorerRequire admin privilege or "S3 resource details and content can be accessed
- by all users of this workspace" of S3 Storage to be set in the workspace
- settings
-
- {/if}
-
- {#if typeof result?.s3 === 'string'}
- {#if result?.s3?.endsWith('.parquet') || result?.s3?.endsWith('.csv')}
- {#key result.s3}
-
- {/key}
- {:else if result?.s3?.endsWith('.png') || result?.s3?.endsWith('.jpeg') || result?.s3?.endsWith('.jpg') || result?.s3?.endsWith('.webp')}
-
-
-
- {/if}
- {/if}
-
- {:else if !forceJson && resultKind === 's3object-list'}
-
-
-
- {#each result as s3object}
- {#if s3FileDisplayRawMode}
-
-
{
- s3FileViewer?.open?.(s3object)
- }}
- > open preview
-
- {:else if !s3object?.disable_download}
-
- {:else}
-
{s3object?.s3} (download disabled)
- {/if}
- {#if s3object?.s3?.endsWith('.parquet') || s3object?.s3?.endsWith('.csv')}
- {#if seeS3PreviewFileFromList == s3object?.s3}
-
{:else}
-
{
- seeS3PreviewFileFromList = s3object?.s3
- }}
- >open table preview
-
- {/if}
- {:else if s3object?.s3?.endsWith('.png') || s3object?.s3?.endsWith('.jpeg') || s3object?.s3?.endsWith('.jpg') || s3object?.s3?.endsWith('.webp')}
- {#if seeS3PreviewFileFromList == s3object?.s3}
-
-
-
- {:else}
-
{
- seeS3PreviewFileFromList = s3object?.s3
- }}
- >open image preview
-
- {/if}
- {/if}
- {/each}
-
-
- {:else if !forceJson && resultKind === 'markdown'}
-
-
-
- {:else if largeObject}
- {#if result && typeof result === 'object' && 'file' in result}
-
+{:else}
+
+ {#if result != undefined && length != undefined && largeObject != undefined}
+
+
+
+ {#if !hideAsJson && !['json', 's3object'].includes(resultKind ?? '') && typeof result === 'object'}
+ {
+ forceJson = ev.detail === 'json'
+ }}
>
-
- {:else}
-
+ {:else}
+
+ {/if}
+
+
+ {/if}
+
+
+
+ {#if !disableExpand && !noControls}
+
- Download {filename ? '' : 'as JSON'}
+
- {#if download_as_csv}
-
convertJsonToCsv(result)}
- customText="Download as CSV"
- />
+
+
+ The result renderer in Windmill supports rich display rendering, allowing you to
+ customize the display format of your results.
+
+
+
+ copyToClipboard(toJsonStr(result))}>
+
+
+
+
+
+ {/if}
+
+
+
+ {#if !forceJson && resultKind === 'table-col'}
+ {@const data = 'table-col' in result ? result['table-col'] : result}
+
+ {:else if !forceJson && resultKind === 'table-row'}
+ {@const data = 'table-row' in result ? result['table-row'] : result}
+
+ {:else if !forceJson && resultKind === 'table-row-object'}
+ {@const data = 'table-row-object' in result ? result['table-row-object'] : result}
+
+ {:else if !forceJson && resultKind === 'html'}
+
+ {#if !requireHtmlApproval || enableHtml}
+ {@html result.html}
+ {:else}
+
+
+
+ Warning
+
+
Rendering HTML can expose you to XSS attacks . Only enable it if you trust the author of the script.
+
+
+
+ (enableHtml = true)}>
+ Enable HTML rendering
+
+
+
{/if}
-
-
- {#if result && result != 'WINDMILL_TOO_BIG'}
-
- {/if}
- {/if}
- {:else if typeof result === 'string' && result.length > 0}
-
{result} {#if !noControls}
-
copyToClipboard(result)} color="light" size="xs">
- Copy
-
+ {:else if !forceJson && resultKind === 'png'}
+
+
+ {:else if !forceJson && resultKind === 'jpeg'}
+
+
+
+ {:else if !forceJson && resultKind === 'svg'}
+
+
{@html result.svg}
+ {:else if !forceJson && resultKind === 'gif'}
+
+
+
+ {:else if !forceJson && resultKind === 'plain'}
{typeof result === 'string' ? result : result?.['result']} {#if !noControls}
+
+
+ copyToClipboard(typeof result === 'string' ? result : result?.['result'])}
+ color="light"
+ size="xs"
+ >
+ Copy
+
+
+ {/if}
+
+ {:else if !forceJson && resultKind === 'file'}
+
+ {:else if !forceJson && resultKind === 'error' && result?.error}
+
+
{#if result.error.name || result.error.message}{result.error.name}: {result.error
+ .message}{:else}{JSON.stringify(result.error, null, 4)}{/if}
+
{result.error.stack ?? ''}
+
+
+ {#if language === 'bun'}
+
+
+ Bun script are bundled for performance reasons. If you see an odd error that doesn't
+ appear when testing (which doesn't use bundling), try putting //nobundling at the top of your script to disable bundling and feel free to mention it to the Windmill's
+ team.
+
+ {/if}
+ {:else if !forceJson && resultKind === 'approval'}
+
+ fetch(result['resume'], {
+ method: 'POST',
+ body: JSON.stringify({}),
+ headers: { 'Content-Type': 'application/json' }
+ })}
+ >
+ Resume
+
fetch(result['cancel'])}
+ >Cancel
+
+
+ {:else if !forceJson && resultKind === 's3object'}
+
+
+
+
+ {#if s3FileDisplayRawMode}
+
+
{
+ s3FileViewer?.open?.(result)
+ }}
+ > object store explorerRequire admin privilege or "S3 resource details and content can be accessed
+ by all users of this workspace" of S3 Storage to be set in the workspace
+ settings
+
+ {:else if !result?.disable_download}
+
+
{
+ s3FileViewer?.open?.(result)
+ }}
+ > object store explorerRequire admin privilege or "S3 resource details and content can be accessed
+ by all users of this workspace" of S3 Storage to be set in the workspace
+ settings
+
+ {/if}
+
+ {#if typeof result?.s3 === 'string'}
+ {#if result?.s3?.endsWith('.parquet') || result?.s3?.endsWith('.csv')}
+ {#key result.s3}
+
+ {/key}
+ {:else if result?.s3?.endsWith('.png') || result?.s3?.endsWith('.jpeg') || result?.s3?.endsWith('.jpg') || result?.s3?.endsWith('.webp')}
+
+
+
+ {/if}
+ {/if}
+
+ {:else if !forceJson && resultKind === 's3object-list'}
+
+
+
+ {#each result as s3object}
+ {#if s3FileDisplayRawMode}
+
+
{
+ s3FileViewer?.open?.(s3object)
+ }}
+ > open preview
+
+ {:else if !s3object?.disable_download}
+
+ {:else}
+
{s3object?.s3} (download disabled)
+ {/if}
+ {#if s3object?.s3?.endsWith('.parquet') || s3object?.s3?.endsWith('.csv')}
+ {#if seeS3PreviewFileFromList == s3object?.s3}
+
{:else}
+
{
+ seeS3PreviewFileFromList = s3object?.s3
+ }}
+ >open table preview
+
+ {/if}
+ {:else if s3object?.s3?.endsWith('.png') || s3object?.s3?.endsWith('.jpeg') || s3object?.s3?.endsWith('.jpg') || s3object?.s3?.endsWith('.webp')}
+ {#if seeS3PreviewFileFromList == s3object?.s3}
+
+
+
+ {:else}
+
{
+ seeS3PreviewFileFromList = s3object?.s3
+ }}
+ >open image preview
+
+ {/if}
+ {/if}
+ {/each}
+
+
+ {:else if !forceJson && resultKind === 'markdown'}
+
+
+
+ {:else if largeObject}
+ {#if result && typeof result === 'object' && 'file' in result}
+
+ {:else}
+
+ Download {filename ? '' : 'as JSON'}
+
+ {#if download_as_csv}
+
convertJsonToCsv(result)}
+ customText="Download as CSV"
+ />
+ {/if}
+
+
+
+ {#if result && result != 'WINDMILL_TOO_BIG'}
+
+ {/if}
+ {/if}
+ {:else if typeof result === 'string' && result.length > 0}
+
{result} {#if !noControls}
+
copyToClipboard(result)} color="light" size="xs">
+ Copy
+
+
+ {/if}
+ {:else}
+
{/if}
- {:else}
-
- {/if}
+
{:else if typeof result === 'string' && resultKind === 'plain'}