1
0
Fork 0
mirror of synced 2024-06-18 18:35:37 +12:00

merge with next

This commit is contained in:
Martin McKeaveney 2021-05-04 11:49:34 +01:00
parent 187b1c5670
commit bb2f4f485b
110 changed files with 239 additions and 508 deletions

View file

@ -4,11 +4,7 @@
function group(element) {
const buttons = Array.from(element.getElementsByTagName("button"))
<<<<<<< HEAD
buttons.forEach((button) => {
=======
buttons.forEach(button => {
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
button.classList.add("spectrum-ButtonGroup-item")
})
}

View file

@ -11,7 +11,7 @@
export let error = null
const dispatch = createEventDispatcher()
const onChange = (e) => {
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}

View file

@ -10,11 +10,11 @@
export let error = null
export let placeholder = "Choose an option"
export let options = []
export let getOptionLabel = (option) => extractProperty(option, "label")
export let getOptionValue = (option) => extractProperty(option, "value")
export let getOptionLabel = option => extractProperty(option, "label")
export let getOptionValue = option => extractProperty(option, "value")
const dispatch = createEventDispatcher()
const onChange = (e) => {
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}

View file

@ -10,7 +10,7 @@
export let disabled = false
const dispatch = createEventDispatcher()
const onChange = (event) => {
const onChange = event => {
dispatch("change", event.target.checked)
}
</script>

View file

@ -11,8 +11,8 @@
export let disabled = false
export let error = null
export let options = []
export let getOptionLabel = (option) => option
export let getOptionValue = (option) => option
export let getOptionLabel = option => option
export let getOptionValue = option => option
const dispatch = createEventDispatcher()
let open = false
@ -31,16 +31,16 @@
}
// Render the label if the selected option is found, otherwise raw value
const selected = options.find((option) => getOptionValue(option) === value)
const selected = options.find(option => getOptionValue(option) === value)
return selected ? getOptionLabel(selected) : value
}
const selectOption = (value) => {
const selectOption = value => {
dispatch("change", value)
open = false
}
const onChange = (e) => {
const onChange = e => {
selectOption(e.target.value)
}
</script>

View file

@ -27,12 +27,12 @@
wrap: true,
}
const handleChange = (event) => {
const handleChange = event => {
const [dates] = event.detail
dispatch("change", dates[0])
}
const clearDateOnBackspace = (event) => {
const clearDateOnBackspace = event => {
if (["Backspace", "Clear", "Delete"].includes(event.key)) {
dispatch("change", null)
flatpickr.close()
@ -53,7 +53,7 @@
// We need to blur both because the focus styling does not get properly
// applied.
const els = document.querySelectorAll(`#${flatpickrId} input`)
els.forEach((el) => el.blur())
els.forEach(el => el.blur())
}
</script>

View file

@ -28,7 +28,7 @@
"bmp",
"jfif",
]
const onChange = (event) => {
const onChange = event => {
dispatch("change", event.target.checked)
}
@ -42,7 +42,7 @@
async function processFileList(fileList) {
if (
handleFileTooLarge &&
Array.from(fileList).some((file) => file.size >= fileSizeLimit)
Array.from(fileList).some(file => file.size >= fileSizeLimit)
) {
handleFileTooLarge(fileSizeLimit, value)
return

View file

@ -8,14 +8,14 @@
export let disabled = false
export let error = null
export let options = []
export let getOptionLabel = (option) => option
export let getOptionValue = (option) => option
export let getOptionLabel = option => option
export let getOptionValue = option => option
const dispatch = createEventDispatcher()
$: selectedLookupMap = getSelectedLookupMap(value)
$: optionLookupMap = getOptionLookupMap(options)
$: fieldText = getFieldText(value, optionLookupMap, placeholder)
$: isOptionSelected = (optionValue) => selectedLookupMap[optionValue] === true
$: isOptionSelected = optionValue => selectedLookupMap[optionValue] === true
$: toggleOption = makeToggleOption(selectedLookupMap, value)
const getFieldText = (value, map, placeholder) => {
@ -23,17 +23,17 @@
if (!map) {
return ""
}
const vals = value.map((option) => map[option] || option).join(", ")
const vals = value.map(option => map[option] || option).join(", ")
return `(${value.length}) ${vals}`
} else {
return placeholder || "Choose some options"
}
}
const getSelectedLookupMap = (value) => {
const getSelectedLookupMap = value => {
let map = {}
if (value?.length) {
value.forEach((option) => {
value.forEach(option => {
if (option) {
map[option] = true
}
@ -42,7 +42,7 @@
return map
}
const getOptionLookupMap = (options) => {
const getOptionLookupMap = options => {
let map = null
if (options?.length) {
map = {}
@ -57,9 +57,9 @@
}
const makeToggleOption = (map, value) => {
return (optionValue) => {
return optionValue => {
if (map[optionValue]) {
const filtered = value.filter((option) => option !== optionValue)
const filtered = value.filter(option => option !== optionValue)
dispatch("change", filtered)
} else {
dispatch("change", [...value, optionValue])

View file

@ -15,13 +15,13 @@
export let options = []
export let isOptionSelected = () => false
export let onSelectOption = () => {}
export let getOptionLabel = (option) => option
export let getOptionValue = (option) => option
export let getOptionLabel = option => option
export let getOptionValue = option => option
export let open = false
export let readonly = false
const dispatch = createEventDispatcher()
const onClick = (e) => {
const onClick = e => {
dispatch("click")
if (readonly) {
return

View file

@ -8,11 +8,11 @@
export let options = []
export let error = null
export let disabled = false
export let getOptionLabel = (option) => option
export let getOptionValue = (option) => option
export let getOptionLabel = option => option
export let getOptionValue = option => option
const dispatch = createEventDispatcher()
const onChange = (e) => dispatch("change", e.target.value)
const onChange = e => dispatch("change", e.target.value)
</script>
<div class={`spectrum-FieldGroup spectrum-FieldGroup--${direction}`}>

View file

@ -10,7 +10,7 @@
const dispatch = createEventDispatcher()
let focus = false
const updateValue = (value) => {
const updateValue = value => {
dispatch("change", value)
}
@ -18,12 +18,12 @@
focus = true
}
const onBlur = (event) => {
const onBlur = event => {
focus = false
updateValue(event.target.value)
}
const updateValueOnEnter = (event) => {
const updateValueOnEnter = event => {
if (event.key === "Enter") {
updateValue(event.target.value)
}

View file

@ -8,8 +8,8 @@
export let disabled = false
export let error = null
export let options = []
export let getOptionLabel = (option) => option
export let getOptionValue = (option) => option
export let getOptionLabel = option => option
export let getOptionValue = option => option
export let readonly = false
const dispatch = createEventDispatcher()
@ -34,7 +34,7 @@
return index !== -1 ? getOptionLabel(options[index], index) : value
}
const selectOption = (value) => {
const selectOption = value => {
dispatch("change", value)
open = false
}
@ -53,10 +53,6 @@
{getOptionValue}
isPlaceholder={value == null || value === ""}
placeholderOption={placeholder}
<<<<<<< HEAD
isOptionSelected={(option) => option === value}
=======
isOptionSelected={option => option === value}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
onSelectOption={selectOption}
/>

View file

@ -9,7 +9,7 @@
export let disabled = false
const dispatch = createEventDispatcher()
const onChange = (event) => {
const onChange = event => {
dispatch("change", event.target.checked)
}
</script>

View file

@ -15,7 +15,7 @@
let focus = false
let textarea
const dispatch = createEventDispatcher()
const onChange = (event) => {
const onChange = event => {
dispatch("change", event.target.value)
focus = false
}
@ -29,7 +29,8 @@
>
{#if error}
<svg
class="spectrum-Icon spectrum-Icon--sizeM spectrum-Textfield-validationIcon"
class="spectrum-Icon spectrum-Icon--sizeM
spectrum-Textfield-validationIcon"
focusable="false"
aria-hidden="true"
>
@ -43,15 +44,10 @@
{disabled}
{id}
on:focus={() => (focus = true)}
<<<<<<< HEAD
on:blur={onChange}>{value || ""}</textarea
>
=======
on:blur={onChange}
>
{value || ""}
</textarea>
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
</div>
<style>

View file

@ -13,7 +13,7 @@
const dispatch = createEventDispatcher()
let focus = false
const updateValue = (value) => {
const updateValue = value => {
if (readonly) {
return
}
@ -31,7 +31,7 @@
focus = true
}
const onBlur = (event) => {
const onBlur = event => {
if (readonly) {
return
}
@ -39,7 +39,7 @@
updateValue(event.target.value)
}
const updateValueOnEnter = (event) => {
const updateValueOnEnter = event => {
if (readonly) {
return
}

View file

@ -12,7 +12,7 @@
export let placeholder = null
const dispatch = createEventDispatcher()
const onChange = (e) => {
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}

View file

@ -13,7 +13,7 @@
export let handleFileTooLarge = undefined
const dispatch = createEventDispatcher()
const onChange = (e) => {
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}

View file

@ -13,7 +13,7 @@
export let error = null
const dispatch = createEventDispatcher()
const onChange = (e) => {
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}

View file

@ -11,11 +11,11 @@
export let error = null
export let placeholder = null
export let options = []
export let getOptionLabel = (option) => option
export let getOptionValue = (option) => option
export let getOptionLabel = option => option
export let getOptionValue = option => option
const dispatch = createEventDispatcher()
const onChange = (e) => {
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}

View file

@ -9,11 +9,11 @@
export let labelPosition = "above"
export let error = null
export let options = []
export let getOptionLabel = (option) => extractProperty(option, "label")
export let getOptionValue = (option) => extractProperty(option, "value")
export let getOptionLabel = option => extractProperty(option, "label")
export let getOptionValue = option => extractProperty(option, "value")
const dispatch = createEventDispatcher()
const onChange = (e) => {
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}

View file

@ -10,7 +10,7 @@
export let disabled = false
const dispatch = createEventDispatcher()
const onChange = (e) => {
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}

View file

@ -11,11 +11,11 @@
export let error = null
export let placeholder = "Choose an option"
export let options = []
export let getOptionLabel = (option) => extractProperty(option, "label")
export let getOptionValue = (option) => extractProperty(option, "value")
export let getOptionLabel = option => extractProperty(option, "label")
export let getOptionValue = option => extractProperty(option, "value")
const dispatch = createEventDispatcher()
const onChange = (e) => {
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}

View file

@ -12,7 +12,7 @@
export let getCaretPosition = null
const dispatch = createEventDispatcher()
const onChange = (e) => {
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}

View file

@ -11,7 +11,7 @@
export let error = null
const dispatch = createEventDispatcher()
const onChange = (e) => {
const onChange = e => {
value = e.detail
dispatch("change", e.detail)
}

View file

@ -6,7 +6,7 @@
$: leftover = (value?.length ?? 0) - attachments.length
const imageExtensions = ["png", "tiff", "gif", "raw", "jpg", "jpeg"]
const isImage = (extension) => {
const isImage = extension => {
return imageExtensions.includes(extension?.toLowerCase())
}
</script>

View file

@ -22,7 +22,7 @@
longform: StringRenderer,
}
$: type = schema?.type ?? "string"
$: customRenderer = customRenderers?.find((x) => x.column === schema?.name)
$: customRenderer = customRenderers?.find(x => x.column === schema?.name)
$: renderer = customRenderer?.component ?? typeMap[type]
</script>

View file

@ -12,7 +12,7 @@
$: relationships = value?.slice(0, displayLimit) ?? []
$: leftover = (value?.length ?? 0) - relationships.length
const onClick = (e) => {
const onClick = e => {
e.stopPropagation()
dispatch("clickrelationship", {
tableId: row.tableId,

View file

@ -110,7 +110,7 @@
})
}
const sortBy = (fieldSchema) => {
const sortBy = fieldSchema => {
if (fieldSchema.sortable === false) {
return
}
@ -122,7 +122,7 @@
}
}
const getDisplayName = (schema) => {
const getDisplayName = schema => {
let name = schema?.displayName
if (schema && name === undefined) {
name = schema.name
@ -155,10 +155,10 @@
return nameA < nameB ? a : b
})
.concat(autoColumns)
.map((column) => column.name)
.map(column => column.name)
}
const onScroll = (event) => {
const onScroll = event => {
nextScrollTop = event.target.scrollTop
if (timeout) {
return
@ -169,7 +169,7 @@
}, 50)
}
const calculateFirstVisibleRow = (scrollTop) => {
const calculateFirstVisibleRow = scrollTop => {
return Math.max(Math.floor(scrollTop / (rowHeight + 1)) - rowPreload, 0)
}
@ -190,12 +190,12 @@
dispatch("editrow", row)
}
const toggleSelectRow = (row) => {
const toggleSelectRow = row => {
if (!allowSelectRows) {
return
}
if (selectedRows.includes(row)) {
selectedRows = selectedRows.filter((selectedRow) => selectedRow !== row)
selectedRows = selectedRows.filter(selectedRow => selectedRow !== row)
} else {
selectedRows = [...selectedRows, row]
}
@ -257,11 +257,7 @@
<svg
class="spectrum-Icon spectrum-Table-editIcon"
focusable="false"
<<<<<<< HEAD
on:click={(e) => editColumn(e, field)}
=======
on:click={e => editColumn(e, field)}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
>
<use xlink:href="#spectrum-icon-18-Edit" />
</svg>
@ -290,7 +286,7 @@
data={row}
selected={selectedRows.includes(row)}
onToggleSelection={() => toggleSelectRow(row)}
onEdit={(e) => editRow(e, row)}
onEdit={e => editRow(e, row)}
{allowSelectRows}
{allowEditRows}
/>

View file

@ -6,7 +6,7 @@
$: automation = $automationStore.selectedAutomation?.automation
function onSelect(block) {
automationStore.update((state) => {
automationStore.update(state => {
state.selectedBlock = block
return state
})

View file

@ -33,7 +33,7 @@
let webhookModal
$: selectedTab = selectedIndex == null ? null : tabs[selectedIndex].value
$: anchor = selectedIndex === -1 ? null : anchors[selectedIndex]
$: blocks = sortBy((entry) => entry[1].name)(
$: blocks = sortBy(entry => entry[1].name)(
Object.entries($automationStore.blockDefinitions[selectedTab] ?? {})
)

View file

@ -16,7 +16,7 @@
const tableId = inputs.tableId || inputs.row?.tableId
if (tableId) {
enrichedInputs.enriched.table = $tables.list.find(
(table) => table._id === tableId
table => table._id === tableId
)
}
return enrichedInputs
@ -30,8 +30,8 @@
// Extract schema paths for any input bindings
let inputPaths = formattedTagline.match(/{{\s*\S+\s*}}/g) || []
inputPaths = inputPaths.map((path) => path.replace(/[{}]/g, "").trim())
const schemaPaths = inputPaths.map((path) =>
inputPaths = inputPaths.map(path => path.replace(/[{}]/g, "").trim())
const schemaPaths = inputPaths.map(path =>
path.replace(/\./g, ".properties.")
)

View file

@ -10,7 +10,7 @@
$: selected = $automationStore.selectedBlock?.id === block.id
$: steps =
$automationStore.selectedAutomation?.automation?.definition?.steps ?? []
$: blockIdx = steps.findIndex((step) => step.id === block.id)
$: blockIdx = steps.findIndex(step => step.id === block.id)
$: allowDeleteTrigger = !steps.length
function deleteStep() {
@ -39,13 +39,7 @@
{#if block.type === "TRIGGER"}Trigger{:else}Step {blockIdx + 1}{/if}
</div>
{#if block.type !== "TRIGGER" || allowDeleteTrigger}
<<<<<<< HEAD
<div on:click|stopPropagation={deleteStep}>
<Icon name="Close" />
</div>
=======
<div on:click|stopPropagation={deleteStep}><Icon name="Close" /></div>
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
{/if}
</header>
<hr />

View file

@ -31,7 +31,7 @@
if (automation.trigger) {
allSteps = [automation.trigger, ...allSteps]
}
const blockIdx = allSteps.findIndex((step) => step.id === block.id)
const blockIdx = allSteps.findIndex(step => step.id === block.id)
// Extract all outputs from all previous steps as available bindings
let bindings = []
@ -71,58 +71,23 @@
panel={AutomationBindingPanel}
type={"email"}
value={block.inputs[key]}
<<<<<<< HEAD
on:change={(e) => (block.inputs[key] = e.detail)}
{bindings}
/>
{:else if value.customType === "query"}
<QuerySelector bind:value={block.inputs[key]} />
{:else if value.customType === "table"}
<TableSelector bind:value={block.inputs[key]} />
{:else if value.customType === "queryParams"}
<QueryParamSelector bind:value={block.inputs[key]} {bindings} />
=======
on:change={e => (block.inputs[key] = e.detail)}
{bindings}
/>
{:else if value.customType === "table"}
<TableSelector bind:value={block.inputs[key]} />
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
{:else if value.customType === "row"}
<RowSelector bind:value={block.inputs[key]} {bindings} />
{:else if value.customType === "webhookUrl"}
<WebhookDisplay value={block.inputs[key]} />
{:else if value.customType === "triggerSchema"}
<SchemaSetup bind:value={block.inputs[key]} />
<<<<<<< HEAD
{:else if value.customType === "code"}
<CodeEditorModal>
<pre>{JSON.stringify(bindings, null, 2)}</pre>
<Label small grey>
Note: The result of the very last statement of this script will be
returned and available as the "value" property in following
automation blocks.
</Label>
<Editor
mode="javascript"
on:change={(e) => {
block.inputs[key] = e.detail.value
}}
value={block.inputs[key]}
/>
</CodeEditorModal>
=======
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
{:else if value.type === "string" || value.type === "number"}
<DrawerBindableInput
panel={AutomationBindingPanel}
type={value.customType}
value={block.inputs[key]}
<<<<<<< HEAD
on:change={(e) => (block.inputs[key] = e.detail)}
=======
on:change={e => (block.inputs[key] = e.detail)}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
{bindings}
/>
{/if}

View file

@ -7,7 +7,7 @@
export let value
export let bindings
$: query = $queries.list.find((query) => query._id === value?.queryId)
$: query = $queries.list.find(query => query._id === value?.queryId)
$: parameters = query?.parameters ?? []
// Ensure any nullish queryId values get set to empty string so
@ -32,7 +32,7 @@
panel={AutomationBindingPanel}
extraThin
value={value[field.name]}
on:change={(e) => {
on:change={e => {
value[field.name] = e.detail
}}
label={field.name}

View file

@ -7,7 +7,7 @@
export let value
export let bindings
$: table = $tables.list.find((table) => table._id === value?.tableId)
$: table = $tables.list.find(table => table._id === value?.tableId)
$: schemaFields = Object.entries(table?.schema ?? {})
// Ensure any nullish tableId values get set to empty string so
@ -22,13 +22,8 @@
<Select
bind:value={value.tableId}
options={$tables.list}
<<<<<<< HEAD
getOptionLabel={(table) => table.name}
getOptionValue={(table) => table._id}
=======
getOptionLabel={table => table.name}
getOptionValue={table => table._id}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
{#if schemaFields.length}
@ -45,7 +40,7 @@
<DrawerBindableInput
panel={AutomationBindingPanel}
value={value[field]}
on:change={(e) => (value[field] = e.detail)}
on:change={e => (value[field] = e.detail)}
label={field}
type="string"
{bindings}

View file

@ -37,14 +37,14 @@
value = newValues
}
const fieldNameChanged = (originalName) => (e) => {
const fieldNameChanged = originalName => e => {
// reconstruct using fieldsArray, so field order is preserved
let entries = [...fieldsArray]
const newName = e.detail
if (newName) {
entries.find((f) => f.name === originalName).name = newName
entries.find(f => f.name === originalName).name = newName
} else {
entries = entries.filter((f) => f.name !== originalName)
entries = entries.filter(f => f.name !== originalName)
}
value = entries.reduce((newVals, current) => {
newVals[current.name] = current.type
@ -54,7 +54,9 @@
</script>
<div class="root">
<div class="add-field"><i class="ri-add-line" on:click={addField} /></div>
<div class="add-field">
<i class="ri-add-line" on:click={addField} />
</div>
<div class="spacer" />
{#each fieldsArray as field}
<div class="field">
@ -66,11 +68,7 @@
/>
<Select
value={field.type}
<<<<<<< HEAD
on:change={(e) => (value[field.name] = e.target.value)}
=======
on:change={e => (value[field.name] = e.target.value)}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
options={typeOptions}
/>
<i

View file

@ -8,11 +8,6 @@
<Select
bind:value
options={$tables.list}
<<<<<<< HEAD
getOptionLabel={(table) => table.name}
getOptionValue={(table) => table._id}
=======
getOptionLabel={table => table.name}
getOptionValue={table => table._id}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>

View file

@ -30,7 +30,7 @@
if ($views.selected?.name?.startsWith("all_")) {
loading = true
const loadingTableId = $tables.selected?._id
api.fetchDataForView($views.selected).then((rows) => {
api.fetchDataForView($views.selected).then(rows => {
loading = false
// If we started a slow request then quickly change table, sometimes

View file

@ -12,9 +12,9 @@
$: data = row?.[fieldName] ?? []
$: linkedTableId = data?.length ? data[0].tableId : null
$: linkedTable = $tables.list.find((table) => table._id === linkedTableId)
$: linkedTable = $tables.list.find(table => table._id === linkedTableId)
$: schema = linkedTable?.schema
$: table = $tables.list.find((table) => table._id === tableId)
$: table = $tables.list.find(table => table._id === tableId)
$: fetchData(tableId, rowId)
$: {
let rowLabel = row?.[table?.primaryDisplay]

View file

@ -28,9 +28,9 @@
async function fetchViewData(name, field, groupBy, calculation) {
const _tables = $tables.list
const allTableViews = _tables.map((table) => table.views)
const allTableViews = _tables.map(table => table.views)
const thisView = allTableViews.filter(
(views) => views != null && views[name] != null
views => views != null && views[name] != null
)[0]
// don't fetch view data if the view no longer exists
if (!thisView) {

View file

@ -3,7 +3,7 @@
export let value
$: role = $roles.find((role) => role._id === value)
$: role = $roles.find(role => role._id === value)
$: roleName = role?.name ?? "Unknown role"
</script>

View file

@ -25,7 +25,7 @@
$: fields =
viewTable &&
Object.keys(viewTable.schema).filter(
(field) =>
field =>
view.calculation === "count" ||
// don't want to perform calculations based on auto ID
(viewTable.schema[field].type === "number" &&
@ -50,13 +50,8 @@
<Select
bind:value={view.calculation}
options={CALCULATIONS}
<<<<<<< HEAD
getOptionLabel={(x) => x.name}
getOptionValue={(x) => x.key}
=======
getOptionLabel={x => x.name}
getOptionValue={x => x.key}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
{#if view.calculation}
<Label>Of</Label>

View file

@ -49,7 +49,7 @@
let deletion
$: tableOptions = $tables.list.filter(
(table) => table._id !== $tables.draft._id
table => table._id !== $tables.draft._id
)
$: required = !!field?.constraints?.presence || primaryDisplay
$: uneditable =
@ -60,7 +60,7 @@
!field.name ||
(field.type === LINK_TYPE && !field.tableId) ||
Object.keys($tables.draft?.schema ?? {}).some(
(key) => key !== originalName && key === field.name
key => key !== originalName && key === field.name
)
// used to select what different options can be displayed for column type
@ -154,7 +154,7 @@
if (!field || !field.tableId) {
return null
}
const linkTable = tableOptions.find((table) => table._id === field.tableId)
const linkTable = tableOptions.find(table => table._id === field.tableId)
if (!linkTable) {
return null
}
@ -197,13 +197,8 @@
...Object.values(fieldDefinitions),
{ name: "Auto Column", type: AUTO_COL },
]}
<<<<<<< HEAD
getOptionLabel={(field) => field.name}
getOptionValue={(field) => field.type}
=======
getOptionLabel={field => field.name}
getOptionValue={field => field.type}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
{#if canBeRequired || canBeDisplay}
@ -279,13 +274,8 @@
label="Table"
bind:value={field.tableId}
options={tableOptions}
<<<<<<< HEAD
getOptionLabel={(table) => table.name}
getOptionValue={(table) => table._id}
=======
getOptionLabel={table => table.name}
getOptionValue={table => table._id}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
{#if relationshipOptions && relationshipOptions.length > 0}
<RadioGroup
@ -293,13 +283,8 @@
label="Define the relationship"
bind:value={field.relationshipType}
options={relationshipOptions}
<<<<<<< HEAD
getOptionLabel={(option) => option.name}
getOptionValue={(option) => option.value}
=======
getOptionLabel={option => option.name}
getOptionValue={option => option.value}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
{/if}
<Input label={`Column name in other table`} bind:value={field.fieldName} />
@ -307,15 +292,10 @@
<Select
label="Auto Column Type"
value={field.subtype}
on:change={(e) => (field.subtype = e.detail)}
on:change={e => (field.subtype = e.detail)}
options={Object.entries(getAutoColumnInformation())}
<<<<<<< HEAD
getOptionLabel={(option) => option[1].name}
getOptionValue={(option) => option[0]}
=======
getOptionLabel={option => option[1].name}
getOptionValue={option => option[0]}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
{/if}

View file

@ -12,7 +12,7 @@
$: creating = row?._id == null
$: table = row.tableId
? $tables.list.find((table) => table._id === row?.tableId)
? $tables.list.find(table => table._id === row?.tableId)
: $tables.selected
$: tableSchema = Object.entries(table?.schema ?? {})

View file

@ -13,13 +13,13 @@
$: creating = row?._id == null
$: table = row.tableId
? $tables.list.find((table) => table._id === row?.tableId)
? $tables.list.find(table => table._id === row?.tableId)
: $tables.selected
$: tableSchema = getUserSchema(table)
$: customSchemaKeys = getCustomSchemaKeys(tableSchema)
$: if (!row.status) row.status = "active"
const getUserSchema = (table) => {
const getUserSchema = table => {
let schema = table?.schema ?? {}
if (schema.username) {
schema.username.name = "Username"
@ -27,7 +27,7 @@
return schema
}
const getCustomSchemaKeys = (schema) => {
const getCustomSchemaKeys = schema => {
let customSchema = { ...schema }
delete customSchema["email"]
delete customSchema["roleId"]
@ -55,7 +55,7 @@
)
if (rowResponse.errors) {
if (Array.isArray(rowResponse.errors)) {
errors = rowResponse.errors.map((error) => ({ message: error }))
errors = rowResponse.errors.map(error => ({ message: error }))
} else {
errors = Object.entries(rowResponse.errors)
.map(([key, error]) => ({ dataPath: key, message: error }))
@ -94,13 +94,8 @@
data-cy="roleId-select"
bind:value={row.roleId}
options={$roles}
<<<<<<< HEAD
getOptionLabel={(role) => role.name}
getOptionValue={(role) => role._id}
=======
getOptionLabel={role => role.name}
getOptionValue={role => role._id}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
<Select
label="Status"
@ -109,13 +104,8 @@
{ label: "Active", value: "active" },
{ label: "Inactive", value: "inactive" },
]}
<<<<<<< HEAD
getOptionLabel={(status) => status.label}
getOptionValue={(status) => status.value}
=======
getOptionLabel={status => status.label}
getOptionValue={status => status.value}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
{#each customSchemaKeys as [key, meta]}
{#if !meta.autocolumn}

View file

@ -10,7 +10,7 @@
let name
let field
$: views = $tables.list.flatMap((table) => Object.keys(table.views || {}))
$: views = $tables.list.flatMap(table => Object.keys(table.views || {}))
function saveView() {
if (views.includes(name)) {

View file

@ -11,7 +11,7 @@
let errors = []
let builtInRoles = ["Admin", "Power", "Basic", "Public"]
$: selectedRoleId = selectedRole._id
$: otherRoles = $roles.filter((role) => role._id !== selectedRoleId)
$: otherRoles = $roles.filter(role => role._id !== selectedRoleId)
$: isCreating = selectedRoleId == null || selectedRoleId === ""
const fetchBasePermissions = async () => {
@ -20,9 +20,9 @@
}
// Changes the selected role
const changeRole = (event) => {
const changeRole = event => {
const id = event?.detail
const role = $roles.find((role) => role._id === id)
const role = $roles.find(role => role._id === id)
if (role) {
selectedRole = {
...role,
@ -41,7 +41,7 @@
// Clean up empty strings
const keys = ["_id", "inherits", "permissionId"]
keys.forEach((key) => {
keys.forEach(key => {
if (selectedRole[key] === "") {
delete selectedRole[key]
}
@ -98,13 +98,8 @@
on:change={changeRole}
options={$roles}
placeholder="Create new role"
<<<<<<< HEAD
getOptionValue={(role) => role._id}
getOptionLabel={(role) => role.name}
=======
getOptionValue={role => role._id}
getOptionLabel={role => role.name}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
{#if selectedRole}
<Input
@ -116,26 +111,16 @@
label="Inherits Role"
bind:value={selectedRole.inherits}
options={otherRoles}
<<<<<<< HEAD
getOptionValue={(role) => role._id}
getOptionLabel={(role) => role.name}
=======
getOptionValue={role => role._id}
getOptionLabel={role => role.name}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
placeholder="None"
/>
<Select
label="Base Permissions"
bind:value={selectedRole.permissionId}
options={basePermissions}
<<<<<<< HEAD
getOptionValue={(x) => x._id}
getOptionLabel={(x) => x.name}
=======
getOptionValue={x => x._id}
getOptionLabel={x => x.name}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
placeholder="Choose permissions"
/>
{/if}

View file

@ -32,12 +32,7 @@
bind:value={exportFormat}
options={FORMATS}
placeholder={null}
<<<<<<< HEAD
getOptionLabel={(x) => x.name}
getOptionValue={(x) => x.key}
=======
getOptionLabel={x => x.name}
getOptionValue={x => x.key}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
</ModalContent>

View file

@ -10,7 +10,7 @@
$: fields =
viewTable &&
Object.entries(viewTable.schema)
.filter((entry) => entry[1].type !== FIELDS.LINK.type)
.filter(entry => entry[1].type !== FIELDS.LINK.type)
.map(([key]) => key)
function saveView() {

View file

@ -14,9 +14,7 @@
function checkValid(evt) {
const datasourceName = evt.target.value
if (
$datasources?.list.some(
(datasource) => datasource.name === datasourceName
)
$datasources?.list.some(datasource => datasource.name === datasourceName)
) {
error = `Datasource with name ${datasourceName} already exists. Please choose another name.`
return

View file

@ -18,7 +18,7 @@
let schema = {}
let fields = []
$: valid = !schema || fields.every((column) => schema[column].success)
$: valid = !schema || fields.every(column => schema[column].success)
$: dataImport = {
valid,
schema: buildTableSchema(schema),
@ -51,7 +51,7 @@
const parseResult = await response.json()
schema = parseResult && parseResult.schema
fields = Object.keys(schema || {}).filter(
(key) => schema[key].type !== "omit"
key => schema[key].type !== "omit"
)
// Check primary display is valid
@ -67,7 +67,7 @@
async function handleFile(evt) {
const fileArray = Array.from(evt.target.files)
if (fileArray.some((file) => file.size >= FILE_SIZE_LIMIT)) {
if (fileArray.some(file => file.size >= FILE_SIZE_LIMIT)) {
notifications.error(
`Files cannot exceed ${
FILE_SIZE_LIMIT / BYTES_IN_MB
@ -91,7 +91,7 @@
await validateCSV()
}
const handleTypeChange = (column) => (evt) => {
const handleTypeChange = column => evt => {
schema[column].type = evt.detail
validateCSV()
}
@ -128,13 +128,8 @@
on:change={handleTypeChange(columnName)}
options={typeOptions}
placeholder={null}
<<<<<<< HEAD
getOptionLabel={(option) => option.label}
getOptionValue={(option) => option.value}
=======
getOptionLabel={option => option.label}
getOptionValue={option => option.value}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
<span class="field-status" class:error={!schema[columnName].success}>
{schema[columnName].success ? "Success" : "Failure"}

View file

@ -18,7 +18,7 @@
ROW_LIST_TEMPLATE,
]
$: tableNames = $tables.list.map((table) => table.name)
$: tableNames = $tables.list.map(table => table.name)
let modal
let name
@ -66,8 +66,8 @@
// Create auto screens
if (createAutoscreens) {
const screens = screenTemplates($store, [table])
.filter((template) => defaultScreens.includes(template.id))
.map((template) => template.create())
.filter(template => defaultScreens.includes(template.id))
.map(template => template.create())
for (let screen of screens) {
// Record the table that created this screen so we can link it later
screen.autoTableId = table._id
@ -75,7 +75,7 @@
}
// Create autolink to newly created list screen
const listScreen = screens.find((screen) =>
const listScreen = screens.find(screen =>
screen.props._instanceName.endsWith("List")
)
await store.actions.components.links.save(

View file

@ -8,12 +8,12 @@
export let linkedRows = []
let rows = []
let linkedIds = (linkedRows || [])?.map((row) => row?._id || row)
let linkedIds = (linkedRows || [])?.map(row => row?._id || row)
$: linkedRows = linkedIds
$: label = capitalise(schema.name)
$: linkedTableId = schema.tableId
$: linkedTable = $tables.list.find((table) => table._id === linkedTableId)
$: linkedTable = $tables.list.find(table => table._id === linkedTableId)
$: fetchRows(linkedTableId)
async function fetchRows(linkedTableId) {
@ -44,13 +44,8 @@
value={linkedIds?.[0]}
options={rows}
getOptionLabel={getPrettyName}
<<<<<<< HEAD
getOptionValue={(row) => row._id}
on:change={(e) => (linkedIds = e.detail ? [e.detail] : [])}
=======
getOptionValue={row => row._id}
on:change={e => (linkedIds = e.detail ? [e.detail] : [])}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
{label}
/>
{:else}
@ -59,10 +54,6 @@
{label}
options={rows}
getOptionLabel={getPrettyName}
<<<<<<< HEAD
getOptionValue={(row) => row._id}
=======
getOptionValue={row => row._id}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
{/if}

View file

@ -5,7 +5,7 @@
export let values
export let label
const inputChanged = (ev) => {
const inputChanged = ev => {
try {
values = ev.target.value.split("\n")
} catch (_) {

View file

@ -10,7 +10,7 @@
$: automations = $automationStore.automations
onMount(() => {
webhookUrls = automations.map((automation) => {
webhookUrls = automations.map(automation => {
const trigger = automation.definition.trigger
if (trigger?.stepId === "WEBHOOK" && trigger.inputs) {
return {

View file

@ -48,7 +48,7 @@
for (let incomingDeployment of incoming) {
if (incomingDeployment.status === DeploymentStatus.FAILURE) {
const currentDeployment = current.find(
(deployment) => deployment._id === incomingDeployment._id
deployment => deployment._id === incomingDeployment._id
)
// We have just been notified of an ongoing deployments failure
@ -100,7 +100,7 @@
<header>
<Heading>Deployment History</Heading>
<div class="deploy-div">
{#if deployments.some((deployment) => deployment.status === DeploymentStatus.SUCCESS)}
{#if deployments.some(deployment => deployment.status === DeploymentStatus.SUCCESS)}
<a target="_blank" href={deploymentUrl}> View Your Deployed App </a>
<Button primary on:click={() => modal.show()}>View webhooks</Button>
{/if}

View file

@ -13,7 +13,7 @@
const enrichStructure = (structure, definitions) => {
let enrichedStructure = []
structure.forEach((item) => {
structure.forEach(item => {
if (typeof item === "string") {
const def = definitions[`@budibase/standard-components/${item}`]
if (def) {
@ -33,7 +33,7 @@
return enrichedStructure
}
const onItemChosen = async (item) => {
const onItemChosen = async item => {
if (!item.isCategory) {
await store.actions.components.create(item.component)
}

View file

@ -11,18 +11,18 @@
export let level = 0
export let dragDropStore
const isScreenslot = (name) => name?.endsWith("screenslot")
const isScreenslot = name => name?.endsWith("screenslot")
const selectComponent = (component) => {
const selectComponent = component => {
store.actions.components.select(component)
}
const dragstart = (component) => (e) => {
const dragstart = component => e => {
e.dataTransfer.dropEffect = DropEffect.MOVE
dragDropStore.actions.dragstart(component)
}
const dragover = (component, index) => (e) => {
const dragover = (component, index) => e => {
const definition = store.actions.components.getDefinition(
component._component
)

View file

@ -17,7 +17,7 @@
let screenRoleId
// Filter all routes down to only those which match the current role
sortedPaths.forEach((path) => {
sortedPaths.forEach(path => {
const config = allRoutes[path]
Object.entries(config.subpaths).forEach(([subpath, pathConfig]) => {
Object.entries(pathConfig.screens).forEach(([roleId, screenId]) => {

View file

@ -25,7 +25,7 @@
}
}
const templateChanged = (newTemplateIndex) => {
const templateChanged = newTemplateIndex => {
if (newTemplateIndex === undefined) return
draftScreen = templates[newTemplateIndex].create()
if (draftScreen.props._instanceName) {
@ -75,13 +75,13 @@
const routeExists = (route, roleId) => {
return $allScreens.some(
(screen) =>
screen =>
screen.routing.route.toLowerCase() === route.toLowerCase() &&
screen.routing.roleId === roleId
)
}
const routeChanged = (event) => {
const routeChanged = event => {
if (!event.detail.startsWith("/")) {
route = "/" + event.detail
}
@ -92,14 +92,10 @@
<Select
label="Choose a Template"
bind:value={templateIndex}
on:change={(ev) => templateChanged(ev.detail)}
on:change={ev => templateChanged(ev.detail)}
options={templates}
placeholder={null}
<<<<<<< HEAD
getOptionLabel={(x) => x.name}
=======
getOptionLabel={x => x.name}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
getOptionValue={(x, idx) => idx}
/>
<Input label="Name" bind:value={name} />
@ -113,13 +109,8 @@
label="Access"
bind:value={roleId}
options={$roles}
<<<<<<< HEAD
getOptionLabel={(x) => x.name}
getOptionValue={(x) => x._id}
=======
getOptionLabel={x => x.name}
getOptionValue={x => x._id}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
<Toggle text="Create link in navigation bar" bind:value={createLink} />
</ModalContent>

View file

@ -1,7 +1,7 @@
<script>
export let categories = []
export let selectedCategory = {}
export let onClick = (category) => {}
export let onClick = category => {}
</script>
<div class="tabs">

View file

@ -65,11 +65,7 @@
<div class="custom-styles">
<TextArea
value={componentInstance._styles.custom}
<<<<<<< HEAD
on:change={(event) => onCustomStyleChanged(event.detail)}
=======
on:change={event => onCustomStyleChanged(event.detail)}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
placeholder="Enter some CSS..."
/>
</div>
@ -86,7 +82,7 @@
<div class="transitions">
<Select
value={componentInstance._transition}
on:change={(event) => onUpdateTransition(event.detail)}
on:change={event => onUpdateTransition(event.detail)}
name="transition"
label="Transition"
options={transitions}

View file

@ -30,7 +30,7 @@
function setAssetProps(name, value) {
const selectedAsset = get(currentAsset)
store.update((state) => {
store.update(state => {
if (
name === "_instanceName" &&
state.currentFrontEndType === FrontendTypes.SCREEN

View file

@ -31,7 +31,7 @@
}
const onChange = throttle(
(e) => {
e => {
dispatch("change", e.detail)
},
WAIT,

View file

@ -8,7 +8,7 @@
$: path = findComponentPath($currentAsset.props, $store.selectedComponentId)
$: providers = path.filter(
(component) =>
component =>
component._component === "@budibase/standard-components/dataprovider"
)
</script>
@ -17,11 +17,6 @@
{value}
on:change
options={providers}
<<<<<<< HEAD
getOptionLabel={(component) => component._instanceName}
getOptionValue={(component) => `{{ literal ${makePropSafe(component._id)} }}`}
=======
getOptionLabel={component => component._instanceName}
getOptionValue={component => `{{ literal ${makePropSafe(component._id)} }}`}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>

View file

@ -30,7 +30,7 @@
export let showAllQueries
$: text = value?.label ?? "Choose an option"
$: tables = $tablesStore.list.map((m) => ({
$: tables = $tablesStore.list.map(m => ({
label: m.name,
tableId: m._id,
type: "table",
@ -46,9 +46,9 @@
}, [])
$: queries = $queriesStore.list
.filter(
(query) => showAllQueries || query.queryVerb === "read" || query.readable
query => showAllQueries || query.queryVerb === "read" || query.readable
)
.map((query) => ({
.map(query => ({
label: query.name,
name: query.name,
tableId: query._id,
@ -61,15 +61,15 @@
$currentAsset,
$store.selectedComponentId
)
$: queryBindableProperties = bindableProperties.map((property) => ({
$: queryBindableProperties = bindableProperties.map(property => ({
...property,
category: property.type === "instance" ? "Component" : "Table",
label: property.readableBinding,
path: property.readableBinding,
}))
$: links = bindableProperties
.filter((x) => x.fieldSchema?.type === "link")
.map((property) => {
.filter(x => x.fieldSchema?.type === "link")
.map(property => {
return {
providerId: property.providerId,
label: property.readableBinding,
@ -89,7 +89,7 @@
}
function fetchQueryDefinition(query) {
const source = $datasources.list.find((ds) => ds._id === query.datasourceId)
const source = $datasources.list.find(ds => ds._id === query.datasourceId)
.source
return $integrations[source].query[query.queryVerb]
}
@ -121,11 +121,7 @@
{#if value.parameters.length > 0}
<ParameterBuilder
bind:customParams={value.queryParams}
<<<<<<< HEAD
parameters={queries.find((query) => query._id === value._id)
=======
parameters={queries.find(query => query._id === value._id)
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
.parameters}
bindings={queryBindableProperties}
/>
@ -135,11 +131,7 @@
query={value}
schema={fetchQueryDefinition(value)}
datasource={$datasources.list.find(
<<<<<<< HEAD
(ds) => ds._id === value.datasourceId
=======
ds => ds._id === value.datasourceId
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
)}
editable={false}
/>

View file

@ -16,13 +16,8 @@
<Select
bind:value={parameters.tableId}
options={tableOptions}
<<<<<<< HEAD
getOptionLabel={(table) => table.name}
getOptionValue={(table) => table._id}
=======
getOptionLabel={table => table.name}
getOptionValue={table => table._id}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
<Label small>Row ID</Label>
@ -30,11 +25,7 @@
{bindings}
title="Row ID to delete"
value={parameters.rowId}
<<<<<<< HEAD
on:change={(value) => (parameters.rowId = value.detail)}
=======
on:change={value => (parameters.rowId = value.detail)}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
<Label small>Row Rev</Label>
@ -42,11 +33,7 @@
{bindings}
title="Row rev to delete"
value={parameters.revId}
<<<<<<< HEAD
on:change={(value) => (parameters.revId = value.detail)}
=======
on:change={value => (parameters.revId = value.detail)}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
</div>

View file

@ -15,22 +15,14 @@
<DrawerBindableInput
title="Email"
value={parameters.email}
<<<<<<< HEAD
on:change={(value) => (parameters.email = value.detail)}
=======
on:change={value => (parameters.email = value.detail)}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
{bindings}
/>
<Label small>Password</Label>
<DrawerBindableInput
title="Password"
value={parameters.password}
<<<<<<< HEAD
on:change={(value) => (parameters.password = value.detail)}
=======
on:change={value => (parameters.password = value.detail)}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
{bindings}
/>
</div>

View file

@ -18,11 +18,7 @@
title="Destination URL"
placeholder="/screen"
value={parameters.url}
<<<<<<< HEAD
on:change={(value) => (parameters.url = value.detail)}
=======
on:change={value => (parameters.url = value.detail)}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
{bindings}
/>
</div>

View file

@ -15,8 +15,8 @@
: AUTOMATION_STATUS.NEW
$: automations = $automationStore.automations
.filter((a) => a.definition.trigger?.stepId === "APP")
.map((automation) => {
.filter(a => a.definition.trigger?.stepId === "APP")
.map(automation => {
const schema = Object.entries(
automation.definition.trigger.inputs.fields
).map(([name, type]) => ({ name, type }))
@ -29,11 +29,11 @@
})
$: hasAutomations = automations && automations.length > 0
$: selectedAutomation = automations?.find(
(a) => a._id === parameters?.automationId
a => a._id === parameters?.automationId
)
$: selectedSchema = selectedAutomation?.schema
const onFieldsChanged = (e) => {
const onFieldsChanged = e => {
parameters.fields = e.detail
}
@ -80,13 +80,8 @@
bind:value={parameters.automationId}
placeholder="Choose automation"
options={automations}
<<<<<<< HEAD
getOptionLabel={(x) => x.name}
getOptionValue={(x) => x._id}
=======
getOptionLabel={x => x.name}
getOptionValue={x => x._id}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
{:else}
<Input

View file

@ -17,13 +17,8 @@
<Select
bind:value={parameters.componentId}
options={actionProviders}
<<<<<<< HEAD
getOptionLabel={(x) => x._instanceName}
getOptionValue={(x) => x._id}
=======
getOptionLabel={x => x._instanceName}
getOptionValue={x => x._id}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>
</div>

View file

@ -32,11 +32,7 @@
return value
}
<<<<<<< HEAD
const onChange = (value) => {
=======
const onChange = value => {
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
boundValue = getValidValue(value.detail, options)
dispatch("change", boundValue)
}

View file

@ -6,7 +6,7 @@
export let isMultiSelect = false
export let value = []
export let initialValue = ""
export let onChange = (selected) => {}
export let onChange = selected => {}
onMount(() => {
if (!value && !!initialValue) {
@ -18,7 +18,7 @@
let val
if (isMultiSelect) {
if (value.includes(v)) {
let idx = value.findIndex((i) => i === v)
let idx = value.findIndex(i => i === v)
val = [...value].splice(idx, 1)
} else {
val = [...value, v]
@ -29,7 +29,7 @@
onChange(val)
}
const checkSelected = (val) =>
const checkSelected = val =>
isMultiSelect ? value.includes(val) : value === val
</script>

View file

@ -15,7 +15,7 @@
$: form = findClosestMatchingComponent(
$currentAsset.props,
componentInstance._id,
(component) => component._component === "@budibase/standard-components/form"
component => component._component === "@budibase/standard-components/form"
)
$: datasource = getDatasourceForProvider($currentAsset, form)
$: schema = getSchemaForDatasource(datasource, true).schema
@ -24,9 +24,9 @@
const getOptions = (schema, fieldType) => {
let entries = Object.entries(schema ?? {})
if (fieldType) {
entries = entries.filter((entry) => entry[1].type === fieldType)
entries = entries.filter(entry => entry[1].type === fieldType)
}
return entries.map((entry) => entry[0])
return entries.map(entry => entry[0])
}
</script>

View file

@ -58,7 +58,7 @@
function findIconByTerm(term) {
const r = new RegExp(`\^${term}`, "i")
return icons.filter((i) => r.test(i))
return icons.filter(i => r.test(i))
}
async function switchLetter(letter) {
@ -72,7 +72,7 @@
}
async function findIconOnPage() {
loading = true
const iconIdx = filteredIcons.findIndex((i) => i.value === value)
const iconIdx = filteredIcons.findIndex(i => i.value === value)
if (iconIdx !== -1) {
currentPage = Math.ceil(iconIdx / maxIconsPerPage)
}

View file

@ -9,11 +9,6 @@
bind:value
on:change
options={$store.layouts}
<<<<<<< HEAD
getOptionLabel={(layout) => layout.name}
getOptionValue={(layout) => layout._id}
=======
getOptionLabel={layout => layout.name}
getOptionValue={layout => layout._id}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>

View file

@ -23,10 +23,10 @@
if (!Array.isArray(selectedOptions)) {
selectedOptions = []
}
return selectedOptions.filter((val) => allOptions.indexOf(val) !== -1)
return selectedOptions.filter(val => allOptions.indexOf(val) !== -1)
}
const setValue = (value) => {
const setValue = value => {
boundValue = getValidOptions(value.detail, options)
dispatch("change", boundValue)
}

View file

@ -10,13 +10,13 @@
export let open = false
$: style = componentInstance["_styles"][styleCategory] || {}
$: changed = properties.some((prop) => hasPropChanged(style, prop))
$: changed = properties.some(prop => hasPropChanged(style, prop))
const hasPropChanged = (style, prop) => {
return style[prop.key] != null && style[prop.key] !== ""
}
const getControlProps = (props) => {
const getControlProps = props => {
const { label, key, control, ...otherProps } = props || {}
return otherProps || {}
}
@ -32,11 +32,7 @@
control={prop.control}
key={prop.key}
value={style[prop.key]}
<<<<<<< HEAD
onChange={(value) => onStyleChanged(styleCategory, prop.key, value)}
=======
onChange={value => onStyleChanged(styleCategory, prop.key, value)}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
props={getControlProps(prop)}
/>
{/each}

View file

@ -9,11 +9,6 @@
bind:value
on:change
options={$roles}
<<<<<<< HEAD
getOptionLabel={(role) => role.name}
getOptionValue={(role) => role._id}
=======
getOptionLabel={role => role.name}
getOptionValue={role => role._id}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
/>

View file

@ -36,11 +36,7 @@
<div class="container">
<Input
<<<<<<< HEAD
on:change={(e) => updateKey(["budibase", e.detail])}
=======
on:change={e => updateKey(["budibase", e.detail])}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
value={keys.budibase}
label="Budibase Cloud API Key"
/>

View file

@ -22,7 +22,7 @@
into the textbox, then click the following button to delete your entire web app.
</Body>
<Input
on:change={(e) => (value = e.detail)}
on:change={e => (value = e.detail)}
disabled={loading}
placeholder=""
/>

View file

@ -15,7 +15,7 @@
async function updateApplication(data) {
const response = await api.put(`/api/applications/${$store.appId}`, data)
await response.json()
store.update((state) => {
store.update(state => {
state = {
...state,
...data,
@ -76,21 +76,21 @@
<div class="container">
<Input
on:change={(e) => updateApplication({ name: e.detail })}
on:change={e => updateApplication({ name: e.detail })}
value={$store.name}
error={nameError}
label="App Name"
/>
{#if $hostingStore.hostingInfo.type === "self"}
<Input
on:change={(e) => updateApplication({ url: e.detail })}
on:change={e => updateApplication({ url: e.detail })}
value={$store.url}
error={urlError}
label="App URL"
/>
{/if}
<TextArea
on:change={(e) => updateApplication({ description: e.detail })}
on:change={e => updateApplication({ description: e.detail })}
value={$store.description}
label="App Description"
/>

View file

@ -15,7 +15,7 @@
let promise = getPackage()
$: selected = capitalise(
$layout.children.find((layout) => $isActive(layout.path))?.title ?? "data"
$layout.children.find(layout => $isActive(layout.path))?.title ?? "data"
)
async function getPackage() {
@ -37,10 +37,10 @@
// e.g. if one of your screens is selected on front end, then
// you browse to backend, when you click frontend, you will be
// brought back to the same screen
const topItemNavigate = (path) => () => {
const activeTopNav = $layout.children.find((c) => $isActive(c.path))
const topItemNavigate = path => () => {
const activeTopNav = $layout.children.find(c => $isActive(c.path))
if (!activeTopNav) return
store.update((state) => {
store.update(state => {
if (!state.previousTopNavPath) state.previousTopNavPath = {}
state.previousTopNavPath[activeTopNav.path] = window.location.pathname
$goto(state.previousTopNavPath[path] || path)

View file

@ -4,7 +4,7 @@
if ($params.automation) {
const automation = $automationStore.automations.find(
(m) => m._id === $params.automation
m => m._id === $params.automation
)
if (automation) {
automationStore.actions.select(automation)

View file

@ -20,7 +20,7 @@
let selected = $isActive("./datasource") ? "External" : "Internal"
function selectFirstTableOrSource({ detail }) {
const { key } = tabs.find((t) => t.title === detail)
const { key } = tabs.find(t => t.title === detail)
if (key === "datasource") {
$goto("./datasource")
} else {

View file

@ -3,7 +3,7 @@
import { queries } from "stores/backend"
if ($params.query) {
const query = $queries.list.find((m) => m._id === $params.query)
const query = $queries.list.find(m => m._id === $params.query)
if (query) {
queries.select(query)
}

View file

@ -15,7 +15,7 @@
}
$: selectedQuery = $queries.list.find(
(query) => query._id === $queries.selected
query => query._id === $queries.selected
) || {
datasourceId: $params.selectedDatasource,
parameters: [],

View file

@ -4,7 +4,7 @@
if ($params.selectedDatasource) {
const datasource = $datasources.list.find(
(m) => m._id === $params.selectedDatasource
m => m._id === $params.selectedDatasource
)
if (datasource) {
datasources.select(datasource._id)

View file

@ -3,7 +3,7 @@
import { tables } from "stores/backend"
if ($params.selectedTable) {
const table = $tables.list.find((m) => m._id === $params.selectedTable)
const table = $tables.list.find(m => m._id === $params.selectedTable)
if (table) {
tables.select(table)
}

View file

@ -51,7 +51,7 @@
assetType = FrontendTypes.SCREEN
}
if (assetType !== state.currentFrontEndType) {
store.update((state) => {
store.update(state => {
state.currentFrontEndType = assetType
return state
})
@ -74,7 +74,7 @@
}
// Find and select the current asset
asset = assetList.find((asset) => asset._id === assetId)
asset = assetList.find(asset => asset._id === assetId)
if (asset && asset._id !== selectedAsset?._id) {
actions.select(assetId)
}
@ -128,7 +128,7 @@
const componentPath = findComponentPath(asset.props, componentId)
const componentURL = componentPath
.slice(1)
.map((comp) => comp._id)
.map(comp => comp._id)
.join("/")
url += `/${componentURL}`
}

View file

@ -9,7 +9,7 @@
// If we ever land on this index page we want to correctly update state
// to select a valid asset. The layout page will in turn update the URL
// to reflect state.
const selectValidAsset = (assetType) => {
const selectValidAsset = assetType => {
let id
const state = get(store)
const screens = get(allScreens)
@ -19,7 +19,7 @@
if (assetType === FrontendTypes.LAYOUT) {
if (
state.selectedLayoutId &&
state.layouts.find((layout) => layout._id === state.selectedLayoutId)
state.layouts.find(layout => layout._id === state.selectedLayoutId)
) {
id = state.selectedLayoutId
} else {
@ -31,12 +31,12 @@
} else if (assetType === FrontendTypes.SCREEN) {
if (
state.selectedScreenId &&
screens.find((screen) => screen._id === state.selectedScreenId)
screens.find(screen => screen._id === state.selectedScreenId)
) {
id = state.selectedScreenId
} else {
// Select the first screen matching the selected role ID
const filteredScreens = screens.filter((screen) => {
const filteredScreens = screens.filter(screen => {
return screen.routing?.roleId === role
})
id = filteredScreens[0]?._id

View file

@ -5826,10 +5826,10 @@ svelte-portal@0.1.0:
resolved "https://registry.yarnpkg.com/svelte-portal/-/svelte-portal-0.1.0.tgz#cc2821cc84b05ed5814e0218dcdfcbebc53c1742"
integrity sha512-kef+ksXVKun224mRxat+DdO4C+cGHla+fEcZfnBAvoZocwiaceOfhf5azHYOPXSSB1igWVFTEOF3CDENPnuWxg==
svelte@^3.36.0:
version "3.37.0"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.37.0.tgz#dc7cd24bcc275cdb3f8c684ada89e50489144ccd"
integrity sha512-TRF30F4W4+d+Jr2KzUUL1j8Mrpns/WM/WacxYlo5MMb2E5Qy2Pk1Guj6GylxsW9OnKQl1tnF8q3hG/hQ3h6VUA==
svelte@^3.37.0:
version "3.38.2"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.38.2.tgz#55e5c681f793ae349b5cc2fe58e5782af4275ef5"
integrity sha512-q5Dq0/QHh4BLJyEVWGe7Cej5NWs040LWjMbicBGZ+3qpFWJ1YObRmUDZKbbovddLC9WW7THTj3kYbTOFmU9fbg==
symbol-observable@^1.1.0:
version "1.2.0"

View file

@ -45,7 +45,7 @@
})
// Gets the component constructor for the specified component
const getComponentConstructor = (component) => {
const getComponentConstructor = component => {
const split = component?.split("/")
const name = split?.[split.length - 1]
if (name === "screenslot" && $builderStore.previewType !== "layout") {
@ -79,7 +79,7 @@
componentProps = {}
propsChanged = true
}
Object.keys(enrichedProps).forEach((key) => {
Object.keys(enrichedProps).forEach(key => {
if (!propsAreSame(enrichedProps[key], componentProps[key])) {
propsChanged = true
componentProps[key] = enrichedProps[key]

View file

@ -15,9 +15,9 @@
id: $routeStore.routeSessionId,
}
const getRouterConfig = (routes) => {
const getRouterConfig = routes => {
let config = {}
routes.forEach((route) => {
routes.forEach(route => {
config[route.path] = Screen
})

View file

@ -40,18 +40,8 @@ router
}
await next()
})
<<<<<<< HEAD
.use("/bulladmin", (ctx) => {
ctx.status = 200
ctx.respond = false
expressApp(ctx.req, ctx.res)
})
.use("/health", (ctx) => (ctx.status = 200))
.use("/version", (ctx) => (ctx.body = pkg.version))
=======
.use("/health", ctx => (ctx.status = 200))
.use("/version", ctx => (ctx.body = pkg.version))
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
.use(buildAuthMiddleware(NO_AUTH_ENDPOINTS))
.use(currentApp)

View file

@ -39,7 +39,7 @@
loaded,
}
const fetchData = async (dataSource) => {
const fetchData = async dataSource => {
loading = true
allRows = await API.fetchDatasource(dataSource)
loading = false
@ -53,7 +53,7 @@
let filteredData = [...rows]
Object.entries(filter).forEach(([field, value]) => {
if (value != null && value !== "") {
filteredData = filteredData.filter((row) => {
filteredData = filteredData.filter(row => {
return row[field] === value
})
}
@ -84,7 +84,7 @@
return rows.slice(0, numLimit)
}
const getSchema = async (dataSource) => {
const getSchema = async dataSource => {
if (dataSource?.schema) {
schema = dataSource.schema
} else if (dataSource?.tableId) {

View file

@ -20,29 +20,17 @@
$: options = setUpChart(dataProvider)
<<<<<<< HEAD
const setUpChart = (provider) => {
const allCols = [labelColumn, ...(valueColumns || [null])]
if (!provider || allCols.find((x) => x == null)) {
=======
const setUpChart = provider => {
const allCols = [labelColumn, ...(valueColumns || [null])]
if (!provider || allCols.find(x => x == null)) {
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
return null
}
// Fatch data
const { schema, rows } = provider
<<<<<<< HEAD
const reducer = (row) => (valid, column) => valid && row[column] != null
const hasAllColumns = (row) => allCols.reduce(reducer(row), true)
const data = rows.filter((row) => hasAllColumns(row)).slice(0, 100)
=======
const reducer = row => (valid, column) => valid && row[column] != null
const hasAllColumns = row => allCols.reduce(reducer(row), true)
const data = rows.filter(row => hasAllColumns(row)).slice(0, 100)
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
if (!schema || !data.length) {
return null
}
@ -69,15 +57,9 @@
builder = builder.xType(labelFieldType)
useDates = labelFieldType === "datetime"
}
<<<<<<< HEAD
const series = valueColumns.map((column) => ({
name: column,
data: data.map((row) => {
=======
const series = valueColumns.map(column => ({
name: column,
data: data.map(row => {
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
if (!useDates) {
return row[column]
} else {
@ -87,11 +69,7 @@
}))
builder = builder.series(series)
if (!useDates) {
<<<<<<< HEAD
builder = builder.categories(data.map((row) => row[labelColumn]))
=======
builder = builder.categories(data.map(row => row[labelColumn]))
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
}
// Build chart options

View file

@ -19,17 +19,17 @@
$: options = setUpChart(dataProvider)
// Fetch data on mount
const setUpChart = (provider) => {
const setUpChart = provider => {
const allCols = [dateColumn, openColumn, highColumn, lowColumn, closeColumn]
if (!provider || allCols.find((x) => x == null)) {
if (!provider || allCols.find(x => x == null)) {
return null
}
// Fetch data
const { schema, rows } = provider
const reducer = (row) => (valid, column) => valid && row[column] != null
const hasAllColumns = (row) => allCols.reduce(reducer(row), true)
const data = rows.filter((row) => hasAllColumns(row))
const reducer = row => (valid, column) => valid && row[column] != null
const hasAllColumns = row => allCols.reduce(reducer(row), true)
const data = rows.filter(row => hasAllColumns(row))
if (!schema || !data.length) {
return null
}
@ -48,8 +48,8 @@
.xType("datetime")
// Add data
const parseDate = (d) => (isNaN(d) ? Date.parse(d).valueOf() : parseInt(d))
const chartData = data.map((row) => ({
const parseDate = d => (isNaN(d) ? Date.parse(d).valueOf() : parseInt(d))
const chartData = data.map(row => ({
x: parseDate(row[dateColumn]),
y: [row[openColumn], row[highColumn], row[lowColumn], row[closeColumn]],
}))

View file

@ -27,17 +27,17 @@
$: options = setUpChart(dataProvider)
// Fetch data on mount
const setUpChart = (provider) => {
const setUpChart = provider => {
const allCols = [labelColumn, ...(valueColumns || [null])]
if (!provider || allCols.find((x) => x == null)) {
if (!provider || allCols.find(x => x == null)) {
return null
}
// Fetch, filter and sort data
const { schema, rows } = provider
const reducer = (row) => (valid, column) => valid && row[column] != null
const hasAllColumns = (row) => allCols.reduce(reducer(row), true)
const data = rows.filter((row) => hasAllColumns(row))
const reducer = row => (valid, column) => valid && row[column] != null
const hasAllColumns = row => allCols.reduce(reducer(row), true)
const data = rows.filter(row => hasAllColumns(row))
if (!schema || !data.length) {
return null
}
@ -66,9 +66,9 @@
builder = builder.xType(labelFieldType)
useDates = labelFieldType === "datetime"
}
const series = valueColumns.map((column) => ({
const series = valueColumns.map(column => ({
name: column,
data: data.map((row) => {
data: data.map(row => {
if (!useDates) {
return row[column]
} else {
@ -78,7 +78,7 @@
}))
builder = builder.series(series)
if (!useDates) {
builder = builder.categories(data.map((row) => row[labelColumn]))
builder = builder.categories(data.map(row => row[labelColumn]))
}
// Build chart options

View file

@ -18,7 +18,7 @@
$: options = setUpChart(dataProvider)
// Fetch data on mount
const setUpChart = (provider) => {
const setUpChart = provider => {
if (!provider || !labelColumn || !valueColumn) {
return null
}
@ -26,7 +26,7 @@
// Fetch, filter and sort data
const { schema, rows } = provider
const data = rows
.filter((row) => row[labelColumn] != null && row[valueColumn] != null)
.filter(row => row[labelColumn] != null && row[valueColumn] != null)
.slice(0, 100)
if (!schema || !data.length) {
return null
@ -45,8 +45,8 @@
.palette(palette)
// Add data if valid datasource
const series = data.map((row) => parseFloat(row[valueColumn]))
const labels = data.map((row) => row[labelColumn])
const series = data.map(row => parseFloat(row[valueColumn]))
const labels = data.map(row => row[labelColumn])
builder = builder.series(series).labels(labels)
// Build chart options

Some files were not shown because too many files have changed in this diff Show more