1
0
Fork 0
mirror of synced 2024-07-01 12:30:41 +12:00

Add confirmation params for some actions

This commit is contained in:
Andrew Kingston 2021-06-21 09:58:24 +01:00
parent 2003c69698
commit 0ef31accb8
6 changed files with 108 additions and 48 deletions

View file

@ -1,5 +1,5 @@
<script> <script>
import { Select, Label } from "@budibase/bbui" import { Select, Label, Checkbox, Input } from "@budibase/bbui"
import { store, currentAsset } from "builderStore" import { store, currentAsset } from "builderStore"
import { tables } from "stores/backend" import { tables } from "stores/backend"
import { getBindableProperties } from "builderStore/dataBinding" import { getBindableProperties } from "builderStore/dataBinding"
@ -35,6 +35,17 @@
value={parameters.revId} value={parameters.revId}
on:change={value => (parameters.revId = value.detail)} on:change={value => (parameters.revId = value.detail)}
/> />
<Label small />
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
{#if parameters.confirm}
<Label small>Confirm text</Label>
<Input
placeholder="Are you sure you want to delete this row?"
bind:value={parameters.confirmText}
/>
{/if}
</div> </div>
<style> <style>
@ -42,8 +53,8 @@
display: grid; display: grid;
column-gap: var(--spacing-l); column-gap: var(--spacing-l);
row-gap: var(--spacing-s); row-gap: var(--spacing-s);
grid-template-columns: auto 1fr; grid-template-columns: 60px 1fr;
align-items: baseline; align-items: center;
max-width: 800px; max-width: 800px;
margin: 0 auto; margin: 0 auto;
} }

View file

