Move core node icons into node package
12
packages/node_modules/@node-red/editor/lib/editor/ui.js
generated
vendored
@ -25,6 +25,7 @@ var theme = require("./theme");
|
||||
|
||||
var runtimeAPI;
|
||||
|
||||
var defaultNodeIcon = path.resolve(__dirname+"/../../src/images/icons/arrow-in.png")
|
||||
var templateDir = path.resolve(__dirname+"/../../src/templates");
|
||||
var editorTemplate;
|
||||
|
||||
@ -55,10 +56,15 @@ module.exports = {
|
||||
icon: icon
|
||||
}
|
||||
runtimeAPI.nodes.getIcon(opts).then(function(data) {
|
||||
var contentType = mime.lookup(icon);
|
||||
res.set("Content-Type", contentType);
|
||||
res.send(data);
|
||||
if (data) {
|
||||
var contentType = mime.lookup(icon);
|
||||
res.set("Content-Type", contentType);
|
||||
res.send(data);
|
||||
} else {
|
||||
res.sendFile(defaultNodeIcon);
|
||||
}
|
||||
}).catch(function(err) {
|
||||
console.log(err.stack);
|
||||
apiUtils.rejectHandler(req,res,err);
|
||||
})
|
||||
},
|
||||
|
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
Before Width: | Height: | Size: 386 B After Width: | Height: | Size: 386 B |
4
packages/node_modules/@node-red/editor/src/js/ui/view.js
generated
vendored
@ -2182,8 +2182,8 @@ RED.view = (function() {
|
||||
//node.append("path").attr("class","node_error").attr("d","M 3,-3 l 10,0 l -5,-8 z");
|
||||
|
||||
//TODO: these ought to be SVG
|
||||
node.append("image").attr("class","node_error hidden").attr("xlink:href","icons/node-red/node-error.png").attr("x",0).attr("y",-6).attr("width",10).attr("height",9);
|
||||
node.append("image").attr("class","node_changed hidden").attr("xlink:href","icons/node-red/node-changed.png").attr("x",12).attr("y",-6).attr("width",10).attr("height",10);
|
||||
node.append("image").attr("class","node_error hidden").attr("xlink:href","red/images/icons/node-error.png").attr("x",0).attr("y",-6).attr("width",10).attr("height",9);
|
||||
node.append("image").attr("class","node_changed hidden").attr("xlink:href","red/images/icons/node-changed.png").attr("x",12).attr("y",-6).attr("width",10).attr("height",10);
|
||||
});
|
||||
|
||||
node.each(function(d,i) {
|
||||
|
Before Width: | Height: | Size: 308 B After Width: | Height: | Size: 308 B |
Before Width: | Height: | Size: 603 B After Width: | Height: | Size: 603 B |
BIN
packages/node_modules/@node-red/nodes/icons/arrow-in.png
generated
vendored
Normal file
After Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 712 B After Width: | Height: | Size: 712 B |
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.3 KiB |
Before Width: | Height: | Size: 508 B After Width: | Height: | Size: 508 B |
Before Width: | Height: | Size: 575 B After Width: | Height: | Size: 575 B |
Before Width: | Height: | Size: 493 B After Width: | Height: | Size: 493 B |
Before Width: | Height: | Size: 601 B After Width: | Height: | Size: 601 B |
Before Width: | Height: | Size: 459 B After Width: | Height: | Size: 459 B |
Before Width: | Height: | Size: 218 B After Width: | Height: | Size: 218 B |
Before Width: | Height: | Size: 324 B After Width: | Height: | Size: 324 B |
Before Width: | Height: | Size: 378 B After Width: | Height: | Size: 378 B |
Before Width: | Height: | Size: 542 B After Width: | Height: | Size: 542 B |
Before Width: | Height: | Size: 503 B After Width: | Height: | Size: 503 B |
Before Width: | Height: | Size: 255 B After Width: | Height: | Size: 255 B |
Before Width: | Height: | Size: 457 B After Width: | Height: | Size: 457 B |
Before Width: | Height: | Size: 502 B After Width: | Height: | Size: 502 B |
Before Width: | Height: | Size: 449 B After Width: | Height: | Size: 449 B |
Before Width: | Height: | Size: 253 B After Width: | Height: | Size: 253 B |
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.6 KiB |
Before Width: | Height: | Size: 639 B After Width: | Height: | Size: 639 B |
Before Width: | Height: | Size: 402 B After Width: | Height: | Size: 402 B |
Before Width: | Height: | Size: 414 B After Width: | Height: | Size: 414 B |
Before Width: | Height: | Size: 671 B After Width: | Height: | Size: 671 B |
Before Width: | Height: | Size: 413 B After Width: | Height: | Size: 413 B |
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 467 B After Width: | Height: | Size: 467 B |
Before Width: | Height: | Size: 393 B After Width: | Height: | Size: 393 B |
Before Width: | Height: | Size: 423 B After Width: | Height: | Size: 423 B |
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 360 B |
Before Width: | Height: | Size: 736 B After Width: | Height: | Size: 736 B |
Before Width: | Height: | Size: 482 B After Width: | Height: | Size: 482 B |
Before Width: | Height: | Size: 273 B After Width: | Height: | Size: 273 B |
Before Width: | Height: | Size: 793 B After Width: | Height: | Size: 793 B |
Before Width: | Height: | Size: 256 B After Width: | Height: | Size: 256 B |
Before Width: | Height: | Size: 439 B After Width: | Height: | Size: 439 B |
Before Width: | Height: | Size: 592 B After Width: | Height: | Size: 592 B |
Before Width: | Height: | Size: 509 B After Width: | Height: | Size: 509 B |
Before Width: | Height: | Size: 488 B After Width: | Height: | Size: 488 B |
Before Width: | Height: | Size: 628 B After Width: | Height: | Size: 628 B |
Before Width: | Height: | Size: 258 B After Width: | Height: | Size: 258 B |
Before Width: | Height: | Size: 404 B After Width: | Height: | Size: 404 B |
Before Width: | Height: | Size: 591 B After Width: | Height: | Size: 591 B |
Before Width: | Height: | Size: 707 B After Width: | Height: | Size: 707 B |
6
packages/node_modules/@node-red/registry/localfilesystem.js
generated
vendored
@ -241,14 +241,12 @@ function getNodeFiles(disableNodePathScan) {
|
||||
var nodeFiles = [];
|
||||
var results;
|
||||
|
||||
var dir = path.resolve(__dirname + '/../../public/icons');
|
||||
var iconList = [{path:dir,icons:scanIconDir(dir)}];
|
||||
|
||||
var dir;
|
||||
var iconList = [];
|
||||
if (settings.coreNodesDir) {
|
||||
results = getLocalNodeFiles(path.resolve(settings.coreNodesDir));
|
||||
nodeFiles = nodeFiles.concat(results.files);
|
||||
iconList = iconList.concat(results.icons);
|
||||
|
||||
var defaultLocalesPath = path.join(settings.coreNodesDir,"core","locales");
|
||||
i18n.registerMessageCatalog("node-red",defaultLocalesPath,"messages.json");
|
||||
}
|
||||
|
8
packages/node_modules/@node-red/registry/registry.js
generated
vendored
@ -555,11 +555,8 @@ function setModulePendingUpdated(module,version) {
|
||||
});
|
||||
}
|
||||
|
||||
var icon_paths = {
|
||||
"node-red":[path.resolve(__dirname + '/../editor/public/icons')]
|
||||
};
|
||||
var icon_paths = { };
|
||||
var iconCache = {};
|
||||
var defaultIcon = path.join(icon_paths['node-red'][0],'arrow-in.png');
|
||||
|
||||
function getNodeIconPath(module,icon) {
|
||||
if (/\.\./.test(icon)) {
|
||||
@ -585,8 +582,7 @@ function getNodeIconPath(module,icon) {
|
||||
if (module !== "node-red") {
|
||||
return getNodeIconPath("node-red", icon);
|
||||
}
|
||||
|
||||
return defaultIcon;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
|
20
packages/node_modules/@node-red/runtime/api/nodes.js
generated
vendored
@ -420,19 +420,23 @@ var api = module.exports = {
|
||||
* @param {User} opts.user - the user calling the api
|
||||
* @param {String} opts.module - the id of the module requesting the icon
|
||||
* @param {String} opts.icon - the name of the icon
|
||||
* @return {Promise<Buffer>} - the icon file as a Buffer
|
||||
* @return {Promise<Buffer>} - the icon file as a Buffer or null if no icon available
|
||||
* @memberof RED.nodes
|
||||
*/
|
||||
getIcon: function(opts) {
|
||||
return new Promise(function(resolve,reject) {
|
||||
var iconPath = runtime.nodes.getNodeIconPath(opts.module,opts.icon);
|
||||
fs.readFile(iconPath,function(err,data) {
|
||||
if (err) {
|
||||
err.status = 400;
|
||||
return reject(err);
|
||||
}
|
||||
return resolve(data)
|
||||
});
|
||||
if (iconPath) {
|
||||
fs.readFile(iconPath,function(err,data) {
|
||||
if (err) {
|
||||
err.status = 400;
|
||||
return reject(err);
|
||||
}
|
||||
return resolve(data)
|
||||
});
|
||||
} else {
|
||||
resolve(null);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
4
packages/node_modules/@node-red/runtime/nodes/context/localfilesystem.js
generated
vendored
@ -47,8 +47,8 @@
|
||||
|
||||
var fs = require('fs-extra');
|
||||
var path = require("path");
|
||||
var util = require("../../util");
|
||||
var log = require("../../log");
|
||||
var util = require("@node-red/util").util;
|
||||
var log = require("@node-red/util").log;
|
||||
|
||||
var safeJSONStringify = require("json-stringify-safe");
|
||||
var MemoryStore = require("./memory");
|
||||
|
2
packages/node_modules/node-red/red/red.js
generated
vendored
@ -70,7 +70,7 @@ module.exports = {
|
||||
redUtil.init(userSettings);
|
||||
if (userSettings.httpAdminRoot !== false) {
|
||||
runtime.init(userSettings,redUtil,api);
|
||||
api.init(httpServer,userSettings,runtime.storage,runtime);
|
||||
api.init(httpServer,userSettings,runtime._.storage,runtime);
|
||||
|
||||
apiEnabled = true;
|
||||
server = runtime._.adminApi.server;
|
||||
|