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 ### 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.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.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. - 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 ### 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.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.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. - 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", "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.", "description": "A Node-RED node to provide a web page of a world map for plotting things on.",
"dependencies": { "dependencies": {
"cgi": "0.3.1", "cgi": "0.3.1",

View File

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