mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-19 08:01:25 +00:00
add copy to clipboard to display result
This commit is contained in:
@@ -30,7 +30,7 @@
|
||||
color="light"
|
||||
size="xs"
|
||||
>
|
||||
<div class="flex gap-2 items-center">Copy to clipboard <ClipboardCopy /> </div>
|
||||
<div class="flex gap-2 items-center">Copy <ClipboardCopy /> </div>
|
||||
</Button>
|
||||
</svelte:fragment>
|
||||
{#if isString(jsonViewerContent)}
|
||||
|
||||
@@ -137,7 +137,8 @@
|
||||
class="mb-2 w-full text-sm relative"
|
||||
>The result keys are: <b>{truncate(Object.keys(result).join(', '), 50)}</b>
|
||||
{#if !disableExpand}
|
||||
<div class="text-tertiary text-xs absolute top-5.5 right-0">
|
||||
<div class="text-tertiary text-xs absolute top-5.5 right-0 inline-flex gap-2">
|
||||
<button on:click={() => copyToClipboard(jsonStr)}><ClipboardCopy size={16} /></button>
|
||||
<button on:click={jsonViewer.openDrawer}><Expand size={16} /></button>
|
||||
</div>
|
||||
{/if}
|
||||
@@ -280,6 +281,13 @@
|
||||
<ObjectViewer json={result} />
|
||||
{:else}
|
||||
<Highlight language={json} code={jsonStr} />
|
||||
{#if typeof result == 'string'}
|
||||
<div class="flex">
|
||||
<Button size="xs" on:click={() => copyToClipboard(result)} color="light">
|
||||
<div class="flex gap-2 items-center">Copy <ClipboardCopy size={12} /> </div>
|
||||
</Button>
|
||||
</div>
|
||||
{/if}
|
||||
{/if}
|
||||
{/if}
|
||||
{:else}
|
||||
@@ -313,7 +321,13 @@
|
||||
JSON is too large to be displayed in full.
|
||||
</div>
|
||||
{:else}
|
||||
FOO
|
||||
<Highlight language={json} code={jsonStr.replace(/\\n/g, '\n')} />
|
||||
{#if typeof result == 'string'}
|
||||
<Button on:click={() => copyToClipboard(result)} color="light" size="xs">
|
||||
<div class="flex gap-2 items-center">Copy <ClipboardCopy /> </div>
|
||||
</Button>
|
||||
{/if}
|
||||
{/if}
|
||||
</DrawerContent>
|
||||
</Drawer>
|
||||
|
||||
Reference in New Issue
Block a user