delay start of ui widget to try to let dashboard register first

This commit is contained in:
Dave Conway-Jones 2021-02-23 09:38:55 +00:00
parent 3345189d32
commit 3a17b73ade
No known key found for this signature in database
GPG Key ID: 88BA2B8A411BE9FF
4 changed files with 49 additions and 45 deletions

View File

@ -1,5 +1,6 @@
### Change Log for Node-RED Worldmap
- v2.8.7 - Delay start of ui widget.
- v2.8.6 - Better checking of type property before guessing it's geojson. Issue #153
- v2.8.4 - Add addToForm(n,v) option and $form - to make contextmenu form submission easier.
- v2.8.3 - Let feedback include lat lon for context menu on general map.

View File

@ -11,6 +11,7 @@ map web page for plotting "things" on.
### Updates
- v2.8.7 - Delay start of ui widget.
- v2.8.6 - Better checking of type property before guessing it's geojson. Issue #153
- v2.8.4 - Add addToForm(n,v) option and $form - to make contextmenu form submission easier.
- v2.8.3 - Let feedback include lat lon for context menu on general map.

View File

@ -1,6 +1,6 @@
{
"name": "node-red-contrib-web-worldmap",
"version": "2.8.6",
"version": "2.8.7",
"description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": {
"cgi": "0.3.1",

View File

@ -158,54 +158,56 @@ module.exports = function(RED) {
}
var ui = undefined;
try {
ui = RED.require("node-red-dashboard")(RED);
if (ui) {
function UIWorldMap(config) {
try {
var node = this;
worldMap(node, config);
var done = null;
if (checkConfig(node, config)) {
var html = HTML(ui, 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: false,
convertBack: function (value) {
return value;
},
beforeEmit: function(msg, value) {
return { msg: { items: value } };
},
beforeSend: function (msg, orig) {
if (orig) { return orig.msg; }
},
initController: function($scope, events) {
}
});
setTimeout( function() {
try {
ui = RED.require("node-red-dashboard")(RED);
if (ui) {
function UIWorldMap(config) {
try {
var node = this;
worldMap(node, config);
var done = null;
if (checkConfig(node, config)) {
var html = HTML(ui, 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: false,
convertBack: function (value) {
return value;
},
beforeEmit: function(msg, value) {
return { msg: { items: value } };
},
beforeSend: function (msg, orig) {
if (orig) { return orig.msg; }
},
initController: function($scope, events) {
}
});
}
}
catch (e) {
console.log(e);
}
node.on("close", function() {
if (done) { done(); }
});
}
catch (e) {
console.log(e);
}
node.on("close", function() {
if (done) { done(); }
});
setImmediate(function() { RED.nodes.registerType("ui_worldmap", UIWorldMap) });
}
setImmediate(function() { RED.nodes.registerType("ui_worldmap", UIWorldMap) });
}
}
catch(e) {
RED.log.info("Node-RED Dashboard not found - ui_worldmap not installed.");
}
catch(e) {
RED.log.info("Node-RED Dashboard not found - ui_worldmap not installed.");
}
}, 250);
var WorldMapIn = function(n) {
RED.nodes.createNode(this,n);