feat: show skip-asset-dispatch flag as badge instead of args row

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Ruben Fiszel
2026-06-09 22:44:07 +00:00
co-authored by Claude Fable 5
parent c4c64b5eba
commit 5b72f0d249
+34 -9
View File
@@ -1,7 +1,7 @@
<script lang="ts">
import { ChevronRightSquare, ClipboardCopy, Download, Expand } from 'lucide-svelte'
import ArgInfo from './ArgInfo.svelte'
import { Button, Drawer, DrawerContent, Skeleton } from './common'
import { Badge, Button, Drawer, DrawerContent, Skeleton } from './common'
import { Highlight } from 'svelte-highlight'
import { copyToClipboard } from '$lib/utils'
@@ -25,6 +25,20 @@
let { id = undefined, args, argLabel = undefined, workspace = undefined }: Props = $props()
// Internal flag injected by "test this step" runs to suppress the asset
// dispatcher. Not a real input: shown as a badge instead of a table row,
// but kept in the expanded JSON drawer and download.
const SKIP_ASSET_DISPATCH_ARG = '_wmill_skip_asset_dispatch'
let skippedAssetDispatch = $derived(
args != undefined && typeof args === 'object' && args[SKIP_ASSET_DISPATCH_ARG] === true
)
let displayArgs = $derived(
args != undefined && typeof args === 'object'
? Object.fromEntries(Object.entries(args).filter(([k]) => k !== SKIP_ASSET_DISPATCH_ARG))
: args
)
let jsonViewer: Drawer | undefined = $state()
let runLocally: Drawer | undefined = $state()
let jsonStr = $state('')
@@ -38,13 +52,13 @@
function pythonCode() {
return `
if __name__ == "__main__":
${Object.entries(args)
${Object.entries(displayArgs)
.map(([arg, value]) => {
return ` ${arg} = ${JSON.stringify(value)}`
})
.join('\n')}
main(${Object.keys(args)
main(${Object.keys(displayArgs)
.map((x) => `${x} = ${x}`)
.join(', ')})
`
@@ -53,7 +67,7 @@ ${Object.entries(args)
function typescriptCode() {
return `
if (import.meta.main) {
${Object.entries(args)
${Object.entries(displayArgs)
.map(([arg, value]) => {
return ` let ${arg} = ${JSON.stringify(value)}`
})
@@ -79,7 +93,18 @@ ${Object.entries(args)
<DataTable size="sm" containerClass="bg-surface-tertiary">
<Head>
<tr class="w-full">
<Cell head first>{argLabel ?? 'Input'}</Cell>
<Cell head first>
{argLabel ?? 'Input'}
{#if skippedAssetDispatch}
<Badge
color="gray"
verySmall
title="This run was started with {SKIP_ASSET_DISPATCH_ARG} and did not auto-trigger downstream asset consumers"
>
asset dispatch skipped
</Badge>
{/if}
</Cell>
<Cell head last>Value</Cell>
</tr>
{#snippet headerAction()}
@@ -99,15 +124,15 @@ ${Object.entries(args)
</Head>
<tbody class="divide-y w-full">
{#if args && typeof args === 'object' && Object.keys(args ?? {}).length > 0}
{#each Object.entries(args ?? {}).sort( (a, b) => a?.[0]?.localeCompare(b?.[0]) ) as [arg, value]}
{#if displayArgs && typeof displayArgs === 'object' && Object.keys(displayArgs ?? {}).length > 0}
{#each Object.entries(displayArgs ?? {}).sort( (a, b) => a?.[0]?.localeCompare(b?.[0]) ) as [arg, value]}
<Row>
<Cell first>{arg}</Cell>
<Cell><ArgInfo {value} /></Cell>
</Row>
{/each}
{:else if args && typeof args !== 'object'}
<Row><Cell>Argument is not an object (type: {typeof args})</Cell></Row>
{:else if displayArgs && typeof displayArgs !== 'object'}
<Row><Cell>Argument is not an object (type: {typeof displayArgs})</Cell></Row>
{:else if args}
<Row><Cell>No arguments</Cell></Row>
{:else}