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

Another pass of categorisation

This commit is contained in:
Nick O'Leary 2019-07-09 20:26:26 +01:00
parent 00a3e25714
commit 2b66723d42
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
19 changed files with 40 additions and 35 deletions

View File

@ -19,15 +19,15 @@ RED.palette = (function() {
var exclusion = ['config','unknown','deprecated'];
var coreCategories = [
'subflows',
'flow',
'input',
'output',
'common',
'function',
'input/output',
'sequence',
'parser',
'social',
'mobile',
'storage',
'analysis',
'social',
'mobile',
'advanced'
];
@ -35,6 +35,7 @@ RED.palette = (function() {
var sidebarControls;
function createCategory(originalCategory,rootCategory,category,ns) {
console.log("createCategory",originalCategory,rootCategory,category,ns);
if ($("#red-ui-palette-base-category-"+rootCategory).length === 0) {
createCategoryContainer(originalCategory,rootCategory, ns+":palette.label."+rootCategory);
}
@ -44,6 +45,7 @@ RED.palette = (function() {
}
}
function createCategoryContainer(originalCategory,category, labelId) {
console.log("createCategoryContainer",originalCategory,category,labelId);
var label = RED._(labelId, {defaultValue:category});
label = (label || category).replace(/_/g, " ");
var catDiv = $('<div id="red-ui-palette-container-'+category+'" class="red-ui-palette-category hide">'+
@ -165,6 +167,9 @@ 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;
@ -172,7 +177,7 @@ RED.palette = (function() {
if (exclusion.indexOf(def.category)===-1) {
var originalCategory = def.category;
var category = def.category.replace(/ /g,"_");
var category = escapeCategory(def.category);
var rootCategory = category.split("-")[0];
var d = $('<div>',{class:"red-ui-palette-node"}).attr("data-palette-type",nt).data('category',rootCategory);
@ -423,7 +428,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");
@ -556,7 +561,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: 'flow',
category: 'common',
color:"#a6bbcf",
defaults: {
name: {value:""},

View File

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

View File

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

View File

@ -21,7 +21,7 @@
<script type="text/javascript">
RED.nodes.registerType('status',{
category: 'flow',
category: 'common',
color:"#d9f4fd",
defaults: {
name: {value:""},

View File

@ -162,7 +162,7 @@
}
RED.nodes.registerType('link in',{
category: 'flow',
category: 'common',
color:"#ddd",//"#87D8CF",
defaults: {
name: {value:""},
@ -191,7 +191,7 @@
});
RED.nodes.registerType('link out',{
category: 'flow',
category: 'common',
color:"#ddd",//"#87D8CF",
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:""},

View File

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

View File

@ -46,7 +46,7 @@
<script type="text/javascript">
RED.nodes.registerType('mqtt in',{
category: 'input',
category: 'input/output',
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: 'input/output',
defaults: {
name: {value:""},
topic: {value:""},

View File

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

View File

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

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

@ -57,7 +57,7 @@
<script type="text/javascript">
RED.nodes.registerType('tcp in',{
category: 'input',
category: 'input/output',
color:"Silver",
defaults: {
name: {value:""},
@ -143,7 +143,7 @@
<script type="text/javascript">
RED.nodes.registerType('tcp out',{
category: 'output',
category: 'input/output',
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: 'input/output',
color:"Silver",
defaults: {
server: {value:""},

View File

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

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:""},