Merge branch 'master' into bug/budi-7008-i-was-able-to-send-two-invitations-to-the-same-user-email-2
This commit is contained in:
commit
f2406889df
|
@ -1,5 +1,5 @@
|
||||||
{
|
{
|
||||||
"version": "2.13.7",
|
"version": "2.13.9",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"packages": [
|
"packages": [
|
||||||
"packages/*"
|
"packages/*"
|
||||||
|
|
|
@ -10,6 +10,7 @@ import {
|
||||||
DatabaseDeleteIndexOpts,
|
DatabaseDeleteIndexOpts,
|
||||||
Document,
|
Document,
|
||||||
isDocument,
|
isDocument,
|
||||||
|
RowResponse,
|
||||||
} from "@budibase/types"
|
} from "@budibase/types"
|
||||||
import { getCouchInfo } from "./connections"
|
import { getCouchInfo } from "./connections"
|
||||||
import { directCouchUrlCall } from "./utils"
|
import { directCouchUrlCall } from "./utils"
|
||||||
|
@ -127,12 +128,19 @@ export class DatabaseImpl implements Database {
|
||||||
keys: ids,
|
keys: ids,
|
||||||
include_docs: true,
|
include_docs: true,
|
||||||
})
|
})
|
||||||
const NOT_FOUND = "not_found"
|
const rowUnavailable = (row: RowResponse<T>) => {
|
||||||
const rows = response.rows.filter(row => row.error !== NOT_FOUND)
|
// row is deleted - key lookup can return this
|
||||||
|
if (row.doc == null || ("deleted" in row.value && row.value.deleted)) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return row.error === "not_found"
|
||||||
|
}
|
||||||
|
|
||||||
|
const rows = response.rows.filter(row => !rowUnavailable(row))
|
||||||
const someMissing = rows.length !== response.rows.length
|
const someMissing = rows.length !== response.rows.length
|
||||||
// some were filtered out - means some missing
|
// some were filtered out - means some missing
|
||||||
if (!opts?.allowMissing && someMissing) {
|
if (!opts?.allowMissing && someMissing) {
|
||||||
const missing = response.rows.filter(row => row.error === NOT_FOUND)
|
const missing = response.rows.filter(row => rowUnavailable(row))
|
||||||
const missingIds = missing.map(row => row.key).join(", ")
|
const missingIds = missing.map(row => row.key).join(", ")
|
||||||
throw new Error(`Unable to get documents: ${missingIds}`)
|
throw new Error(`Unable to get documents: ${missingIds}`)
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,7 +28,6 @@ const DEFAULT_SELECT_DB = SelectableDatabase.DEFAULT
|
||||||
// for testing just generate the client once
|
// for testing just generate the client once
|
||||||
let CLOSED = false
|
let CLOSED = false
|
||||||
let CLIENTS: { [key: number]: any } = {}
|
let CLIENTS: { [key: number]: any } = {}
|
||||||
0
|
|
||||||
let CONNECTED = false
|
let CONNECTED = false
|
||||||
|
|
||||||
// mock redis always connected
|
// mock redis always connected
|
||||||
|
|
|
@ -11,6 +11,7 @@
|
||||||
export let componentBindings
|
export let componentBindings
|
||||||
export let bindings
|
export let bindings
|
||||||
export let parseSettings
|
export let parseSettings
|
||||||
|
export let disabled
|
||||||
|
|
||||||
const draggable = getContext("draggable")
|
const draggable = getContext("draggable")
|
||||||
const dispatch = createEventDispatcher()
|
const dispatch = createEventDispatcher()
|
||||||
|
|
|
@ -1,26 +0,0 @@
|
||||||
<script>
|
|
||||||
import { DrawerContent, Drawer, Button, Icon } from "@budibase/bbui"
|
|
||||||
import ValidationDrawer from "components/design/settings/controls/ValidationEditor/ValidationDrawer.svelte"
|
|
||||||
export let column
|
|
||||||
export let type
|
|
||||||
|
|
||||||
let drawer
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<Icon name="Settings" hoverable size="S" on:click={drawer.show} />
|
|
||||||
<Drawer bind:this={drawer} title="Field Validation">
|
|
||||||
<svelte:fragment slot="description">
|
|
||||||
"{column.name}" field validation
|
|
||||||
</svelte:fragment>
|
|
||||||
<Button cta slot="buttons" on:click={drawer.hide}>Save</Button>
|
|
||||||
<DrawerContent slot="body">
|
|
||||||
<div class="container">
|
|
||||||
<ValidationDrawer
|
|
||||||
slot="body"
|
|
||||||
bind:rules={column.validation}
|
|
||||||
fieldName={column.name}
|
|
||||||
{type}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
</DrawerContent>
|
|
||||||
</Drawer>
|
|
|
@ -1,202 +0,0 @@
|
||||||
<script>
|
|
||||||
import {
|
|
||||||
Button,
|
|
||||||
Icon,
|
|
||||||
DrawerContent,
|
|
||||||
Layout,
|
|
||||||
Select,
|
|
||||||
Label,
|
|
||||||
Body,
|
|
||||||
Input,
|
|
||||||
} from "@budibase/bbui"
|
|
||||||
import { flip } from "svelte/animate"
|
|
||||||
import { dndzone } from "svelte-dnd-action"
|
|
||||||
import { generate } from "shortid"
|
|
||||||
import CellEditor from "./CellEditor.svelte"
|
|
||||||
|
|
||||||
export let columns = []
|
|
||||||
export let options = []
|
|
||||||
export let schema = {}
|
|
||||||
|
|
||||||
const flipDurationMs = 150
|
|
||||||
let dragDisabled = true
|
|
||||||
|
|
||||||
$: unselectedColumns = getUnselectedColumns(options, columns)
|
|
||||||
$: columns.forEach(column => {
|
|
||||||
if (!column.id) {
|
|
||||||
column.id = generate()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
const getUnselectedColumns = (allColumns, selectedColumns) => {
|
|
||||||
let optionsObj = {}
|
|
||||||
allColumns.forEach(option => {
|
|
||||||
optionsObj[option] = true
|
|
||||||
})
|
|
||||||
selectedColumns?.forEach(column => {
|
|
||||||
delete optionsObj[column.name]
|
|
||||||
})
|
|
||||||
return Object.keys(optionsObj)
|
|
||||||
}
|
|
||||||
|
|
||||||
const getRemainingColumnOptions = selectedColumn => {
|
|
||||||
if (!selectedColumn || unselectedColumns.includes(selectedColumn)) {
|
|
||||||
return unselectedColumns
|
|
||||||
}
|
|
||||||
return [selectedColumn, ...unselectedColumns]
|
|
||||||
}
|
|
||||||
|
|
||||||
const addColumn = () => {
|
|
||||||
columns = [...columns, {}]
|
|
||||||
}
|
|
||||||
|
|
||||||
const removeColumn = id => {
|
|
||||||
columns = columns.filter(column => column.id !== id)
|
|
||||||
}
|
|
||||||
|
|
||||||
const updateColumnOrder = e => {
|
|
||||||
columns = e.detail.items
|
|
||||||
}
|
|
||||||
|
|
||||||
const handleFinalize = e => {
|
|
||||||
updateColumnOrder(e)
|
|
||||||
dragDisabled = true
|
|
||||||
}
|
|
||||||
|
|
||||||
const addAllColumns = () => {
|
|
||||||
let newColumns = columns || []
|
|
||||||
options.forEach(field => {
|
|
||||||
const fieldSchema = schema[field]
|
|
||||||
const hasCol = columns && columns.findIndex(x => x.name === field) !== -1
|
|
||||||
if (!fieldSchema?.autocolumn && !hasCol) {
|
|
||||||
newColumns.push({
|
|
||||||
name: field,
|
|
||||||
displayName: field,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
})
|
|
||||||
columns = newColumns
|
|
||||||
}
|
|
||||||
|
|
||||||
const reset = () => {
|
|
||||||
columns = []
|
|
||||||
}
|
|
||||||
|
|
||||||
const getFieldType = column => {
|
|
||||||
return `validation/${schema[column.name]?.type}`
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
|
|
||||||
<DrawerContent>
|
|
||||||
<div class="container">
|
|
||||||
<Layout noPadding gap="S">
|
|
||||||
{#if columns?.length}
|
|
||||||
<Layout noPadding gap="XS">
|
|
||||||
<div class="column">
|
|
||||||
<div />
|
|
||||||
<Label size="L">Column</Label>
|
|
||||||
<Label size="L">Label</Label>
|
|
||||||
<div />
|
|
||||||
<div />
|
|
||||||
</div>
|
|
||||||
<div
|
|
||||||
class="columns"
|
|
||||||
use:dndzone={{
|
|
||||||
items: columns,
|
|
||||||
flipDurationMs,
|
|
||||||
dropTargetStyle: { outline: "none" },
|
|
||||||
dragDisabled,
|
|
||||||
}}
|
|
||||||
on:finalize={handleFinalize}
|
|
||||||
on:consider={updateColumnOrder}
|
|
||||||
>
|
|
||||||
{#each columns as column (column.id)}
|
|
||||||
<div class="column" animate:flip={{ duration: flipDurationMs }}>
|
|
||||||
<div
|
|
||||||
class="handle"
|
|
||||||
aria-label="drag-handle"
|
|
||||||
style={dragDisabled ? "cursor: grab" : "cursor: grabbing"}
|
|
||||||
on:mousedown={() => (dragDisabled = false)}
|
|
||||||
>
|
|
||||||
<Icon name="DragHandle" size="XL" />
|
|
||||||
</div>
|
|
||||||
<Select
|
|
||||||
bind:value={column.name}
|
|
||||||
placeholder="Column"
|
|
||||||
options={getRemainingColumnOptions(column.name)}
|
|
||||||
on:change={e => (column.displayName = e.detail)}
|
|
||||||
/>
|
|
||||||
<Input bind:value={column.displayName} placeholder="Label" />
|
|
||||||
<CellEditor type={getFieldType(column)} bind:column />
|
|
||||||
<Icon
|
|
||||||
name="Close"
|
|
||||||
hoverable
|
|
||||||
size="S"
|
|
||||||
on:click={() => removeColumn(column.id)}
|
|
||||||
disabled={columns.length === 1}
|
|
||||||
/>
|
|
||||||
</div>
|
|
||||||
{/each}
|
|
||||||
</div>
|
|
||||||
</Layout>
|
|
||||||
{:else}
|
|
||||||
<div class="column">
|
|
||||||
<div class="wide">
|
|
||||||
<Body size="S">Add columns to be included in your form below.</Body>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{/if}
|
|
||||||
<div class="column">
|
|
||||||
<div class="buttons wide">
|
|
||||||
<Button secondary icon="Add" on:click={addColumn}>Add column</Button>
|
|
||||||
<Button secondary quiet on:click={addAllColumns}>
|
|
||||||
Add all columns
|
|
||||||
</Button>
|
|
||||||
{#if columns?.length}
|
|
||||||
<Button secondary quiet on:click={reset}>Reset columns</Button>
|
|
||||||
{/if}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</Layout>
|
|
||||||
</div>
|
|
||||||
</DrawerContent>
|
|
||||||
|
|
||||||
<style>
|
|
||||||
.container {
|
|
||||||
width: 100%;
|
|
||||||
max-width: 600px;
|
|
||||||
margin: 0 auto;
|
|
||||||
}
|
|
||||||
.columns {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: column;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: stretch;
|
|
||||||
gap: var(--spacing-m);
|
|
||||||
}
|
|
||||||
.column {
|
|
||||||
gap: var(--spacing-l);
|
|
||||||
display: grid;
|
|
||||||
grid-template-columns: 20px 1fr 1fr 16px 16px;
|
|
||||||
align-items: center;
|
|
||||||
border-radius: var(--border-radius-s);
|
|
||||||
transition: background-color ease-in-out 130ms;
|
|
||||||
}
|
|
||||||
.column:hover {
|
|
||||||
background-color: var(--spectrum-global-color-gray-100);
|
|
||||||
}
|
|
||||||
.handle {
|
|
||||||
display: grid;
|
|
||||||
place-items: center;
|
|
||||||
}
|
|
||||||
.wide {
|
|
||||||
grid-column: 2 / -1;
|
|
||||||
}
|
|
||||||
.buttons {
|
|
||||||
display: flex;
|
|
||||||
flex-direction: row;
|
|
||||||
justify-content: flex-start;
|
|
||||||
align-items: center;
|
|
||||||
gap: var(--spacing-m);
|
|
||||||
}
|
|
||||||
</style>
|
|
|
@ -1,4 +1,5 @@
|
||||||
<script>
|
<script>
|
||||||
|
import { Toggle } from "@budibase/bbui"
|
||||||
import { cloneDeep, isEqual } from "lodash/fp"
|
import { cloneDeep, isEqual } from "lodash/fp"
|
||||||
import {
|
import {
|
||||||
getDatasourceForProvider,
|
getDatasourceForProvider,
|
||||||
|
@ -25,6 +26,8 @@
|
||||||
let sanitisedValue
|
let sanitisedValue
|
||||||
let unconfigured
|
let unconfigured
|
||||||
|
|
||||||
|
let selectAll = true
|
||||||
|
|
||||||
$: bindings = getBindableProperties($selectedScreen, componentInstance._id)
|
$: bindings = getBindableProperties($selectedScreen, componentInstance._id)
|
||||||
$: actionType = componentInstance.actionType
|
$: actionType = componentInstance.actionType
|
||||||
let componentBindings = []
|
let componentBindings = []
|
||||||
|
@ -145,16 +148,31 @@
|
||||||
dispatch("change", getValidColumns(parentFieldsUpdated, options))
|
dispatch("change", getValidColumns(parentFieldsUpdated, options))
|
||||||
}
|
}
|
||||||
|
|
||||||
const listUpdated = e => {
|
const listUpdated = columns => {
|
||||||
const parsedColumns = getValidColumns(e.detail, options)
|
const parsedColumns = getValidColumns(columns, options)
|
||||||
dispatch("change", parsedColumns)
|
dispatch("change", parsedColumns)
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="field-configuration">
|
<div class="field-configuration">
|
||||||
|
<div class="toggle-all">
|
||||||
|
<span />
|
||||||
|
<Toggle
|
||||||
|
on:change={() => {
|
||||||
|
let update = fieldList.map(field => ({
|
||||||
|
...field,
|
||||||
|
active: selectAll,
|
||||||
|
}))
|
||||||
|
listUpdated(update)
|
||||||
|
}}
|
||||||
|
text=""
|
||||||
|
bind:value={selectAll}
|
||||||
|
thin
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
{#if fieldList?.length}
|
{#if fieldList?.length}
|
||||||
<DraggableList
|
<DraggableList
|
||||||
on:change={listUpdated}
|
on:change={e => listUpdated(e.detail)}
|
||||||
on:itemChange={processItemUpdate}
|
on:itemChange={processItemUpdate}
|
||||||
items={fieldList}
|
items={fieldList}
|
||||||
listItemKey={"_id"}
|
listItemKey={"_id"}
|
||||||
|
@ -171,4 +189,21 @@
|
||||||
.field-configuration :global(.spectrum-ActionButton) {
|
.field-configuration :global(.spectrum-ActionButton) {
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
|
.toggle-all {
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
}
|
||||||
|
.toggle-all :global(.spectrum-Switch) {
|
||||||
|
margin-right: 0px;
|
||||||
|
padding-right: calc(var(--spacing-s) - 1px);
|
||||||
|
min-height: unset;
|
||||||
|
}
|
||||||
|
.toggle-all :global(.spectrum-Switch .spectrum-Switch-switch) {
|
||||||
|
margin-top: 0px;
|
||||||
|
}
|
||||||
|
.toggle-all span {
|
||||||
|
color: var(--spectrum-global-color-gray-700);
|
||||||
|
font-size: 12px;
|
||||||
|
margin-left: calc(var(--spacing-s) - 1px);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
|
|
Loading…
Reference in New Issue