mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-09-11 00:06:06 +00:00
* improve arg layout * improve runs row (wip) * Add job badges * group filters in dropdown * improve runs row layout * Improve filter layout * use select for graph display * handle width modification * Remove useless headers * fix bad display when result is null * Display all jobs tags * Improve display for 'step of flow' jobs * Add empty message for JobAssetsViewer * Move job preview assets tab to flow result for flows * Only show tag in the tag column * Add job kind to rows * Add padding to the run preview * nit * move refresh on top of table * Move filters into header bar * move runs table topbar outside table * Simplify layout * Use toggle for kind for large screen * move sync job and add batch actions breakpoint * revert dropdown to toggle for conurrency/duration * handle run labels overflow * improve time display * fix flow preview with no path display * Add titles * Prevent tab shift for script and flow result * nit * Allow job deselect * Make job link more visible * Fix filtering for queued job * Fix filter not reseting after select from toggleMore * Allways show assets for flow status viewer * Update run chart to svelte 5 and fix reactivity issue * migrate concurrency chart to svelte 5 * Improve admmin workspace display and fix missing in add filter popover * nit * fix run table resize * Add breakpoint to hide tag in small screens * use a css file for gathering RunRow and RunTable classes * nit * nit * remove debug log * nit * fix typo * Have too icons for queued workers and suspended * add gap before auto-refresh * Replace min max to from to calendar picker * Add loading state for job preview * Move duration * Display kind full width when calendar not set * Only show 2 digits for jobs duration * Replace Scheduled for by a clock un the run row * Fix typpo in dropown select to dropdown select * Hide sync and previews in toggle more * Fix runs row padding * Change notification colors for queued jobs * use utils debounce function * fix typo * nit * use class instead of classNames * clean select filter side effects
110 lines
3.0 KiB
Svelte
110 lines
3.0 KiB
Svelte
<script lang="ts">
|
|
import { ResourceService, VariableService } from '$lib/gen'
|
|
import { workspaceStore } from '$lib/stores'
|
|
import { copyToClipboard, truncate } from '$lib/utils'
|
|
import { ClipboardCopy, Expand } from 'lucide-svelte'
|
|
import Drawer from './common/drawer/Drawer.svelte'
|
|
import ObjectViewer from './propertyPicker/ObjectViewer.svelte'
|
|
import Tooltip from './Tooltip.svelte'
|
|
import { Button, DrawerContent } from './common'
|
|
|
|
interface Props {
|
|
value: any
|
|
}
|
|
|
|
let { value }: Props = $props()
|
|
let jsonViewer: Drawer | undefined = $state()
|
|
let jsonViewerContent: any | undefined = $state()
|
|
|
|
function isString(value: any) {
|
|
return typeof value === 'string' || value instanceof String
|
|
}
|
|
|
|
async function getResource(path: string) {
|
|
jsonViewerContent = await ResourceService.getResourceValue({
|
|
workspace: $workspaceStore!,
|
|
path
|
|
})
|
|
}
|
|
|
|
async function getVariable(path: string) {
|
|
jsonViewerContent = await VariableService.getVariableValue({
|
|
workspace: $workspaceStore!,
|
|
path
|
|
})
|
|
}
|
|
</script>
|
|
|
|
<Drawer bind:this={jsonViewer} size="800px">
|
|
<DrawerContent title="Argument Details" on:close={jsonViewer.closeDrawer}>
|
|
{#snippet actions()}
|
|
<Button
|
|
on:click={() => copyToClipboard(JSON.stringify(jsonViewerContent, null, 4))}
|
|
color="light"
|
|
size="xs"
|
|
startIcon={{ icon: ClipboardCopy }}
|
|
>
|
|
Copy
|
|
</Button>
|
|
{/snippet}
|
|
{#if isString(jsonViewerContent)}
|
|
<pre>{jsonViewerContent}</pre>
|
|
{:else}
|
|
<ObjectViewer pureViewer json={jsonViewerContent} />
|
|
{/if}
|
|
</DrawerContent>
|
|
</Drawer>
|
|
|
|
{#if value == undefined || value == null}
|
|
<span class="text-tertiary">null</span>
|
|
{:else if value === '<function call>'}
|
|
{'<function call>'}<Tooltip
|
|
>The arg was none and the default argument of the script is a function call, hence the actual
|
|
value used for this arg was the output of the script's function call for this arg</Tooltip
|
|
>
|
|
{:else if isString(value) && value.startsWith('$res:')}
|
|
<button
|
|
class="text-xs text-blue-500"
|
|
onclick={async () => {
|
|
await getResource(value.substring('$res:'.length))
|
|
jsonViewer?.toggleDrawer()
|
|
}}>{value}</button
|
|
>
|
|
{:else if isString(value) && value.startsWith('$var:')}
|
|
<button
|
|
class="text-xs text-blue-500"
|
|
onclick={async () => {
|
|
await getVariable(value.substring('$res:'.length))
|
|
jsonViewer?.toggleDrawer()
|
|
}}>{value}</button
|
|
>
|
|
{:else if typeof value !== 'object'}
|
|
<span>
|
|
{truncate(JSON.stringify(value), 80)}
|
|
{#if JSON.stringify(value).length > 80}
|
|
<button
|
|
class="text-xs text-blue-500"
|
|
onclick={() => {
|
|
jsonViewerContent = value
|
|
jsonViewer?.toggleDrawer()
|
|
}}>See expanded</button
|
|
>
|
|
{/if}
|
|
</span>
|
|
{:else}
|
|
<div class="relative">
|
|
{#if JSON.stringify(value).length > 120}
|
|
<button
|
|
class="text-xs absolute top-0 right-8 text-tertiary"
|
|
onclick={() => {
|
|
jsonViewerContent = value
|
|
jsonViewer?.toggleDrawer()
|
|
}}><Expand size={18} /></button
|
|
>
|
|
{/if}
|
|
<div class="max-h-60 overflow-auto" style="scrollbar-gutter: stable">
|
|
<ObjectViewer collapsed={false} topBrackets={true} pureViewer={true} json={value} />
|
|
</div>
|
|
</div>
|
|
{/if}
|