Skip to content

Commit

Permalink
Ensure socketid is passed if present.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dave Conway-Jones committed Oct 30, 2020
1 parent f2bb9cb commit 8bbe241
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 43 deletions.
2 changes: 1 addition & 1 deletion node-red-node-ui-list/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-node-ui-list",
"version": "0.3.3",
"version": "0.3.4",
"description": "Node-RED Dashboard UI widget node for simple list",
"author": "Hiroyasu Nishiyama",
"contributors": [
Expand Down
2 changes: 1 addition & 1 deletion node-red-node-ui-list/ui_list.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ ${(allowMenu ? md_menu : "")}
return i;
});
}
return { msg: { items: value } };
return { msg: { items:value, socketid:msg.socketid } };
},
beforeSend: function (msg, orig) {
if (orig) {
Expand Down
19 changes: 10 additions & 9 deletions node-red-node-ui-table/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,21 +112,22 @@ module.exports = function (RED) {
"tabulator":{
"columns":config.columns
}};
}
}
// use mergeTabulator to correctly merge columns arrays if field property matches
mergeTabulator(config.ui_control,msg.ui_control);

// delete column definitions by sending a empty columns array (requires page reload)
if (msg.ui_control.tabulator && msg.ui_control.tabulator.columns && Array.isArray(msg.ui_control.tabulator.columns) &&
msg.ui_control.tabulator.columns.length==0) {

config.ui_control.tabulator.columns=[];
config.ui_control.tabulator.autoColumns=true;
}
}
return { msg: {
payload: value,
ui_control: config.ui_control
payload: value,
ui_control: config.ui_control,
socketid: msg.socketid
}};
},
beforeSend: function (msg, orig) {
Expand Down Expand Up @@ -172,9 +173,9 @@ module.exports = function (RED) {
} else {
opts.height = $scope.height*(sizes.sy+sizes.cy);
}
}
}
else { // configuration via ui_control
//as Object.assign is not supported by Internet Explorer
//as Object.assign is not supported by Internet Explorer
//opts = Object.assign(opts, ui_control.tabulator);
mergeObject(opts,ui_control.tabulator);
var y = (opts.columns && (opts.columns.length > 0)) ? 32 : 25;
Expand Down Expand Up @@ -282,9 +283,9 @@ module.exports = function (RED) {
}
return;
} // end of commands to tabulator via msg.payload object

}

if ($scope.inited == false) {
return;
} else {
Expand Down
2 changes: 1 addition & 1 deletion node-red-node-ui-table/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-node-ui-table",
"version": "0.3.6",
"version": "0.3.7",
"description": "Table UI widget node for Node-RED Dashboard",
"author": "Kazuhito Yokoi",
"contributors": ["Dave Conway-Jones","@hotNipi","@Christian-Me"],
Expand Down
2 changes: 1 addition & 1 deletion node-red-node-ui-vega/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-red-node-ui-vega",
"version": "0.1.2",
"version": "0.1.3",
"description": "Node-RED UI widget node for Vega visualization grammar",
"author" : "Hiroyasu Nishiyama",
"contributors": [
Expand Down
60 changes: 30 additions & 30 deletions node-red-node-ui-vega/ui_vega.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ function loadScripts(list, callback) {
script.onload = script.onreadystatechange = function() {
if (!done) {
if (!this.readyState ||
(this.readyState === "loaded") ||
(this.readyState === "loaded") ||
(this.readyState === "complete")) {
done = true;
loadScripts(list, callback);
Expand All @@ -63,15 +63,15 @@ function loadScripts(list, callback) {
}
function showVega(spec) {
vegaEmbed('#${vid}', spec,
vegaEmbed('#${vid}', spec,
{
actions: false
});
}
loadScripts(["https://cdn.jsdelivr.net/npm/[email protected]",
"https://cdn.jsdelivr.net/npm/[email protected]",
"https://cdn.jsdelivr.net/npm/[email protected]"],
loadScripts(["https://cdn.jsdelivr.net/npm/[email protected]",
"https://cdn.jsdelivr.net/npm/[email protected]",
"https://cdn.jsdelivr.net/npm/[email protected]"],
function() {
`+
"var vegaSpec = " +vegaSpec +";" +
Expand Down Expand Up @@ -107,32 +107,32 @@ loadScripts(["https://cdn.jsdelivr.net/npm/[email protected]",
RED.nodes.createNode(this, config);
var done = null;
if (checkConfig(node, config)) {
var html = HTML(config);
done = ui.addWidget({
node: node,
order: config.order,
group: config.group,
width: config.width,
height: config.height,
format: html,
templateScope: "local",
emitOnlyNewValues: false,
forwardInputMessages: false,
storeFrontEndInputAsState: true,
convertBack: function (value) {
return value;
},
beforeEmit: function(msg, value) {
return { msg: { payload: value } };
},
beforeSend: function (msg, orig) {
if (orig) {
return orig.msg;
var html = HTML(config);
done = ui.addWidget({
node: node,
order: config.order,
group: config.group,
width: config.width,
height: config.height,
format: html,
templateScope: "local",
emitOnlyNewValues: false,
forwardInputMessages: false,
storeFrontEndInputAsState: true,
convertBack: function (value) {
return value;
},
beforeEmit: function(msg, value) {
return { msg: { payload:value, socketid:msg.socketid } };
},
beforeSend: function (msg, orig) {
if (orig) {
return orig.msg;
}
},
initController: function($scope, events) {
}
},
initController: function($scope, events) {
}
});
});
}
}
catch (e) {
Expand Down

0 comments on commit 8bbe241

Please sign in to comment.