Skip to content

Commit

Permalink
merge main
Browse files Browse the repository at this point in the history
  • Loading branch information
luisthieme committed Aug 27, 2024
2 parents 07fe162 + 3d5d585 commit 23f3bca
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 7 deletions.
13 changes: 13 additions & 0 deletions nodes/ui-dynamic-form.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,19 @@ module.exports = function (RED) {
// store the latest value in our Node-RED datastore
base.stores.data.save(base, node, msg);
},
// TODO: mm - begin
// onSocket: {
// 'my-custom-event': function (conn, id, msg) {
// console.info('"my-custom-event" received:', conn.id, id, msg);
// console.info('conn.id:', conn.id);
// console.info('id:', id);
// console.info('msg:', msg);
// console.info('node.id:', node.id);
// // emit a msg in Node-RED from this node
// node.send(msg);
// },
//},
// TODO: mm - end
};

// inform the dashboard UI that we are adding this node
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 6 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@5minds/node-red-dashboard-2-processcube-dynamic-form",
"version": "1.0.21",
"version": "1.0.24",
"description": "The ui component for the ProcessCube dynamic-form",
"keywords": [
"processcube",
Expand All @@ -10,7 +10,7 @@
],
"repository": {
"type": "git",
"url": "https://github.com/5minds/.gitnode-red-dashboard-2-processcube-dynamic-form"
"url": "https://github.com/5minds/node-red-dashboard-2-processcube-dynamic-form"
},
"license": "Apache-2.0",
"author": {
Expand All @@ -25,6 +25,10 @@
{
"name": "Luis Thieme",
"url": "https://github.com/luisthieme"
},
{
"name": "Colin Law",
"url": "https://github.com/colinl"
}
],
"exports": {
Expand Down
13 changes: 11 additions & 2 deletions ui/components/UIDynamicForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ export default {
// store the latest message in our client-side vuex store when we receive a new message
this.init();
this.msg = msg;
this.messages[this.id] = msg;
const hasTask = msg.payload && msg.payload.userTask;
const defaultValues = msg.payload.userTask.userTaskConfig.formFields;
Expand Down Expand Up @@ -169,15 +169,24 @@ export default {
actionFn(action) {
if (this.checkCondition(action.condition)) {
this.showError(false, '');
// TODO: MM - begin
// this.send(
// { payload: { formData: this.formData, userTask: this.userTask() } },
// this.actions.findIndex((element) => element.label === action.label)
// );
const msg = this.messages[this.id] || {};
msg.payload = { formData: this.formData, userTask: this.userTask() };
this.send(
{ payload: { formData: this.formData, userTask: this.userTask() } },
msg,
this.actions.findIndex((element) => element.label === action.label)
);
// TODO: mm - end
} else {
this.showError(true, action.errorMessage);
}
},
checkCondition(condition) {
if (condition == '') return true;
try {
const func = Function('fields', 'userTask', 'msg', '"use strict"; return (' + condition + ')');
const result = func(this.formData, this.taskInput, this.msg);
Expand Down
2 changes: 1 addition & 1 deletion ui/index.js
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
/* Exports of all of the components in this node */
export { default as UIDynamicForm } from './components/UIDynamicForm.vue'
export { default as UIDynamicForm } from './components/UIDynamicForm.vue';

0 comments on commit 23f3bca

Please sign in to comment.