merge with next

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -22,7 +22,7 @@
longform: StringRenderer, longform: StringRenderer,
} }
$: type = schema?.type ?? "string" $: 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] $: renderer = customRenderer?.component ?? typeMap[type]
</script> </script>

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -31,7 +31,7 @@
if (automation.trigger) { if (automation.trigger) {
allSteps = [automation.trigger, ...allSteps] 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 // Extract all outputs from all previous steps as available bindings
let bindings = [] let bindings = []
@ -71,58 +71,23 @@
panel={AutomationBindingPanel} panel={AutomationBindingPanel}
type={"email"} type={"email"}
value={block.inputs[key]} 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)} on:change={e => (block.inputs[key] = e.detail)}
{bindings} {bindings}
/> />
{:else if value.customType === "table"} {:else if value.customType === "table"}
<TableSelector bind:value={block.inputs[key]} /> <TableSelector bind:value={block.inputs[key]} />
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
{:else if value.customType === "row"} {:else if value.customType === "row"}
<RowSelector bind:value={block.inputs[key]} {bindings} /> <RowSelector bind:value={block.inputs[key]} {bindings} />
{:else if value.customType === "webhookUrl"} {:else if value.customType === "webhookUrl"}
<WebhookDisplay value={block.inputs[key]} /> <WebhookDisplay value={block.inputs[key]} />
{:else if value.customType === "triggerSchema"} {:else if value.customType === "triggerSchema"}
<SchemaSetup bind:value={block.inputs[key]} /> <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"} {:else if value.type === "string" || value.type === "number"}
<DrawerBindableInput <DrawerBindableInput
panel={AutomationBindingPanel} panel={AutomationBindingPanel}
type={value.customType} type={value.customType}
value={block.inputs[key]} value={block.inputs[key]}
<<<<<<< HEAD
on:change={(e) => (block.inputs[key] = e.detail)}
=======
on:change={e => (block.inputs[key] = e.detail)} on:change={e => (block.inputs[key] = e.detail)}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
{bindings} {bindings}
/> />
{/if} {/if}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -11,18 +11,18 @@
export let level = 0 export let level = 0
export let dragDropStore 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) store.actions.components.select(component)
} }
const dragstart = (component) => (e) => { const dragstart = component => e => {
e.dataTransfer.dropEffect = DropEffect.MOVE e.dataTransfer.dropEffect = DropEffect.MOVE
dragDropStore.actions.dragstart(component) dragDropStore.actions.dragstart(component)
} }
const dragover = (component, index) => (e) => { const dragover = (component, index) => e => {
const definition = store.actions.components.getDefinition( const definition = store.actions.components.getDefinition(
component._component component._component
) )

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -15,7 +15,7 @@
$: form = findClosestMatchingComponent( $: form = findClosestMatchingComponent(
$currentAsset.props, $currentAsset.props,
componentInstance._id, componentInstance._id,
(component) => component._component === "@budibase/standard-components/form" component => component._component === "@budibase/standard-components/form"
) )
$: datasource = getDatasourceForProvider($currentAsset, form) $: datasource = getDatasourceForProvider($currentAsset, form)
$: schema = getSchemaForDatasource(datasource, true).schema $: schema = getSchemaForDatasource(datasource, true).schema
@ -24,9 +24,9 @@
const getOptions = (schema, fieldType) => { const getOptions = (schema, fieldType) => {
let entries = Object.entries(schema ?? {}) let entries = Object.entries(schema ?? {})
if (fieldType) { 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> </script>

View File

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

View File

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

View File

@ -23,10 +23,10 @@
if (!Array.isArray(selectedOptions)) { if (!Array.isArray(selectedOptions)) {
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) boundValue = getValidOptions(value.detail, options)
dispatch("change", boundValue) dispatch("change", boundValue)
} }

View File

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

View File

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

View File

@ -36,11 +36,7 @@
<div class="container"> <div class="container">
<Input <Input
<<<<<<< HEAD
on:change={(e) => updateKey(["budibase", e.detail])}
=======
on:change={e => updateKey(["budibase", e.detail])} on:change={e => updateKey(["budibase", e.detail])}
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
value={keys.budibase} value={keys.budibase}
label="Budibase Cloud API Key" 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. into the textbox, then click the following button to delete your entire web app.
</Body> </Body>
<Input <Input
on:change={(e) => (value = e.detail)} on:change={e => (value = e.detail)}
disabled={loading} disabled={loading}
placeholder="" placeholder=""
/> />

View File

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

View File

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

View File

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

View File

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

View File

@ -3,7 +3,7 @@
import { queries } from "stores/backend" import { queries } from "stores/backend"
if ($params.query) { 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) { if (query) {
queries.select(query) queries.select(query)
} }

View File

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

View File

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

View File

@ -3,7 +3,7 @@
import { tables } from "stores/backend" import { tables } from "stores/backend"
if ($params.selectedTable) { 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) { if (table) {
tables.select(table) tables.select(table)
} }

View File

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

View File

@ -9,7 +9,7 @@
// If we ever land on this index page we want to correctly update state // 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 select a valid asset. The layout page will in turn update the URL
// to reflect state. // to reflect state.
const selectValidAsset = (assetType) => { const selectValidAsset = assetType => {
let id let id
const state = get(store) const state = get(store)
const screens = get(allScreens) const screens = get(allScreens)
@ -19,7 +19,7 @@
if (assetType === FrontendTypes.LAYOUT) { if (assetType === FrontendTypes.LAYOUT) {
if ( if (
state.selectedLayoutId && state.selectedLayoutId &&
state.layouts.find((layout) => layout._id === state.selectedLayoutId) state.layouts.find(layout => layout._id === state.selectedLayoutId)
) { ) {
id = state.selectedLayoutId id = state.selectedLayoutId
} else { } else {
@ -31,12 +31,12 @@
} else if (assetType === FrontendTypes.SCREEN) { } else if (assetType === FrontendTypes.SCREEN) {
if ( if (
state.selectedScreenId && state.selectedScreenId &&
screens.find((screen) => screen._id === state.selectedScreenId) screens.find(screen => screen._id === state.selectedScreenId)
) { ) {
id = state.selectedScreenId id = state.selectedScreenId
} else { } else {
// Select the first screen matching the selected role ID // Select the first screen matching the selected role ID
const filteredScreens = screens.filter((screen) => { const filteredScreens = screens.filter(screen => {
return screen.routing?.roleId === role return screen.routing?.roleId === role
}) })
id = filteredScreens[0]?._id 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" resolved "https://registry.yarnpkg.com/svelte-portal/-/svelte-portal-0.1.0.tgz#cc2821cc84b05ed5814e0218dcdfcbebc53c1742"
integrity sha512-kef+ksXVKun224mRxat+DdO4C+cGHla+fEcZfnBAvoZocwiaceOfhf5azHYOPXSSB1igWVFTEOF3CDENPnuWxg== integrity sha512-kef+ksXVKun224mRxat+DdO4C+cGHla+fEcZfnBAvoZocwiaceOfhf5azHYOPXSSB1igWVFTEOF3CDENPnuWxg==
svelte@^3.36.0: svelte@^3.37.0:
version "3.37.0" version "3.38.2"
resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.37.0.tgz#dc7cd24bcc275cdb3f8c684ada89e50489144ccd" resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.38.2.tgz#55e5c681f793ae349b5cc2fe58e5782af4275ef5"
integrity sha512-TRF30F4W4+d+Jr2KzUUL1j8Mrpns/WM/WacxYlo5MMb2E5Qy2Pk1Guj6GylxsW9OnKQl1tnF8q3hG/hQ3h6VUA== integrity sha512-q5Dq0/QHh4BLJyEVWGe7Cej5NWs040LWjMbicBGZ+3qpFWJ1YObRmUDZKbbovddLC9WW7THTj3kYbTOFmU9fbg==
symbol-observable@^1.1.0: symbol-observable@^1.1.0:
version "1.2.0" version "1.2.0"

View File

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

View File

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

View File

@ -40,18 +40,8 @@ router
} }
await next() 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("/health", ctx => (ctx.status = 200))
.use("/version", ctx => (ctx.body = pkg.version)) .use("/version", ctx => (ctx.body = pkg.version))
>>>>>>> 900637c221e4034babd21d69dcaa71b360a2adb2
.use(buildAuthMiddleware(NO_AUTH_ENDPOINTS)) .use(buildAuthMiddleware(NO_AUTH_ENDPOINTS))
.use(currentApp) .use(currentApp)

View File

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

View File

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

View File

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

View File

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

View File

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

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