diff --git a/frontend/.prettierrc b/frontend/.prettierrc index b1dc1d659e..ac57ae142f 100644 --- a/frontend/.prettierrc +++ b/frontend/.prettierrc @@ -3,5 +3,6 @@ "singleQuote": true, "trailingComma": "none", "printWidth": 100, + "htmlWhitespaceSensitivity": "strict", "semi": false } diff --git a/frontend/src/app.css b/frontend/src/app.css index d5992cf075..a0bb14980c 100644 --- a/frontend/src/app.css +++ b/frontend/src/app.css @@ -21,7 +21,7 @@ html { a { @apply text-blue-500; } - + .flex pre code.hljs { @apply text-sm; } @@ -127,19 +127,19 @@ html { @apply rounded-lg; @apply text-sm; @apply px-5; - @apply py-2.5; - @apply text-center; + @apply py-2.5; + @apply text-center; @apply inline-flex; @apply items-center; } .default-primary-button-v2:focus { - @apply ring-4; + @apply ring-4; @apply outline-none; @apply bg-blue-800; } .default-primary-button-v2:hover { - @apply bg-blue-800 + @apply bg-blue-800; } .default-secondary-button-v2 { @@ -151,19 +151,19 @@ html { @apply rounded-lg; @apply text-sm; @apply px-5; - @apply py-2.5; - @apply text-center; + @apply py-2.5; + @apply text-center; @apply inline-flex; @apply items-center; } .default-secondary-button-v2:focus { - @apply ring-4; + @apply ring-4; @apply outline-none; @apply ring-gray-100; } .default-secondary-button-v2:hover { - @apply bg-gray-100 + @apply bg-gray-100; } .input-error { @@ -224,10 +224,10 @@ html { .inline-highlight pre code.hljs { padding: 0; - @apply text-xs; + @apply text-xs whitespace-pre-wrap; } /* svelte-split-pane separator class override */ .separator { background-color: #ddd !important; -} \ No newline at end of file +} diff --git a/frontend/src/lib/components/DisplayResult.svelte b/frontend/src/lib/components/DisplayResult.svelte index 8dc6a124eb..bb7af9a5bf 100644 --- a/frontend/src/lib/components/DisplayResult.svelte +++ b/frontend/src/lib/components/DisplayResult.svelte @@ -6,8 +6,18 @@ export let result: any - let resultKind: 'json' | 'table-col' | 'table-row' | 'png' | 'file' | 'jpeg' | 'gif' | undefined = - inferResultKind(result) + let resultKind: + | 'json' + | 'table-col' + | 'table-row' + | 'png' + | 'file' + | 'jpeg' + | 'gif' + | 'error' + | undefined = inferResultKind(result) + + let forceJson = false function isRectangularArray(obj: any) { if (!Array.isArray(obj) || obj.length == 0) { @@ -45,6 +55,8 @@ return 'jpeg' } else if (keys.length == 1 && keys[0] == 'file') { return 'file' + } else if (keys.length == 1 && keys[0] == 'error') { + return 'error' } } catch (err) {} } @@ -52,13 +64,17 @@ } -
+
{#if result} - {#if typeof result == 'object' && Object.keys(result).length > 0} -
- The result keys are: {truncate(Object.keys(result).join(', '), 50)} -
{/if}{#if resultKind == 'table-col'} -
+ {#if resultKind && resultKind != 'json'} +
+ as JSON
{/if}{#if typeof result == 'object' && Object.keys(result).length > 0}
The result keys are: {truncate(Object.keys(result).join(', '), 50)}
{/if}{#if !forceJson && resultKind == 'table-col'}
{#each Object.keys(result) as col}
{/each}
- {:else if resultKind == 'table-row'}
@@ -91,37 +107,31 @@
- {:else if resultKind == 'png'} -
- Result is an image: png rendered + {:else if !forceJson && resultKind == 'png'} +
png rendered
- {:else if resultKind == 'jpeg'} -
- Result is an image: jpeg rendered
- {:else if resultKind == 'gif'} -
- Result is an image: gif rendered + {:else if !forceJson && resultKind == 'gif'} +
gif rendered
- {:else if resultKind == 'file'} -
- Result is a file: DownloadDownload
+ {:else if !forceJson && resultKind == 'error'}

{result.error}

+
{:else} -
+