disable ui_worldmap if Node-RED Dashboard not installed (#113)
This commit is contained in:
parent
f8a4f4207e
commit
76423e11cd
@ -359,6 +359,8 @@ then by default <code>⌘⇧m</code> - <code>ctrl-shift-m</code> will load the m
|
||||
}
|
||||
});
|
||||
|
||||
$.get('/.ui-worldmap', function (data) {
|
||||
if (data === "true") {
|
||||
RED.nodes.registerType('ui_worldmap',{
|
||||
category: 'dashboard',
|
||||
color: 'rgb( 63, 173, 181)',
|
||||
@ -430,6 +432,11 @@ then by default <code>⌘⇧m</code> - <code>ctrl-shift-m</code> will load the m
|
||||
$("#node-input-cluster").spinner({min:0, max:19});
|
||||
}
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log("ui_worldmap: Node-RED not found.");
|
||||
}
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-template-name="worldmap in">
|
||||
|
16
worldmap.js
16
worldmap.js
@ -152,13 +152,13 @@ module.exports = function(RED) {
|
||||
}
|
||||
|
||||
var ui = undefined;
|
||||
try {
|
||||
ui = RED.require("node-red-dashboard")(RED);
|
||||
|
||||
if(ui) {
|
||||
function UIWorldMap(config) {
|
||||
try {
|
||||
var node = this;
|
||||
if(ui === undefined) {
|
||||
ui = RED.require("node-red-dashboard")(RED);
|
||||
}
|
||||
worldMap(node, config);
|
||||
var done = null;
|
||||
if (checkConfig(node, config)) {
|
||||
@ -198,6 +198,12 @@ module.exports = function(RED) {
|
||||
});
|
||||
}
|
||||
RED.nodes.registerType("ui_worldmap", UIWorldMap);
|
||||
}
|
||||
}
|
||||
catch(e) {
|
||||
RED.log.info("Node-RED Dashboard not found.");
|
||||
RED.log.info("ui_worldmap not installed.");
|
||||
}
|
||||
|
||||
var WorldMapIn = function(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
@ -341,4 +347,8 @@ module.exports = function(RED) {
|
||||
});
|
||||
}
|
||||
RED.nodes.registerType("worldmap-tracks",WorldMapTracks);
|
||||
|
||||
RED.httpNode.get("/.ui-worldmap", function(req, res) {
|
||||
res.send(ui ? "true": "false");
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user