Fixing some issues I found with testing automations against external tables.
This commit is contained in:
parent
b0ebd7d741
commit
38b880ac28
|
@ -8,7 +8,7 @@
|
|||
// and this is the final url (i.e. no selectedTable)
|
||||
if (
|
||||
!$leftover &&
|
||||
$tables.list.length > 0(!$tables.selected || !$tables.selected._id)
|
||||
$tables.list.length > (!$tables.selected || !$tables.selected._id)
|
||||
) {
|
||||
$goto(`./${$tables.list[0]._id}`)
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@ function generateSaveValidator() {
|
|||
return joiValidator.body(Joi.object({
|
||||
_id: Joi.string(),
|
||||
_rev: Joi.string(),
|
||||
type: Joi.string().valid("table"),
|
||||
type: Joi.string().valid("table", "internal", "external"),
|
||||
primaryDisplay: Joi.string(),
|
||||
schema: Joi.object().required(),
|
||||
name: Joi.string().required(),
|
||||
|
|
|
@ -8,6 +8,8 @@ const { getAutomationParams } = require("../db/utils")
|
|||
const { coerce } = require("../utilities/rowProcessor")
|
||||
const { utils } = require("@budibase/auth/redis")
|
||||
const { JobQueues } = require("../constants")
|
||||
const { isExternalTable, breakExternalTableId } = require("../integrations/utils")
|
||||
const { getExternalTable } = require("../api/controllers/table/utils")
|
||||
|
||||
const { opts } = utils.getRedisOptions()
|
||||
let automationQueue = new Queue(JobQueues.AUTOMATIONS, { redis: opts })
|
||||
|
@ -288,9 +290,15 @@ emitter.on("row:delete", async function (event) {
|
|||
async function fillRowOutput(automation, params) {
|
||||
let triggerSchema = automation.definition.trigger
|
||||
let tableId = triggerSchema.inputs.tableId
|
||||
const db = new CouchDB(params.appId)
|
||||
try {
|
||||
let table = await db.get(tableId)
|
||||
let table
|
||||
if (!isExternalTable(tableId)) {
|
||||
const db = new CouchDB(params.appId)
|
||||
table = await db.get(tableId)
|
||||
} else {
|
||||
const { datasourceId, tableName } = breakExternalTableId(tableId)
|
||||
table = await getExternalTable(params.appId, datasourceId, tableName)
|
||||
}
|
||||
let row = {}
|
||||
for (let schemaKey of Object.keys(table.schema)) {
|
||||
const paramValue = params[schemaKey]
|
||||
|
|
Loading…
Reference in New Issue