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:
parent
00a3e25714
commit
2b66723d42
@ -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));
|
||||
});
|
||||
|
||||
|
||||
|
@ -156,7 +156,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('inject',{
|
||||
category: 'flow',
|
||||
category: 'common',
|
||||
color:"#a6bbcf",
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
|
@ -37,7 +37,7 @@
|
||||
(function() {
|
||||
var subWindow = null;
|
||||
RED.nodes.registerType('debug',{
|
||||
category: 'flow',
|
||||
category: 'common',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
active: {value:true},
|
||||
|
@ -25,7 +25,7 @@
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('catch',{
|
||||
category: 'flow',
|
||||
category: 'common',
|
||||
color:"#e49191",
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
|
@ -21,7 +21,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('status',{
|
||||
category: 'flow',
|
||||
category: 'common',
|
||||
color:"#d9f4fd",
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
|
@ -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:""},
|
||||
|
@ -53,7 +53,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('exec',{
|
||||
category: 'advanced-function',
|
||||
category: 'function',
|
||||
color:"darksalmon",
|
||||
defaults: {
|
||||
command: {value:""},
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('comment',{
|
||||
category: 'flow',
|
||||
category: 'common',
|
||||
color:"#ffffff",
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
|
@ -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:""},
|
||||
|
@ -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:""},
|
||||
|
@ -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:""},
|
||||
|
@ -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},
|
||||
|
@ -33,7 +33,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('watch',{
|
||||
category: 'advanced-input',
|
||||
category: 'storage',
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
files: {value:"",required:true},
|
||||
|
@ -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:""},
|
||||
|
@ -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:""},
|
||||
|
@ -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:""},
|
||||
|
@ -60,7 +60,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType('sort',{
|
||||
category: 'function',
|
||||
category: 'sequence',
|
||||
color:"#E2D96E",
|
||||
defaults: {
|
||||
name: { value:"" },
|
||||
|
@ -68,7 +68,7 @@
|
||||
|
||||
<script type="text/javascript">
|
||||
RED.nodes.registerType("batch",{
|
||||
category: "function",
|
||||
category: "sequence",
|
||||
color:"#E2D96E",
|
||||
defaults: {
|
||||
name: {value:""},
|
||||
|
@ -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:""},
|
||||
|
Loading…
Reference in New Issue
Block a user