Merge pull request #15435 from Budibase/fix/cheeks-ux-review-console-log

JS Console log UX improvements
This commit is contained in:
Michael Drury 2025-01-29 13:31:23 +00:00 committed by GitHub
commit 8fe277e584
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 21 additions and 11 deletions

View File

@ -19,7 +19,7 @@
$: success = !error && !empty $: success = !error && !empty
$: highlightedResult = highlight(expressionResult) $: highlightedResult = highlight(expressionResult)
$: highlightedLogs = expressionLogs.map(l => ({ $: highlightedLogs = expressionLogs.map(l => ({
log: highlight(l.log.join(", ")), log: l.log.map(part => highlight(part)).join(", "),
line: l.line, line: l.line,
type: l.type, type: l.type,
})) }))
@ -95,7 +95,9 @@
{#if empty} {#if empty}
Your expression will be evaluated here Your expression will be evaluated here
{:else if error} {:else if error}
<div class="error-msg">
{formatError(expressionError)} {formatError(expressionError)}
</div>
{:else} {:else}
<div class="output-lines"> <div class="output-lines">
{#each highlightedLogs as logLine} {#each highlightedLogs as logLine}
@ -118,15 +120,19 @@
<span>{@html logLine.log}</span> <span>{@html logLine.log}</span>
</div> </div>
{#if logLine.line} {#if logLine.line}
<span style="color: var(--blue)">:{logLine.line}</span> <span style="color: var(--blue); overflow-wrap: normal;"
>:{logLine.line}</span
>
{/if} {/if}
</div> </div>
{/each} {/each}
<div class="line"> <div class="line">
<div>
<!-- eslint-disable-next-line svelte/no-at-html-tags--> <!-- eslint-disable-next-line svelte/no-at-html-tags-->
{@html highlightedResult} {@html highlightedResult}
</div> </div>
</div> </div>
</div>
{/if} {/if}
</div> </div>
</div> </div>
@ -169,29 +175,33 @@
.header.error::before { .header.error::before {
background: var(--error-bg); background: var(--error-bg);
} }
.error-msg {
padding-top: var(--spacing-m);
}
.body { .body {
flex: 1 1 auto; flex: 1 1 auto;
padding: var(--spacing-m) var(--spacing-l);
font-family: var(--font-mono); font-family: var(--font-mono);
margin: 0 var(--spacing-m);
font-size: 12px; font-size: 12px;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
white-space: pre-line; word-wrap: anywhere;
word-wrap: break-word;
height: 0; height: 0;
} }
.output-lines { .output-lines {
display: flex; display: flex;
flex-direction: column; flex-direction: column;
gap: var(--spacing-xs);
} }
.line { .line {
border-bottom: var(--border-light);
display: flex; display: flex;
flex-direction: row; flex-direction: row;
justify-content: space-between; justify-content: space-between;
align-items: end; align-items: end;
padding: var(--spacing-s); padding: var(--spacing-m) 0;
word-wrap: anywhere;
}
.line:not(:first-of-type) {
border-top: var(--border-light);
} }
.icon-log { .icon-log {
display: flex; display: flex;