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.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 = [
{
name: module.exports.USER_MANAGEMENT,

View File

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

View File

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

View File

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