only prettify run forms and lightweight schema form

This commit is contained in:
Ruben Fiszel
2023-05-10 17:29:12 +02:00
parent 2b1ba8eeea
commit 8d8542e4cf
6 changed files with 41 additions and 24 deletions

View File

@@ -58,6 +58,7 @@
export let noMargin = false
export let extra: Record<string, any> = {}
export let minW = true
export let prettifyHeader = false
let seeEditable: boolean = enum_ != undefined || pattern != undefined
const dispatch = createEventDispatcher()
@@ -175,7 +176,7 @@
<div class="flex flex-col w-full {minW ? 'min-w-[250px]' : ''}">
<div>
{#if displayHeader}
<FieldHeader {label} {required} {type} {contentEncoding} {format} />
<FieldHeader prettify={prettifyHeader} {label} {required} {type} {contentEncoding} {format} />
{/if}
{#if editableSchema}
<div class="p-2 my-1 text-xs border-solid border border-gray-400">

View File

@@ -10,11 +10,16 @@
export let required = false
export let displayType: boolean = true
export let labelClass: string = ''
export let prettify = false
</script>
<div class="inline-flex flex-row items-center truncated">
<span class={twMerge('font-semibold', labelClass)}>
{label.replace(/_/g, ' ').split(' ').map(capitalize).join(' ')}
{#if prettify}
{label.replace(/_/g, ' ').split(' ').map(capitalize).join(' ')}
{:else}
{label}
{/if}
</span>
<Required {required} class="!ml-0" />

View File

@@ -165,7 +165,7 @@
variant="border"
on:click={() => {
inputLibraryDrawer?.openDrawer()
}}>Input library</Button
}}>Past Runs/Input library</Button
>
{/if}

View File

@@ -143,6 +143,7 @@
<div>
{#if displayHeader}
<FieldHeader
prettify
{label}
{required}
{type}

View File

@@ -132,7 +132,14 @@
{#if !runnable.schema.properties || Object.keys(runnable.schema.properties).length === 0}
<div class="text-sm p-4">No arguments</div>
{:else}
<SchemaForm {noVariablePicker} {autofocus} schema={runnable.schema} bind:isValid bind:args />
<SchemaForm
prettifyHeader
{noVariablePicker}
{autofocus}
schema={runnable.schema}
bind:isValid
bind:args
/>
{/if}
{:else}
<div class="text-xs text-gray-600">No schema</div>
@@ -143,16 +150,16 @@
<div class="flex flex-col gap-4 mt-2 border p-2">
<div class="flex flex-col gap-2">
{#if SCRIPT_VIEW_SHOW_SCHEDULE_RUN_LATER}
<div class="flex">
<Button
color="light"
size="sm"
endIcon={{ icon: viewOptions ? faChevronUp : faChevronDown }}
on:click={() => (viewOptions = !viewOptions)}
>
Schedule to run later
</Button>
</div>
<div class="flex">
<Button
color="light"
size="sm"
endIcon={{ icon: viewOptions ? faChevronUp : faChevronDown }}
on:click={() => (viewOptions = !viewOptions)}
>
Schedule to run later
</Button>
</div>
{/if}
{#if viewOptions}
<div transition:slide|local class="mt-6">
@@ -226,16 +233,16 @@
<div>
<div class="my-20" />
{#if SCRIPT_VIEW_SHOW_RUN_FROM_CLI}
<div class="flex">
<Button
color="light"
size="xs"
endIcon={{ icon: viewCliOptions ? faChevronUp : faChevronDown }}
on:click={() => (viewCliOptions = !viewCliOptions)}
>
Run it from the CLI
</Button>
</div>
<div class="flex">
<Button
color="light"
size="xs"
endIcon={{ icon: viewCliOptions ? faChevronUp : faChevronDown }}
on:click={() => (viewCliOptions = !viewCliOptions)}
>
Run it from the CLI
</Button>
</div>
{/if}
{#if viewCliOptions}
<div transition:slide|local class="mt-2 px-4 pt-2">

View File

@@ -24,6 +24,7 @@
export let noVariablePicker = false
export let flexWrap = false
export let noDelete = false
export let prettifyHeader = false
let clazz: string = ''
export { clazz as class }
@@ -69,6 +70,7 @@
{#if typeof args == 'object' && schema?.properties[argName]}
{#if editableSchema}
<ArgInput
{prettifyHeader}
autofocus={i == 0 && autofocus}
label={argName}
bind:description={schema.properties[argName].description}
@@ -94,6 +96,7 @@
/>
{:else}
<ArgInput
{prettifyHeader}
autofocus={i == 0 && autofocus}
label={argName}
description={schema.properties[argName].description}