tidy up
This commit is contained in:
parent
784ac20dd8
commit
6d32d5f8b1
|
@ -38,6 +38,5 @@
|
||||||
"test:e2e:ci": "lerna run cy:ci",
|
"test:e2e:ci": "lerna run cy:ci",
|
||||||
"build:docker": "cd hosting/scripts/linux/ && ./release-to-docker-hub.sh && cd -",
|
"build:docker": "cd hosting/scripts/linux/ && ./release-to-docker-hub.sh && cd -",
|
||||||
"build:docker:staging": "cd hosting/scripts/linux/ && ./release-to-docker-hub.sh staging && cd -"
|
"build:docker:staging": "cd hosting/scripts/linux/ && ./release-to-docker-hub.sh staging && cd -"
|
||||||
},
|
}
|
||||||
"dependencies": {}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -91,6 +91,7 @@
|
||||||
{:else if value.customType === 'code'}
|
{:else if value.customType === 'code'}
|
||||||
<CodeEditorModal>
|
<CodeEditorModal>
|
||||||
<pre>{JSON.stringify(bindings, null, 2)}</pre>
|
<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
|
<Editor
|
||||||
mode="javascript"
|
mode="javascript"
|
||||||
on:change={e => {
|
on:change={e => {
|
||||||
|
|
|
@ -37,7 +37,7 @@ async function init() {
|
||||||
PORT: 4001,
|
PORT: 4001,
|
||||||
MINIO_URL: "http://localhost:10000/",
|
MINIO_URL: "http://localhost:10000/",
|
||||||
COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/",
|
COUCH_DB_URL: "http://budibase:budibase@localhost:10000/db/",
|
||||||
// REDIS_URL: "http://localhost:10000/cache/",
|
REDIS_URL: "http://localhost:10000/cache/",
|
||||||
WORKER_URL: "http://localhost:4002",
|
WORKER_URL: "http://localhost:4002",
|
||||||
JWT_SECRET: "testsecret",
|
JWT_SECRET: "testsecret",
|
||||||
MINIO_ACCESS_KEY: "budibase",
|
MINIO_ACCESS_KEY: "budibase",
|
||||||
|
|
|
@ -9,8 +9,8 @@ class ScriptExecutor {
|
||||||
}
|
}
|
||||||
|
|
||||||
execute() {
|
execute() {
|
||||||
this.script.runInContext(this.context)
|
const returnValue = this.script.runInContext(this.context)
|
||||||
return this.context
|
return returnValue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -18,6 +18,5 @@ exports.execute = async function(ctx) {
|
||||||
const executor = new ScriptExecutor(ctx.request.body)
|
const executor = new ScriptExecutor(ctx.request.body)
|
||||||
|
|
||||||
const result = executor.execute()
|
const result = executor.execute()
|
||||||
|
|
||||||
ctx.body = result
|
ctx.body = result
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +0,0 @@
|
||||||
const app = require("express")()
|
|
||||||
const { router } = require("bull-board")
|
|
||||||
|
|
||||||
app.use("/admin/queues", router)
|
|
|
@ -1,14 +1,10 @@
|
||||||
const Router = require("@koa/router")
|
const Router = require("@koa/router")
|
||||||
const controller = require("../controllers/hosting")
|
const controller = require("../controllers/hosting")
|
||||||
const authorized = require("../../middleware/authorized")
|
const authorized = require("../../middleware/authorized")
|
||||||
const selfhost = require("../../middleware/selfhost")
|
|
||||||
const { BUILDER } = require("../../utilities/security/permissions")
|
const { BUILDER } = require("../../utilities/security/permissions")
|
||||||
|
|
||||||
const router = Router()
|
const router = Router()
|
||||||
|
|
||||||
router
|
router.post("/api/script", authorized(BUILDER), controller.save)
|
||||||
.post("/api/script", authorized(BUILDER), controller.save)
|
|
||||||
// this isn't risky, doesn't return anything about apps other than names and URLs
|
|
||||||
.get("/api/hosting/apps", selfhost, controller.getDeployedApps)
|
|
||||||
|
|
||||||
module.exports = router
|
module.exports = router
|
||||||
|
|
|
@ -53,7 +53,6 @@ module.exports.run = async function({ inputs, appId, emitter }) {
|
||||||
}
|
}
|
||||||
|
|
||||||
const { queryId, ...rest } = inputs.query
|
const { queryId, ...rest } = inputs.query
|
||||||
console.log(JSON.stringify(inputs.query))
|
|
||||||
|
|
||||||
const ctx = {
|
const ctx = {
|
||||||
params: {
|
params: {
|
||||||
|
|
|
@ -2,7 +2,7 @@ const scriptController = require("../../api/controllers/script")
|
||||||
|
|
||||||
module.exports.definition = {
|
module.exports.definition = {
|
||||||
name: "Scripting",
|
name: "Scripting",
|
||||||
tagline: "Execute code",
|
tagline: "Execute JavaScript Code",
|
||||||
icon: "ri-terminal-box-line",
|
icon: "ri-terminal-box-line",
|
||||||
description: "Run a piece of JavaScript code in your automation",
|
description: "Run a piece of JavaScript code in your automation",
|
||||||
type: "ACTION",
|
type: "ACTION",
|
||||||
|
@ -21,6 +21,11 @@ module.exports.definition = {
|
||||||
},
|
},
|
||||||
outputs: {
|
outputs: {
|
||||||
properties: {
|
properties: {
|
||||||
|
value: {
|
||||||
|
type: "string",
|
||||||
|
description:
|
||||||
|
"The result of the last statement of the executed script.",
|
||||||
|
},
|
||||||
success: {
|
success: {
|
||||||
type: "boolean",
|
type: "boolean",
|
||||||
description: "Whether the action was successful",
|
description: "Whether the action was successful",
|
||||||
|
@ -56,6 +61,7 @@ module.exports.run = async function({ inputs, appId, context, emitter }) {
|
||||||
await scriptController.execute(ctx)
|
await scriptController.execute(ctx)
|
||||||
return {
|
return {
|
||||||
success: ctx.status === 200,
|
success: ctx.status === 200,
|
||||||
|
value: ctx.body,
|
||||||
}
|
}
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
console.error(err)
|
console.error(err)
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
const CouchDB = require("../db")
|
const CouchDB = require("../db")
|
||||||
const emitter = require("../events/index")
|
const emitter = require("../events/index")
|
||||||
// const InMemoryQueue = require("../utilities/queue/inMemoryQueue")
|
|
||||||
const Queue = require("bull")
|
const Queue = require("bull")
|
||||||
const { setQueues, BullAdapter } = require("bull-board")
|
const { setQueues, BullAdapter } = require("bull-board")
|
||||||
const { getAutomationParams } = require("../db/utils")
|
const { getAutomationParams } = require("../db/utils")
|
||||||
|
|
Loading…
Reference in New Issue