This commit is contained in:
Martin McKeaveney 2021-02-15 18:59:21 +00:00
parent 55f98e82d8
commit 5d5637571b
3 changed files with 15 additions and 17 deletions

View File

@ -23,8 +23,8 @@
<!-- Builds Objects with Key Value Pairs. Useful for building things like Request Headers. --> <!-- Builds Objects with Key Value Pairs. Useful for building things like Request Headers. -->
<div class="container"> <div class="container">
{#each fields as field, idx} {#each fields as field, idx}
<Input outline thin bind:value={field.name} /> <Input placeholder="Key" outline thin bind:value={field.name} />
<Input outline bind:value={field.value} /> <Input placeholder="Value" outline thin bind:value={field.value} />
<i class="ri-close-circle-fill" on:click={() => deleteEntry(idx)} /> <i class="ri-close-circle-fill" on:click={() => deleteEntry(idx)} />
{/each} {/each}
</div> </div>
@ -36,6 +36,7 @@
grid-template-columns: 1fr 1fr 20px; grid-template-columns: 1fr 1fr 20px;
grid-gap: var(--spacing-m); grid-gap: var(--spacing-m);
align-items: center; align-items: center;
margin-bottom: var(--spacing-m);
} }
.ri-close-circle-fill, .ri-close-circle-fill,

View File

@ -19,11 +19,6 @@
$: fieldKeys = Object.keys(fields) $: fieldKeys = Object.keys(fields)
$: schemaKeys = Object.keys(schema.fields) $: schemaKeys = Object.keys(schema.fields)
$: console.log({
fields,
schema
})
function updateCustomFields({ detail }) { function updateCustomFields({ detail }) {
fields.customData = detail.value fields.customData = detail.value
} }
@ -34,15 +29,19 @@
<div class="field"> <div class="field">
{#each schemaKeys as field} {#each schemaKeys as field}
{#if schema.fields[field]?.type === "object"} {#if schema.fields[field]?.type === "object"}
<Label extraSmall grey>{field}</Label> <div>
<KeyValueBuilder bind:object={fields[field]} /> <Label extraSmall grey>{field}</Label>
<KeyValueBuilder bind:object={fields[field]} />
</div>
{:else if schema.fields[field]?.type === "json"} {:else if schema.fields[field]?.type === "json"}
<Label extraSmall grey>{field}</Label> <div>
<Editor <Label extraSmall grey>{field}</Label>
mode="json" <Editor
on:change={({ detail }) => fields[field] = detail.value} mode="json"
readOnly={!editable} on:change={({ detail }) => fields[field] = detail.value}
value={fields[field]} /> readOnly={!editable}
value={fields[field]} />
</div>
{:else} {:else}
<Input <Input
label={field} label={field}

View File

@ -53,8 +53,6 @@ router.use(async (ctx, next) => {
router.get("/health", ctx => (ctx.status = 200)) router.get("/health", ctx => (ctx.status = 200))
router.post("/yeet", ctx => (ctx.body = ctx.request.body))
router.use(authRoutes.routes()) router.use(authRoutes.routes())
router.use(authRoutes.allowedMethods()) router.use(authRoutes.allowedMethods())