tidy up
This commit is contained in:
parent
784ac20dd8
commit
6d32d5f8b1
|
@ -38,6 +38,5 @@
|
|||
"test:e2e:ci": "lerna run cy:ci",
|
||||
"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 -"
|
||||
},
|
||||
"dependencies": {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -91,6 +91,7 @@
|
|||
{: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 => {
|
||||
|
|
|
@ -37,7 +37,7 @@ async function init() {
|
|||
PORT: 4001,
|
||||
MINIO_URL: "http://localhost:10000/",
|
||||
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",
|
||||
JWT_SECRET: "testsecret",
|
||||
MINIO_ACCESS_KEY: "budibase",
|
||||
|
|
|
@ -9,8 +9,8 @@ class ScriptExecutor {
|
|||
}
|
||||
|
||||
execute() {
|
||||
this.script.runInContext(this.context)
|
||||
return this.context
|
||||
const returnValue = this.script.runInContext(this.context)
|
||||
return returnValue
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -18,6 +18,5 @@ exports.execute = async function(ctx) {
|
|||
const executor = new ScriptExecutor(ctx.request.body)
|
||||
|
||||
const result = executor.execute()
|
||||
|
||||
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 controller = require("../controllers/hosting")
|
||||
const authorized = require("../../middleware/authorized")
|
||||
const selfhost = require("../../middleware/selfhost")
|
||||
const { BUILDER } = require("../../utilities/security/permissions")
|
||||
|
||||
const router = Router()
|
||||
|
||||
router
|
||||
.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)
|
||||
router.post("/api/script", authorized(BUILDER), controller.save)
|
||||
|
||||
module.exports = router
|
||||
|
|
|
@ -53,7 +53,6 @@ module.exports.run = async function({ inputs, appId, emitter }) {
|
|||
}
|
||||
|
||||
const { queryId, ...rest } = inputs.query
|
||||
console.log(JSON.stringify(inputs.query))
|
||||
|
||||
const ctx = {
|
||||
params: {
|
||||
|
|
|
@ -2,7 +2,7 @@ const scriptController = require("../../api/controllers/script")
|
|||
|
||||
module.exports.definition = {
|
||||
name: "Scripting",
|
||||
tagline: "Execute code",
|
||||
tagline: "Execute JavaScript Code",
|
||||
icon: "ri-terminal-box-line",
|
||||
description: "Run a piece of JavaScript code in your automation",
|
||||
type: "ACTION",
|
||||
|
@ -21,6 +21,11 @@ module.exports.definition = {
|
|||
},
|
||||
outputs: {
|
||||
properties: {
|
||||
value: {
|
||||
type: "string",
|
||||
description:
|
||||
"The result of the last statement of the executed script.",
|
||||
},
|
||||
success: {
|
||||
type: "boolean",
|
||||
description: "Whether the action was successful",
|
||||
|
@ -56,6 +61,7 @@ module.exports.run = async function({ inputs, appId, context, emitter }) {
|
|||
await scriptController.execute(ctx)
|
||||
return {
|
||||
success: ctx.status === 200,
|
||||
value: ctx.body,
|
||||
}
|
||||
} catch (err) {
|
||||
console.error(err)
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
const CouchDB = require("../db")
|
||||
const emitter = require("../events/index")
|
||||
// const InMemoryQueue = require("../utilities/queue/inMemoryQueue")
|
||||
const Queue = require("bull")
|
||||
const { setQueues, BullAdapter } = require("bull-board")
|
||||
const { getAutomationParams } = require("../db/utils")
|
||||
|
|
Loading…
Reference in New Issue