Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions lib/components/state-resources/awaiting-human-input/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
const jp = require('jsonpath')
const _ = require('lodash')
const resolveInputPaths = require('@wmfs/json-path-input-resolver')

const getFromObject = (obj, path, defaultValue) => {
const result = String.prototype.split.call(path, /[,[\].]+?/)
Expand All @@ -15,6 +16,7 @@ class AwaitingHumanInput {
this.uiName = resourceConfig.uiName
this.uiType = resourceConfig.uiType
this.uiRefresh = resourceConfig.uiRefresh
this.uiListener = resourceConfig.uiListener
this.dataPath = resourceConfig.dataPath
this.defaults = resourceConfig.defaults

Expand Down Expand Up @@ -50,6 +52,7 @@ class AwaitingHumanInput {
uiName: this.uiName,
uiType: this.uiType,
uiRefresh: this.uiRefresh,
uiListener: resolveUiListener(event, this.uiListener),
data
}

Expand Down Expand Up @@ -91,4 +94,9 @@ class AwaitingHumanInput {
} // run
} // class AwaitingHumanInput

function resolveUiListener (data, config) {
if (!Array.isArray(config)) return []
return config.map(c => resolveInputPaths(data, c))
}

module.exports = AwaitingHumanInput
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,10 @@
"type": "integer",
"description": "If the uiType is progress, the suggest refresh time in seconds"
},
"uiListener": {
"type": "string",
"description": "Key value of event to listen for"
},
"dataPath": {
"type": "string",
"description": "Path to data"
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
},
"main": "./lib/index.js",
"dependencies": {
"@wmfs/json-path-input-resolver": "1.1.0",
"@wmfs/form-maker": "1.9.0",
"jsonfile": "6.1.0",
"jsonpath": "1.1.1",
Expand Down