mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-10-30 08:16:49 +00:00
* feat (frontend): improve capture UI * show schema diff * add accept reject form * add diff for first node input * move update schema button * change modified properties display * propagate change through nested components * allow modification of nested object in schema * reject nested changes * clean logic * clean code * clean * nit * fix first strep input * fix argument preview * clean * restore indentation for nested objects * ignore undefined field in diff computation * fix run button disabled update * nit * fix update JSON * fix deletion of nested components * dark mode * clean * replace dropdown with sidebar * only check type for compatibility * add shadow * disbale dnd on edit * auto-scroll within schema * fix nested not dnd object diff viewer * fix captures drawer * open edit tab on add new arg * change button label when schema is the same * ajust padding * fix arg update * fix oneof display * propagate change event through nested schema * handle oneOf * fix preview arg sync * handle s3 object * fix arg sync * update schema input compatibility * clean compatible * accept empty array items * clean * increase of schema args gap * fix nested schema update * allow number and int compatibility * reset args when modifying schema * open fields on add with addPropertyV2 * feat(frontend): use new saved inputs picker * add object viewer to saved inputs row * Display alert info on select saved or historic input * Allow args edit when using saved/historic inputs * replace input library drawers with panels * add captures and saved inputs to arg picker * polish ui * nit * clean * add json arg editor * fix escape for deselect input * bind schema form valid * nit * handle big payloads * nit * nit * validity check disabled in json view * improve infinit list request * fix json schema inferrence * nit * nit * nit * nit * fix tipo * handle large captures * fix cancel button shift * use sideTabBar has a trigger * nit * fix everything * fix --------- Co-authored-by: Ruben Fiszel <ruben@windmill.dev>
71 lines
1.7 KiB
Svelte
71 lines
1.7 KiB
Svelte
<script lang="ts">
|
|
import SimpleEditor from '$lib/components/SimpleEditor.svelte'
|
|
import { createEventDispatcher } from 'svelte'
|
|
import { clickOutside } from '$lib/utils'
|
|
|
|
const dispatch = createEventDispatcher()
|
|
|
|
export let updateOnBlur = true
|
|
export let placeholder =
|
|
'Write a JSON payload. The input schema will be inferred.<br/><br/>Example:<br/><br/>{<br/> "foo": "12"<br/>}'
|
|
|
|
let pendingJson = ''
|
|
let simpleEditor: SimpleEditor | undefined = undefined
|
|
|
|
function updatePayloadFromJson(jsonInput: string) {
|
|
if (jsonInput === undefined || jsonInput === null || jsonInput.trim() === '') {
|
|
dispatch('select', undefined)
|
|
return
|
|
}
|
|
try {
|
|
const parsed = JSON.parse(jsonInput)
|
|
dispatch('select', parsed)
|
|
} catch (error) {
|
|
dispatch('select', undefined)
|
|
}
|
|
}
|
|
|
|
export function setCode(code: string) {
|
|
simpleEditor?.setCode(code)
|
|
}
|
|
|
|
async function getPropPickerElements(): Promise<HTMLElement[]> {
|
|
const elements = document.querySelectorAll('[data-schema-picker], [data-schema-picker] *')
|
|
return elements ? (Array.from(elements) as HTMLElement[]) : []
|
|
}
|
|
</script>
|
|
|
|
<div
|
|
class="h-full"
|
|
use:clickOutside={{ capture: false, exclude: getPropPickerElements }}
|
|
on:click_outside={() => {
|
|
if (updateOnBlur) {
|
|
updatePayloadFromJson('')
|
|
}
|
|
}}
|
|
>
|
|
<SimpleEditor
|
|
bind:this={simpleEditor}
|
|
on:focus={() => {
|
|
if (updateOnBlur) {
|
|
dispatch('focus')
|
|
updatePayloadFromJson(pendingJson)
|
|
}
|
|
}}
|
|
on:blur={async () => {
|
|
if (updateOnBlur) {
|
|
dispatch('blur')
|
|
}
|
|
}}
|
|
on:change={(e) => {
|
|
if (e.detail?.code !== undefined) {
|
|
updatePayloadFromJson(e.detail.code)
|
|
}
|
|
}}
|
|
bind:code={pendingJson}
|
|
lang="json"
|
|
class="h-full"
|
|
{placeholder}
|
|
/>
|
|
</div>
|