Changing how default inputs for workflow definitions are handled and providing pretty print options for enums.

This commit is contained in:
mike12345567 2020-09-17 12:44:59 +01:00
parent 31939e3dc9
commit 2911a7ba35
4 changed files with 25 additions and 9 deletions

View File

@ -17,6 +17,12 @@ module.exports.ACCESS_LEVELS = [
module.exports.BUILDER_LEVEL_ID, module.exports.BUILDER_LEVEL_ID,
module.exports.ANON_LEVEL_ID, module.exports.ANON_LEVEL_ID,
] ]
module.exports.PRETTY_ACCESS_LEVELS = {
[module.exports.ADMIN_LEVEL_ID]: "Admin",
[module.exports.POWERUSER_LEVEL_ID]: "Power user",
[module.exports.BUILDER_LEVEL_ID]: "Builder",
[module.exports.ANON_LEVEL_ID]: "Anonymous",
}
module.exports.adminPermissions = [ module.exports.adminPermissions = [
{ {
name: module.exports.USER_MANAGEMENT, name: module.exports.USER_MANAGEMENT,

View File

@ -8,7 +8,9 @@ module.exports.definition = {
name: "Create User", name: "Create User",
type: "ACTION", type: "ACTION",
stepId: "CREATE_USER", stepId: "CREATE_USER",
inputs: {}, inputs: {
accessLevelId: accessLevels.POWERUSER_LEVEL_ID,
},
schema: { schema: {
inputs: { inputs: {
properties: { properties: {
@ -24,8 +26,8 @@ module.exports.definition = {
accessLevelId: { accessLevelId: {
type: "string", type: "string",
title: "Access Level", title: "Access Level",
default: accessLevels.POWERUSER_LEVEL_ID,
enum: accessLevels.ACCESS_LEVELS, enum: accessLevels.ACCESS_LEVELS,
pretty: Object.values(accessLevels.PRETTY_ACCESS_LEVELS),
}, },
}, },
required: ["username", "password", "accessLevelId"], required: ["username", "password", "accessLevelId"],

View File

@ -1,8 +1,15 @@
const LogicConditions = { const LogicConditions = {
EQUALS: "Equals", EQUAL: "EQUAL",
NOT_EQUALS: "Not equals", NOT_EQUAL: "NOT_EQUAL",
GREATER_THAN: "Greater than", GREATER_THAN: "GREATER_THAN",
LESS_THAN: "Less than", LESS_THAN: "LESS_THAN",
}
const PrettyLogicConditions = {
[LogicConditions.EQUAL]: "Equals",
[LogicConditions.NOT_EQUAL]: "Not equals",
[LogicConditions.GREATER_THAN]: "Greater than",
[LogicConditions.LESS_THAN]: "Less than",
} }
module.exports.definition = { module.exports.definition = {
@ -12,7 +19,9 @@ module.exports.definition = {
description: "Filter any workflows which do not meet certain conditions", description: "Filter any workflows which do not meet certain conditions",
type: "LOGIC", type: "LOGIC",
stepId: "FILTER", stepId: "FILTER",
inputs: {}, inputs: {
condition: LogicConditions.EQUALS,
},
schema: { schema: {
inputs: { inputs: {
properties: { properties: {
@ -24,7 +33,7 @@ module.exports.definition = {
type: "string", type: "string",
title: "Condition", title: "Condition",
enum: Object.values(LogicConditions), enum: Object.values(LogicConditions),
default: "equals", pretty: Object.values(PrettyLogicConditions),
}, },
value: { value: {
type: "string", type: "string",

View File

@ -22,7 +22,6 @@ module.exports.definition = {
}, },
customType: "record", customType: "record",
title: "The record to be written", title: "The record to be written",
default: {},
required: ["modelId"], required: ["modelId"],
}, },
}, },