1
0
Fork 0
mirror of synced 2024-07-07 23:35:49 +12:00

Update workflow block definitions

This commit is contained in:
Andrew Kingston 2020-09-15 14:45:37 +01:00
parent 1382c3bb12
commit ba125b5987

View file

@ -4,11 +4,11 @@ let conditions = require("../../../workflows/logic").LogicConditions
const ACTION = { const ACTION = {
SAVE_RECORD: { SAVE_RECORD: {
name: "Save Record", name: "Save Record",
tagline: "<b>Save</b> a <b>{{record.model.name}}</b> record", tagline: "Save a {{inputs.record.model.name}} record",
icon: "ri-save-3-fill", icon: "ri-save-3-fill",
description: "Save a record to your database", description: "Save a record to your database",
type: "ACTION", type: "ACTION",
input: { inputs: {
record: { record: {
type: "record", type: "record",
label: "The record to be written", label: "The record to be written",
@ -16,10 +16,10 @@ const ACTION = {
}, },
model: { model: {
type: "model", type: "model",
label: "The table to save a record to", label: "Table",
}, },
}, },
output: { outputs: {
response: { response: {
type: "object", type: "object",
label: "The response from the table", label: "The response from the table",
@ -42,19 +42,19 @@ const ACTION = {
description: "Delete a record from your database", description: "Delete a record from your database",
icon: "ri-delete-bin-line", icon: "ri-delete-bin-line",
name: "Delete Record", name: "Delete Record",
tagline: "<b>Delete</b> a <b>{{record.model.name}}</b> record", tagline: "Delete a {{inputs.record.model.name}} record",
type: "ACTION", type: "ACTION",
input: { inputs: {
id: { id: {
type: "string", type: "string",
label: "The identifier of the record to be deleted", label: "Record ID",
}, },
revision: { revision: {
type: "string", type: "string",
label: "The revision of the record to be deleted", label: "Record Revision",
}, },
}, },
output: { outputs: {
response: { response: {
type: "object", type: "object",
label: "The response from the table", label: "The response from the table",
@ -67,35 +67,27 @@ const ACTION = {
}, },
CREATE_USER: { CREATE_USER: {
description: "Create a new user", description: "Create a new user",
tagline: "Create user <b>{{username}}</b>", tagline: "Create user {{inputs.username}}",
icon: "ri-user-add-fill", icon: "ri-user-add-fill",
name: "Create User", name: "Create User",
params: {
username: "string",
password: "password",
accessLevelId: "accessLevel",
},
args: {
accessLevelId: "POWER_USER",
},
type: "ACTION", type: "ACTION",
input: { inputs: {
username: { username: {
type: "string", type: "string",
label: "The username of the new user to create", label: "Username",
}, },
password: { password: {
type: "password", type: "password",
label: "The password of the new user to create", label: "Password",
}, },
accessLevelId: { accessLevelId: {
type: "string", type: "string",
label: "The level of access to the system the new user will have", label: "Access Level",
default: accessLevels.POWERUSER_LEVEL_ID, default: accessLevels.POWERUSER_LEVEL_ID,
options: accessLevels.ACCESS_LEVELS, options: accessLevels.ACCESS_LEVELS,
}, },
}, },
output: { outputs: {
id: { id: {
type: "string", type: "string",
label: "The identifier of the new user", label: "The identifier of the new user",
@ -116,35 +108,29 @@ const ACTION = {
}, },
SEND_EMAIL: { SEND_EMAIL: {
description: "Send an email.", description: "Send an email.",
tagline: "Send email to <b>{{to}}</b>", tagline: "Send email to {{inputs.to}}",
icon: "ri-mail-open-fill", icon: "ri-mail-open-fill",
name: "Send Email", name: "Send Email",
params: {
to: "string",
from: "string",
subject: "longText",
text: "longText",
},
type: "ACTION", type: "ACTION",
input: { inputs: {
to: { to: {
type: "string", type: "string",
label: "Email address to send email to", label: "Send To",
}, },
from: { from: {
type: "string", type: "string",
label: "Email address to send email from", label: "Send From",
}, },
subject: { subject: {
type: "string", type: "string",
label: "The subject of the email", label: "Email Subject",
}, },
contents: { contents: {
type: "string", type: "string",
label: "The contents of the email", label: "Email Contents",
}, },
}, },
output: { outputs: {
success: { success: {
type: "boolean", type: "boolean",
label: "Whether the email was sent", label: "Whether the email was sent",
@ -160,34 +146,27 @@ const ACTION = {
const LOGIC = { const LOGIC = {
FILTER: { FILTER: {
name: "Filter", name: "Filter",
tagline: "{{filter}} <b>{{condition}}</b> {{value}}", tagline: "{{inputs.filter}} {{inputs.condition}} {{inputs.value}}",
icon: "ri-git-branch-line", icon: "ri-git-branch-line",
description: "Filter any workflows which do not meet certain conditions", description: "Filter any workflows which do not meet certain conditions",
params: {
filter: "string",
condition: ["equals"],
value: "string",
},
args: {
condition: "equals",
},
type: "LOGIC", type: "LOGIC",
input: { inputs: {
field: { filter: {
type: "string", type: "string",
label: "The input to filter on", label: "Reference Value",
}, },
condition: { condition: {
type: "string", type: "string",
label: "The condition to use for filtering", label: "Condition",
options: conditions, options: conditions,
default: "equals",
}, },
value: { value: {
type: "string", type: "string",
label: "The value to compare against", label: "Comparison Value",
}, },
}, },
output: { outputs: {
success: { success: {
type: "boolean", type: "boolean",
label: "Whether the logic block passed", label: "Whether the logic block passed",
@ -197,12 +176,12 @@ const LOGIC = {
DELAY: { DELAY: {
name: "Delay", name: "Delay",
icon: "ri-time-fill", icon: "ri-time-fill",
tagline: "Delay for <b>{{time}}</b> milliseconds", tagline: "Delay for {{inputs.time}} milliseconds",
description: "Delay the workflow until an amount of time has passed", description: "Delay the workflow until an amount of time has passed",
input: { inputs: {
time: { time: {
type: "number", type: "number",
label: "The duration of the delay in milliseconds", label: "Delay in milliseconds",
}, },
}, },
type: "LOGIC", type: "LOGIC",
@ -214,15 +193,15 @@ const TRIGGER = {
name: "Record Saved", name: "Record Saved",
event: "record:save", event: "record:save",
icon: "ri-save-line", icon: "ri-save-line",
tagline: "Record is added to <b>{{model.name}}</b>", tagline: "Record is added to {{inputs.model.name}}",
description: "Fired when a record is saved to your database", description: "Fired when a record is saved to your database",
input: { inputs: {
model: { model: {
type: "model", type: "model",
label: "The table to trigger on when a new record is saved", label: "Table",
}, },
}, },
output: { outputs: {
record: { record: {
type: "record", type: "record",
label: "The new record that was saved", label: "The new record that was saved",
@ -234,15 +213,15 @@ const TRIGGER = {
name: "Record Deleted", name: "Record Deleted",
event: "record:delete", event: "record:delete",
icon: "ri-delete-bin-line", icon: "ri-delete-bin-line",
tagline: "Record is deleted from <b>{{model.name}}</b>", tagline: "Record is deleted from {{inputs.model.name}}",
description: "Fired when a record is deleted from your database", description: "Fired when a record is deleted from your database",
input: { inputs: {
model: { model: {
type: "model", type: "model",
label: "The table to trigger on when a record is deleted", label: "Table",
}, },
}, },
output: { outputs: {
record: { record: {
type: "record", type: "record",
label: "The record that was deleted", label: "The record that was deleted",