mirror of
https://github.com/windmill-labs/windmill.git
synced 2026-08-21 08:02:26 +00:00
fix schemaeditor
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
<script lang="ts">
|
||||
import type { Schema, SchemaProperty } from '$lib/common'
|
||||
import { emptySchema, sendUserToast } from '$lib/utils'
|
||||
import { emptySchema, emptyString, sendUserToast } from '$lib/utils'
|
||||
import { faPen, faPlus, faTrash } from '@fortawesome/free-solid-svg-icons'
|
||||
import { Button } from './common'
|
||||
import { createEventDispatcher } from 'svelte'
|
||||
@@ -146,6 +146,7 @@
|
||||
schema.properties = Object.fromEntries(entries)
|
||||
}
|
||||
let isAnimated = false
|
||||
let error = ''
|
||||
</script>
|
||||
|
||||
<div class="flex flex-col">
|
||||
@@ -254,13 +255,17 @@
|
||||
{/if}
|
||||
</div>
|
||||
{:else}
|
||||
<div class="border rounded mt-4 p-2">
|
||||
{#if !emptyString(error)}<span class="text-red-400">{error}</span>{:else}<div
|
||||
class="py-6"
|
||||
/>{/if}
|
||||
<div class="border rounded p-2">
|
||||
<SimpleEditor
|
||||
on:change={() => {
|
||||
try {
|
||||
schema = JSON.parse(schemaString)
|
||||
error = ''
|
||||
} catch (err) {
|
||||
sendUserToast(err.message, true)
|
||||
error = err.message
|
||||
}
|
||||
}}
|
||||
bind:code={schemaString}
|
||||
|
||||
@@ -115,8 +115,8 @@
|
||||
timeoutModel && clearTimeout(timeoutModel)
|
||||
timeoutModel = setTimeout(() => {
|
||||
code = getCode()
|
||||
}, 500)
|
||||
dispatch('change')
|
||||
dispatch('change')
|
||||
}, 200)
|
||||
})
|
||||
|
||||
if (autoHeight) {
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
description: newResourceType.description
|
||||
}
|
||||
})
|
||||
resourceTypeViewer.closeDrawer?.()
|
||||
resourceTypeDrawer.closeDrawer?.()
|
||||
loadResourceTypes()
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user