@ -1,5 +1,5 @@
<script> <script>
import { Select, Layout } from "@budibase/bbui" import { Select, Layout, Input, Checkbox } from "@budibase/bbui"
import { store, currentAsset } from "builderStore" import { store, currentAsset } from "builderStore"
import { datasources, integrations, queries } from "stores/backend" import { datasources, integrations, queries } from "stores/backend"
import { getBindableProperties } from "builderStore/dataBinding" import { getBindableProperties } from "builderStore/dataBinding"
@ -25,7 +25,7 @@
} }
</script> </script>
<Layout> <Layout gap="XS">
<Select <Select
label="Datasource" label="Datasource"
bind:value={parameters.datasourceId} bind:value={parameters.datasourceId}
@ -44,22 +44,34 @@
getOptionLabel={query => query.name} getOptionLabel={query => query.name}
getOptionValue={query => query._id} getOptionValue={query => query._id}
/> />
{/if}
{#if query?.parameters?.length > 0} {#if parameters.queryId}
<div> <Checkbox text="Require confirmation" bind:value={parameters.confirm} />
<ParameterBuilder
bind:customParams={parameters.queryParams} {#if parameters.confirm}
parameters={query.parameters} <Input
bindings={bindableProperties} label="Confirm text"
/> placeholder="Are you sure you want to execute this query?"
<IntegrationQueryEditor bind:value={parameters.confirmText}
height={200} />
{query} {/if}
schema={fetchQueryDefinition(query)}
editable={false} {#if query?.parameters?.length > 0}
{datasource} <div>
/> <ParameterBuilder
</div> bind:customParams={parameters.queryParams}
parameters={query.parameters}
bindings={bindableProperties}
/>
<IntegrationQueryEditor
height={200}
{query}
schema={fetchQueryDefinition(query)}
editable={false}
{datasource}
/>
</div>
{/if}
{/if}
{/if} {/if}
</Layout> </Layout>

View file

@ -79,7 +79,7 @@
on:click={() => removeField(field[0])} on:click={() => removeField(field[0])}
/> />
{/each} {/each}
<div> <div style="margin-top: 10px">
<Button icon="AddCircle" secondary on:click={addField}> <Button icon="AddCircle" secondary on:click={addField}>
Add Add
{fieldLabel} {fieldLabel}

View file

@ -1,5 +1,5 @@
<script> <script>
import { Select, Label, Body } from "@budibase/bbui" import { Select, Label, Body, Checkbox, Input } from "@budibase/bbui"
import { store, currentAsset } from "builderStore" import { store, currentAsset } from "builderStore"
import { tables } from "stores/backend" import { tables } from "stores/backend"
import { import {
@ -33,7 +33,8 @@
optional.<br /> optional.<br />
You can always add or override fields manually. You can always add or override fields manually.
</Body> </Body>
<div class="fields">
<div class="params">
<Label small>Data Source</Label> <Label small>Data Source</Label>
<Select <Select
bind:value={parameters.providerId} bind:value={parameters.providerId}
@ -51,37 +52,58 @@
getOptionValue={option => option._id} getOptionValue={option => option._id}
/> />
{#if parameters.tableId} <Label small />
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
{#if parameters.confirm}
<Label small>Confirm text</Label>
<Input
placeholder="Are you sure you want to save this row?"
bind:value={parameters.confirmText}
/>
{/if}
</div>
{#if parameters.tableId}
<div class="fields">
<SaveFields <SaveFields
parameterFields={parameters.fields} parameterFields={parameters.fields}
{schemaFields} {schemaFields}
on:change={onFieldsChanged} on:change={onFieldsChanged}
/> />
{/if} </div>
</div> {/if}
</div> </div>
<style> <style>
.root { .root {
width: 100%;
max-width: 800px; max-width: 800px;
margin: 0 auto; margin: 0 auto;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
gap: var(--spacing-xl);
} }
.root :global(p) { .root :global(p) {
line-height: 1.5; line-height: 1.5;
} }
.params {
display: grid;
column-gap: var(--spacing-l);
row-gap: var(--spacing-s);
grid-template-columns: 60px 1fr;
align-items: center;
}
.fields { .fields {
display: grid; display: grid;
column-gap: var(--spacing-l); column-gap: var(--spacing-l);
row-gap: var(--spacing-s); row-gap: var(--spacing-s);
grid-template-columns: auto 1fr auto 1fr auto; grid-template-columns: 60px 1fr auto 1fr auto;
align-items: center; align-items: center;
} }
.fields :global(> div:nth-child(2)),
.fields :global(> div:nth-child(4)) {
grid-column-start: 2;
grid-column-end: 6;
}
</style> </style>

View file

@ -1,5 +1,5 @@
<script> <script>
import { Select, Label, Input } from "@budibase/bbui" import { Select, Label, Input, Checkbox } from "@budibase/bbui"
import { automationStore } from "builderStore" import { automationStore } from "builderStore"
import SaveFields from "./SaveFields.svelte" import SaveFields from "./SaveFields.svelte"
@ -72,7 +72,7 @@
</div> </div>
</div> </div>
<div class="fields"> <div class="params">
<Label small>Automation</Label> <Label small>Automation</Label>
{#if automationStatus === AUTOMATION_STATUS.EXISTING} {#if automationStatus === AUTOMATION_STATUS.EXISTING}
@ -90,6 +90,19 @@
/> />
{/if} {/if}
<Label small />
<Checkbox text="Require confirmation" bind:value={parameters.confirm} />
{#if parameters.confirm}
<Label small>Confirm text</Label>
<Input
placeholder="Are you sure you want to trigger this automation?"
bind:value={parameters.confirmText}
/>
{/if}
</div>
<div class="fields">
{#key parameters.automationId} {#key parameters.automationId}
<SaveFields <SaveFields
schemaFields={selectedSchema} schemaFields={selectedSchema}
@ -107,16 +120,21 @@
margin: 0 auto; margin: 0 auto;
} }
.fields { .params {
display: grid; display: grid;
column-gap: var(--spacing-l); column-gap: var(--spacing-l);
row-gap: var(--spacing-s); row-gap: var(--spacing-s);
grid-template-columns: auto 1fr auto 1fr auto; grid-template-columns: 60px 1fr;
align-items: baseline; align-items: center;
} }
.fields :global(> div:nth-child(2)) { .fields {
grid-column: 2 / span 4; margin-top: var(--spacing-l);
display: grid;
column-gap: var(--spacing-l);
row-gap: var(--spacing-s);
grid-template-columns: 60px 1fr auto 1fr auto;
align-items: center;
} }
.radios, .radios,

View file

@ -24,15 +24,12 @@
<style> <style>
.root { .root {
display: flex; display: grid;
flex-direction: row; column-gap: var(--spacing-l);
row-gap: var(--spacing-s);
grid-template-columns: 60px 1fr;
align-items: center; align-items: center;
max-width: 800px; max-width: 800px;
margin: 0 auto; margin: 0 auto;
} }
.root :global(> div) {
flex: 1;
margin-left: var(--spacing-l);
}
</style> </style>