1
0
mirror of https://github.com/node-red/node-red.git synced 2023-10-10 13:36:53 +02:00

Merge pull request #2213 from node-red/node-categories

Change core node categories
This commit is contained in:
Nick O'Leary 2019-08-21 16:04:44 +01:00 committed by GitHub
commit 74eec25285
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
211 changed files with 105 additions and 85 deletions

View File

@ -17,7 +17,21 @@
RED.palette = (function() {
var exclusion = ['config','unknown','deprecated'];
var coreCategories = ['subflows', 'input', 'output', 'function', 'social', 'mobile', 'storage', 'analysis', 'advanced'];
var coreCategories = [
'subflows',
'common',
'function',
'network',
'input',
'output',
'sequence',
'parser',
'storage',
'analysis',
'social',
'mobile',
'advanced'
];
var categoryContainers = {};
var sidebarControls;
@ -37,6 +51,7 @@ RED.palette = (function() {
var catDiv = $('<div id="red-ui-palette-container-'+category+'" class="red-ui-palette-category hide">'+
'<div id="red-ui-palette-header-'+category+'" class="red-ui-palette-header"><i class="expanded fa fa-angle-down"></i><span>'+label+'</span></div>'+
'<div class="red-ui-palette-content" id="red-ui-palette-base-category-'+category+'">'+
'<div id="red-ui-palette-'+category+'"></div>'+
'<div id="red-ui-palette-'+category+'-input"></div>'+
'<div id="red-ui-palette-'+category+'-output"></div>'+
'<div id="red-ui-palette-'+category+'-function"></div>'+
@ -153,19 +168,24 @@ RED.palette = (function() {
return $(".red-ui-palette-node[data-palette-type='"+type+"']");
}
function escapeCategory(category) {
return category.replace(/[ /.]/g,"_");
}
function addNodeType(nt,def) {
if (getPaletteNode(nt).length) {
return;
}
if (exclusion.indexOf(def.category)===-1) {
var nodeCategory = def.category;
var originalCategory = def.category;
var category = def.category.replace(/ /g,"_");
if (exclusion.indexOf(nodeCategory)===-1) {
var originalCategory = nodeCategory;
var category = escapeCategory(nodeCategory);
var rootCategory = category.split("-")[0];
var d = $('<div>',{class:"red-ui-palette-node"}).attr("data-palette-type",nt).data('category',rootCategory);
var label = /^(.*?)([ -]in|[ -]out)?$/.exec(nt)[1];
var label = nt;///^(.*?)([ -]in|[ -]out)?$/.exec(nt)[1];
if (typeof def.paletteLabel !== "undefined") {
try {
label = (typeof def.paletteLabel === "function" ? def.paletteLabel.call(def) : def.paletteLabel)||"";
@ -203,7 +223,7 @@ RED.palette = (function() {
d.append(portIn);
}
createCategory(def.category,rootCategory,category,(coreCategories.indexOf(rootCategory) !== -1)?"node-red":def.set.id);
createCategory(nodeCategory,rootCategory,category,(coreCategories.indexOf(rootCategory) !== -1)?"node-red":def.set.id);
$("#red-ui-palette-"+category).append(d);
@ -411,7 +431,7 @@ RED.palette = (function() {
var currentCategory = paletteNode.data('category');
var newCategory = (sf.category||"subflows");
if (currentCategory !== newCategory) {
var category = newCategory.replace(/ /g,"_");
var category = escapeCategory(newCategory);
createCategory(newCategory,category,category,"node-red");
var currentCategoryNode = paletteNode.closest(".red-ui-palette-category");
@ -544,7 +564,7 @@ RED.palette = (function() {
categoryList = coreCategories
}
categoryList.forEach(function(category){
createCategoryContainer(category, category, "palette.label."+category);
createCategoryContainer(category, escapeCategory(category), "palette.label."+escapeCategory(category));
});

View File

@ -156,7 +156,7 @@
<script type="text/javascript">
RED.nodes.registerType('inject',{
category: 'input',
category: 'common',
color:"#a6bbcf",
defaults: {
name: {value:""},

View File

@ -37,7 +37,7 @@
(function() {
var subWindow = null;
RED.nodes.registerType('debug',{
category: 'output',
category: 'common',
defaults: {
name: {value:""},
active: {value:true},

View File

@ -13,7 +13,7 @@
</script>
<script type="text/javascript">
RED.nodes.registerType('complete',{
category: 'input',
category: 'common',
color:"#c0edc0",
defaults: {
name: {value:""},

View File

@ -25,7 +25,7 @@
</script>
<script type="text/javascript">
RED.nodes.registerType('catch',{
category: 'input',
category: 'common',
color:"#e49191",
defaults: {
name: {value:""},

View File

@ -21,15 +21,15 @@
<script type="text/javascript">
RED.nodes.registerType('status',{
category: 'input',
color:"#d9f4fd",
category: 'common',
color:"#94c1d0",
defaults: {
name: {value:""},
scope: {value:null}
},
inputs:0,
outputs:1,
icon: "alert.svg",
icon: "status.svg",
label: function() {
return this.name||(this.scope?this._("status.statusNodes",{number:this.scope.length}):this._("status.status"));
},

View File

@ -162,7 +162,7 @@
}
RED.nodes.registerType('link in',{
category: 'input',
category: 'common',
color:"#ddd",//"#87D8CF",
defaults: {
name: {value:""},
@ -191,7 +191,7 @@
});
RED.nodes.registerType('link out',{
category: 'output',
category: 'common',
color:"#ddd",//"#87D8CF",
defaults: {
name: {value:""},

View File

@ -12,7 +12,7 @@
<script type="text/javascript">
RED.nodes.registerType('comment',{
category: 'function',
category: 'common',
color:"#ffffff",
defaults: {
name: {value:""},

View File

@ -53,7 +53,7 @@
<script type="text/javascript">
RED.nodes.registerType('exec',{
category: 'advanced-function',
category: 'function',
color:"darksalmon",
defaults: {
command: {value:""},
@ -73,8 +73,7 @@
this._("exec.label.retcode")
][i];
},
icon: "arrow-in.svg",
align: "right",
icon: "cog.svg",
label: function() {
return this.name||this.command||(this.useSpawn=="true"?this._("exec.spawn"):this._("exec.exec"));
},

View File

@ -46,7 +46,7 @@
<script type="text/javascript">
RED.nodes.registerType('mqtt in',{
category: 'input',
category: 'network',
defaults: {
name: {value:""},
topic: {value:"",required:true,validate: RED.validators.regex(/^(#$|(\+|[^+#]*)(\/(\+|[^+#]*))*(\/(\+|#|[^+#]*))?$)/)},
@ -107,7 +107,7 @@
<script type="text/javascript">
RED.nodes.registerType('mqtt out',{
category: 'output',
category: 'network',
defaults: {
name: {value:""},
topic: {value:""},

View File

@ -66,7 +66,7 @@
<script type="text/javascript">
(function() {
RED.nodes.registerType('http in',{
category: 'input',
category: 'network',
color:"rgb(231, 231, 174)",
defaults: {
name: {value:""},
@ -142,7 +142,7 @@
];
RED.nodes.registerType('http response',{
category: 'output',
category: 'network',
color:"rgb(231, 231, 174)",
defaults: {
name: {value:""},

View File

@ -98,7 +98,7 @@
<script type="text/javascript">
RED.nodes.registerType('http request',{
category: 'function',
category: 'network',
color:"rgb(231, 231, 174)",
defaults: {
name: {value:""},

View File

@ -97,7 +97,7 @@
}
RED.nodes.registerType('websocket in',{
category: 'input',
category: 'network',
defaults: {
name: {value:""},
server: {type:"websocket-listener", validate: ws_validateserver},
@ -116,7 +116,7 @@
});
RED.nodes.registerType('websocket out',{
category: 'output',
category: 'network',
defaults: {
name: {value:""},
server: {type:"websocket-listener", validate: ws_validateserver},

View File

@ -57,7 +57,7 @@
<script type="text/javascript">
RED.nodes.registerType('tcp in',{
category: 'input',
category: 'network',
color:"Silver",
defaults: {
name: {value:""},
@ -143,7 +143,7 @@
<script type="text/javascript">
RED.nodes.registerType('tcp out',{
category: 'output',
category: 'network',
color:"Silver",
defaults: {
host: {value:"",validate:function(v) { return (this.beserver != "client")||v.length > 0;} },
@ -215,7 +215,7 @@
<script type="text/javascript">
RED.nodes.registerType('tcp request',{
category: 'function',
category: 'network',
color:"Silver",
defaults: {
server: {value:""},

View File

@ -57,7 +57,7 @@
<script type="text/javascript">
RED.nodes.registerType('udp in',{
category: 'input',
category: 'network',
color:"Silver",
defaults: {
name: {value:""},
@ -159,7 +159,7 @@
<script type="text/javascript">
RED.nodes.registerType('udp out',{
category: 'output',
category: 'network',
color:"Silver",
defaults: {
name: {value:""},

View File

@ -62,7 +62,7 @@
<script type="text/javascript">
RED.nodes.registerType('csv',{
category: 'function',
category: 'parser',
color:"#DEBD5C",
defaults: {
name: {value:""},

View File

@ -37,7 +37,7 @@
<script type="text/javascript">
RED.nodes.registerType('html',{
category: 'function',
category: 'parser',
color:"#DEBD5C",
defaults: {
name: {value:""},

View File

@ -27,7 +27,7 @@
<script type="text/javascript">
RED.nodes.registerType('json',{
category: 'function',
category: 'parser',
color:"#DEBD5C",
defaults: {
name: {value:""},

View File

@ -22,7 +22,7 @@
<script type="text/javascript">
RED.nodes.registerType('xml',{
category: 'function',
category: 'parser',
color:"#DEBD5C",
defaults: {
name: {value:""},

View File

@ -12,7 +12,7 @@
<script type="text/javascript">
RED.nodes.registerType('yaml',{
category: 'function',
category: 'parser',
color:"#DEBD5C",
defaults: {
property: {value:"payload",required:true},

View File

@ -48,7 +48,7 @@
<script type="text/javascript">
RED.nodes.registerType('split',{
category: 'function',
category: 'sequence',
color:"#E2D96E",
defaults: {
name: {value:""},
@ -196,7 +196,7 @@
<script type="text/javascript">
RED.nodes.registerType('join',{
category: 'function',
category: 'sequence',
color:"#E2D96E",
defaults: {
name: {value:""},

View File

@ -60,7 +60,7 @@
<script type="text/javascript">
RED.nodes.registerType('sort',{
category: 'function',
category: 'sequence',
color:"#E2D96E",
defaults: {
name: { value:"" },

View File

@ -68,7 +68,7 @@
<script type="text/javascript">
RED.nodes.registerType("batch",{
category: "function",
category: "sequence",
color:"#E2D96E",
defaults: {
name: {value:""},

View File

@ -193,7 +193,7 @@
];
RED.nodes.registerType('file',{
category: 'storage-output',
category: 'storage',
defaults: {
name: {value:""},
filename: {value:""},
@ -258,7 +258,7 @@
});
RED.nodes.registerType('file in',{
category: 'storage-input',
category: 'storage',
defaults: {
name: {value:""},
filename: {value:""},

View File

@ -33,7 +33,7 @@
<script type="text/javascript">
RED.nodes.registerType('watch',{
category: 'advanced-input',
category: 'storage',
defaults: {
name: {value:""},
files: {value:"",required:true},

View File

@ -1 +1 @@
<svg width="40" height="60" xmlns="http://www.w3.org/2000/svg"><path d="M36.19 28.6c0 6.088-7.289 11.024-16.28 11.024a23.98 23.98 0 0 1-2.982-.185c-1.272-.159-7.933 7.526-13.113 6.53.18-2.004 8.18-6.004 5.87-8.79C5.993 35.16 3.63 32.066 3.63 28.6c0-6.088 7.289-11.024 16.28-11.024 8.991 0 16.28 4.936 16.28 11.024z" fill="#fff" stroke="#868686" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" style="isolation:auto;mix-blend-mode:normal"/></svg>
<svg width="40" height="60" xmlns="http://www.w3.org/2000/svg"><path d="M36.19 28.6c0 6.088-7.289 11.024-16.28 11.024a23.98 23.98 0 0 1-2.982-.185c-1.272-.159-7.933 7.526-13.113 6.53.18-2.004 8.18-6.004 5.87-8.79C5.993 35.16 3.63 32.066 3.63 28.6c0-6.088 7.289-11.024 16.28-11.024 8.991 0 16.28 4.936 16.28 11.024z" fill="#fff" stroke="#bababa" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" style="isolation:auto;mix-blend-mode:normal"/></svg>

Before

Width:  |  Height:  |  Size: 464 B

After

Width:  |  Height:  |  Size: 464 B

View File

@ -0,0 +1 @@
<svg width="40" height="60" xmlns="http://www.w3.org/2000/svg"><path d="M0 30h9l3.5-10 5 25 5.125-30L27.5 40 31 30h9" fill="none" stroke="#fff" stroke-miterlimit="6.5" stroke-width="4"/></svg>

After

Width:  |  Height:  |  Size: 193 B

Some files were not shown because too many files have changed in this diff Show More