Merge branch 'master' into labday/monorepo-setup
This commit is contained in:
commit
f795fb099f
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
|
||||||
"version": "3.2.25",
|
"version": "3.2.26",
|
||||||
"npmClient": "yarn",
|
"npmClient": "yarn",
|
||||||
"concurrency": 20,
|
"concurrency": 20,
|
||||||
"command": {
|
"command": {
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Leave the core data as it is
|
// Leave the core data as it is
|
||||||
return testData
|
return cloneDeep(testData)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,10 @@
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
$: testData = testData || parseTestData($selectedAutomation.data.testData)
|
$: currentTestData = $selectedAutomation.data.testData
|
||||||
|
|
||||||
|
// Can be updated locally to avoid race condition when testing
|
||||||
|
$: testData = parseTestData(currentTestData)
|
||||||
|
|
||||||
$: {
|
$: {
|
||||||
// clone the trigger so we're not mutating the reference
|
// clone the trigger so we're not mutating the reference
|
||||||
|
@ -85,7 +88,7 @@
|
||||||
required => testData?.[required] || required !== "row"
|
required => testData?.[required] || required !== "row"
|
||||||
)
|
)
|
||||||
|
|
||||||
function parseTestJSON(e) {
|
async function parseTestJSON(e) {
|
||||||
let jsonUpdate
|
let jsonUpdate
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -105,7 +108,9 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const updatedAuto =
|
||||||
automationStore.actions.addTestDataToAutomation(jsonUpdate)
|
automationStore.actions.addTestDataToAutomation(jsonUpdate)
|
||||||
|
await automationStore.actions.save(updatedAuto)
|
||||||
}
|
}
|
||||||
|
|
||||||
const testAutomation = async () => {
|
const testAutomation = async () => {
|
||||||
|
@ -150,10 +155,14 @@
|
||||||
{#if selectedValues}
|
{#if selectedValues}
|
||||||
<div class="tab-content-padding">
|
<div class="tab-content-padding">
|
||||||
<AutomationBlockSetup
|
<AutomationBlockSetup
|
||||||
bind:testData
|
|
||||||
{schemaProperties}
|
{schemaProperties}
|
||||||
isTestModal
|
isTestModal
|
||||||
|
{testData}
|
||||||
block={trigger}
|
block={trigger}
|
||||||
|
on:update={e => {
|
||||||
|
const { testData: updatedTestData } = e.detail
|
||||||
|
testData = updatedTestData
|
||||||
|
}}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
@ -162,7 +171,7 @@
|
||||||
<TextArea
|
<TextArea
|
||||||
value={JSON.stringify($selectedAutomation.data.testData, null, 2)}
|
value={JSON.stringify($selectedAutomation.data.testData, null, 2)}
|
||||||
error={failedParse}
|
error={failedParse}
|
||||||
on:change={e => parseTestJSON(e)}
|
on:change={async e => await parseTestJSON(e)}
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
{/if}
|
{/if}
|
||||||
|
|
|
@ -48,7 +48,7 @@
|
||||||
import { QueryUtils, Utils, search, memo } from "@budibase/frontend-core"
|
import { QueryUtils, Utils, search, memo } from "@budibase/frontend-core"
|
||||||
import { getSchemaForDatasourcePlus } from "dataBinding"
|
import { getSchemaForDatasourcePlus } from "dataBinding"
|
||||||
import { TriggerStepID, ActionStepID } from "constants/backend/automations"
|
import { TriggerStepID, ActionStepID } from "constants/backend/automations"
|
||||||
import { onMount } from "svelte"
|
import { onMount, createEventDispatcher } from "svelte"
|
||||||
import { writable } from "svelte/store"
|
import { writable } from "svelte/store"
|
||||||
import { cloneDeep } from "lodash/fp"
|
import { cloneDeep } from "lodash/fp"
|
||||||
import {
|
import {
|
||||||
|
@ -67,6 +67,8 @@
|
||||||
export let isTestModal = false
|
export let isTestModal = false
|
||||||
export let bindings = []
|
export let bindings = []
|
||||||
|
|
||||||
|
const dispatch = createEventDispatcher()
|
||||||
|
|
||||||
// Stop unnecessary rendering
|
// Stop unnecessary rendering
|
||||||
const memoBlock = memo(block)
|
const memoBlock = memo(block)
|
||||||
|
|
||||||
|
@ -503,15 +505,7 @@
|
||||||
row: { "Active": true, "Order Id" : 14, ... }
|
row: { "Active": true, "Order Id" : 14, ... }
|
||||||
})
|
})
|
||||||
*/
|
*/
|
||||||
const onChange = async update => {
|
const onChange = Utils.sequential(async update => {
|
||||||
if (isTestModal) {
|
|
||||||
testData = update
|
|
||||||
}
|
|
||||||
|
|
||||||
updateAutomation(update)
|
|
||||||
}
|
|
||||||
|
|
||||||
const updateAutomation = Utils.sequential(async update => {
|
|
||||||
const request = cloneDeep(update)
|
const request = cloneDeep(update)
|
||||||
// Process app trigger updates
|
// Process app trigger updates
|
||||||
if (isTrigger && !isTestModal) {
|
if (isTrigger && !isTestModal) {
|
||||||
|
@ -540,7 +534,9 @@
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (isTestModal) {
|
if (isTestModal) {
|
||||||
let newTestData = { schema }
|
// Be sure to merge in the testData prop data, as it can contain custom
|
||||||
|
// default data
|
||||||
|
let newTestData = { schema, ...testData }
|
||||||
|
|
||||||
// Special case for webhook, as it requires a body, but the schema already brings back the body's contents
|
// Special case for webhook, as it requires a body, but the schema already brings back the body's contents
|
||||||
if (stepId === TriggerStepID.WEBHOOK) {
|
if (stepId === TriggerStepID.WEBHOOK) {
|
||||||
|
@ -557,7 +553,13 @@
|
||||||
...request,
|
...request,
|
||||||
}
|
}
|
||||||
|
|
||||||
await automationStore.actions.addTestDataToAutomation(newTestData)
|
const updatedAuto =
|
||||||
|
automationStore.actions.addTestDataToAutomation(newTestData)
|
||||||
|
|
||||||
|
// Ensure the test request has the latest info.
|
||||||
|
dispatch("update", updatedAuto)
|
||||||
|
|
||||||
|
await automationStore.actions.save(updatedAuto)
|
||||||
} else {
|
} else {
|
||||||
const data = { schema, ...request }
|
const data = { schema, ...request }
|
||||||
await automationStore.actions.updateBlockInputs(block, data)
|
await automationStore.actions.updateBlockInputs(block, data)
|
||||||
|
|
|
@ -56,7 +56,10 @@
|
||||||
.map(table => format.table(table, $datasources.list))
|
.map(table => format.table(table, $datasources.list))
|
||||||
.sort((a, b) => {
|
.sort((a, b) => {
|
||||||
// sort tables alphabetically, grouped by datasource
|
// sort tables alphabetically, grouped by datasource
|
||||||
const dsComparison = a.datasourceName.localeCompare(b.datasourceName)
|
const dsA = a.datasourceName ?? ""
|
||||||
|
const dsB = b.datasourceName ?? ""
|
||||||
|
|
||||||
|
const dsComparison = dsA.localeCompare(dsB)
|
||||||
if (dsComparison !== 0) {
|
if (dsComparison !== 0) {
|
||||||
return dsComparison
|
return dsComparison
|
||||||
}
|
}
|
||||||
|
|
|
@ -880,13 +880,13 @@ const automationActions = store => ({
|
||||||
appId,
|
appId,
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
addTestDataToAutomation: async data => {
|
addTestDataToAutomation: data => {
|
||||||
let newAutomation = cloneDeep(get(selectedAutomation).data)
|
let newAutomation = cloneDeep(get(selectedAutomation).data)
|
||||||
newAutomation.testData = {
|
newAutomation.testData = {
|
||||||
...newAutomation.testData,
|
...newAutomation.testData,
|
||||||
...data,
|
...data,
|
||||||
}
|
}
|
||||||
await store.actions.save(newAutomation)
|
return newAutomation
|
||||||
},
|
},
|
||||||
constructBlock(type, stepId, blockDefinition) {
|
constructBlock(type, stepId, blockDefinition) {
|
||||||
let newName
|
let newName
|
||||||
|
|
Loading…
Reference in New Issue