Updating key value store to allow adding an activity toggle.

This commit is contained in:
mike12345567 2021-12-02 11:53:51 +00:00
parent df64f58626
commit 81a643e6da
3 changed files with 31 additions and 5 deletions

View File

@ -25,7 +25,9 @@
class="spectrum-Switch-input" class="spectrum-Switch-input"
/> />
<span class="spectrum-Switch-switch" /> <span class="spectrum-Switch-switch" />
<label class="spectrum-Switch-label" for={id}>{text}</label> {#if text}
<label class="spectrum-Switch-label" for={id}>{text}</label>
{/if}
</div> </div>
<style> <style>

View File

@ -1,5 +1,5 @@
<script> <script>
import { Icon, ActionButton, Input } from "@budibase/bbui" import { Icon, ActionButton, Input, Label, Toggle } from "@budibase/bbui"
import { createEventDispatcher } from "svelte" import { createEventDispatcher } from "svelte"
import { lowercase } from "helpers" import { lowercase } from "helpers"
@ -10,6 +10,8 @@
export let readOnly export let readOnly
export let noAddButton export let noAddButton
export let name export let name
export let headings = false
export let activity = false
let fields = Object.entries(object).map(([name, value]) => ({ name, value })) let fields = Object.entries(object).map(([name, value]) => ({ name, value }))
@ -36,10 +38,22 @@
<!-- 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. -->
{#if Object.keys(object || {}).length > 0} {#if Object.keys(object || {}).length > 0}
<div class="container" class:readOnly> {#if headings}
<div class="container" class:container-active={activity}>
<Label>Key</Label>
<Label>Value</Label>
{#if activity}
<Label>Active</Label>
{/if}
</div>
{/if}
<div class="container" class:container-active={activity} class:readOnly>
{#each fields as field, idx} {#each fields as field, idx}
<Input placeholder="Key" bind:value={field.name} on:change={changed} /> <Input placeholder="Key" bind:value={field.name} on:change={changed} />
<Input placeholder="Value" bind:value={field.value} on:change={changed} /> <Input placeholder="Value" bind:value={field.value} on:change={changed} />
{#if activity}
<Toggle />
{/if}
{#if !readOnly} {#if !readOnly}
<Icon hoverable name="Close" on:click={() => deleteEntry(idx)} /> <Icon hoverable name="Close" on:click={() => deleteEntry(idx)} />
{/if} {/if}
@ -62,4 +76,7 @@
align-items: center; align-items: center;
margin-bottom: var(--spacing-m); margin-bottom: var(--spacing-m);
} }
.container-active {
grid-template-columns: 1fr 1fr 50px 20px;
}
</style> </style>

View File

@ -136,9 +136,16 @@
</div> </div>
<Tabs selected="Params"> <Tabs selected="Params">
<Tab title="Params"> <Tab title="Params">
<KeyValueBuilder bind:object={breakQs} name="param" /> <KeyValueBuilder bind:object={breakQs} name="param" headings />
</Tab>
<Tab title="Headers">
<KeyValueBuilder
bind:object={query.fields.headers}
name="header"
headings
activity
/>
</Tab> </Tab>
<Tab title="Headers" />
<Tab title="Body" /> <Tab title="Body" />
<Tab title="Transformer"> <Tab title="Transformer">
<Layout noPadding> <Layout noPadding>