Updating key value in queries to be a bit more clear.

This commit is contained in:
mike12345567 2021-12-01 13:31:40 +00:00
parent 4a0ce14f04
commit bfd8007dfa
4 changed files with 11 additions and 2 deletions

View File

@ -1,6 +1,7 @@
<script>
import { Icon, ActionButton, Input } from "@budibase/bbui"
import { createEventDispatcher } from "svelte"
import { lowercase } from "helpers"
let dispatch = createEventDispatcher()
@ -8,6 +9,7 @@
export let object = defaults || {}
export let readOnly
export let noAddButton
export let name
let fields = Object.entries(object).map(([name, value]) => ({ name, value }))
@ -47,7 +49,7 @@
{#if !readOnly && !noAddButton}
<div>
<ActionButton icon="Add" secondary thin outline on:click={addEntry}
>Add</ActionButton
>Add{name ? ` ${lowercase(name)}` : ""}</ActionButton
>
</div>
{/if}

View File

@ -30,7 +30,11 @@
{#each schemaKeys as field}
{#if schema.fields[field]?.type === "object"}
<Label small>{getDisplayName(field)}</Label>
<KeyValueBuilder readOnly={!editable} bind:object={fields[field]} />
<KeyValueBuilder
name={getDisplayName(field)}
readOnly={!editable}
bind:object={fields[field]}
/>
{:else if schema.fields[field]?.type === "json"}
<div>
<Label extraSmall grey>{getDisplayName(field)}</Label>

View File

@ -19,6 +19,8 @@ export const pipe = (arg, funcs) => flow(funcs)(arg)
export const capitalise = s => s.substring(0, 1).toUpperCase() + s.substring(1)
export const lowercase = s => s.substring(0, 1).toLowerCase() + s.substring(1)
export const get_name = s => (!s ? "" : last(s.split("/")))
export const get_capitalised_name = name => pipe(name, [get_name, capitalise])

View File

@ -6,4 +6,5 @@ export {
capitalise,
get_name,
get_capitalised_name,
lowercase,
} from "./helpers"