").appendTo(content);
+ var globalCategories = $("
").appendTo(content);
+
+ var showUnusedOnly = false;
+
+ // $('
'+
+ // ''+
+ // '
'+
+ // '
'+
+ // '
'+
+ // ''+
+ // '
'+
+ // '
').appendTo(content);
+
+ var categories = {};
+
+ function getOrCreateCategory(name,parent,label) {
+ name = name.replace(/\./i,"-");
+ if (!categories[name]) {
+ var container = $('
').appendTo(parent);
+ var header = $('').appendTo(container);
+ if (label) {
+ $('
').text(label).appendTo(header);
+ } else {
+ $('
').appendTo(header);
+ }
+ category = $('').appendTo(container);
+ container.i18n();
+ var icon = header.find("i");
+ var result = {
+ list: category,
+ size: function() {
+ return result.list.find("li:not(.config_node_none)").length
+ },
+ open: function(snap) {
+ if (!icon.hasClass("expanded")) {
+ icon.addClass("expanded");
+ if (snap) {
+ result.list.show();
+ } else {
+ result.list.slideDown();
+ }
+ }
+ },
+ close: function(snap) {
+ if (icon.hasClass("expanded")) {
+ icon.removeClass("expanded");
+ if (snap) {
+ result.list.hide();
+ } else {
+ result.list.slideUp();
+ }
+ }
+ }
+ };
+
+ header.on('click', function(e) {
+ if (icon.hasClass("expanded")) {
+ result.close();
+ } else {
+ result.open();
+ }
+ });
+ categories[name] = result;
+ }
+ return categories[name];
+ }
+
+ function createConfigNodeList(id,nodes) {
+ var category = getOrCreateCategory(id.replace(/\./i,"-"))
+ var list = category.list;
- function createConfigNodeList(nodes,list) {
nodes.sort(function(A,B) {
if (A.type < B.type) { return -1;}
if (A.type > B.type) { return 1;}
return 0;
});
+ if (showUnusedOnly) {
+ nodes = nodes.filter(function(n) {
+ return n.users.length === 0;
+ })
+ }
+ // console.log(list);
list.empty();
if (nodes.length === 0) {
$('NONE').i18n().appendTo(list);
+ category.close(true);
} else {
var currentType = "";
nodes.forEach(function(node) {
@@ -86,23 +163,44 @@ RED.sidebar.config = (function() {
RED.view.redraw();
});
});
+ category.open(true);
}
}
function refreshConfigNodeList() {
+ var validList = {"global":true};
- var localConfigNodes = [];
+ getOrCreateCategory("global",globalCategories);
+
+ RED.nodes.eachWorkspace(function(ws) {
+ validList[ws.id] = true;
+ getOrCreateCategory(ws.id,flowCategories,ws.label);
+ })
+ RED.nodes.eachSubflow(function(sf) {
+ validList[sf.id] = true;
+ getOrCreateCategory(sf.id,subflowCategories,sf.name);
+ })
+ // $(".workspace-config-node-category").each(function() {
+ // if (!validList[$(this).attr('id').substring("workspace-config-node-category-".length)]) {
+ // $(this).remove();
+ // }
+ // })
var globalConfigNodes = [];
-
+ var configList = {};
RED.nodes.eachConfig(function(cn) {
- if (cn.z == RED.workspaces.active()) {
- localConfigNodes.push(cn);
+ if (cn.z) {//} == RED.workspaces.active()) {
+ configList[cn.z] = configList[cn.z]||[];
+ configList[cn.z].push(cn);
} else if (!cn.z) {
globalConfigNodes.push(cn);
}
});
- createConfigNodeList(localConfigNodes,$("#workspace-config-node-tray-locals"));
- createConfigNodeList(globalConfigNodes,$("#workspace-config-node-tray-globals"));
+ for (var id in validList) {
+ if (validList.hasOwnProperty(id)) {
+ createConfigNodeList(id,configList[id]||[]);
+ }
+ }
+ createConfigNodeList('global',globalConfigNodes);
}
function init() {
@@ -111,6 +209,7 @@ RED.sidebar.config = (function() {
label: RED._("sidebar.config.label"),
name: RED._("sidebar.config.name"),
content: content,
+ toolbar: toolbar,
closeable: true,
visible: false,
onchange: function() { refreshConfigNodeList(); }
@@ -119,17 +218,36 @@ RED.sidebar.config = (function() {
RED.menu.setAction('menu-item-config-nodes',function() {
RED.sidebar.show('config');
})
- $(".workspace-config-node-tray-header").on('click', function(e) {
- var icon = $(this).find("i");
- if (icon.hasClass("expanded")) {
- icon.removeClass("expanded");
- $(this).next().slideUp();
- } else {
- icon.addClass("expanded");
- $(this).next().slideDown();
- }
+ $("#workspace-config-node-collapse-all").on("click", function(e) {
+ e.preventDefault();
+ for (var cat in categories) {
+ if (categories.hasOwnProperty(cat)) {
+ categories[cat].close();
+ }
+ }
});
+ $("#workspace-config-node-expand-all").on("click", function(e) {
+ e.preventDefault();
+ for (var cat in categories) {
+ if (categories.hasOwnProperty(cat)) {
+ if (categories[cat].size() > 0) {
+ categories[cat].open();
+ }
+ }
+ }
+ });
+ $('#workspace-config-node-filter-unused').on("click",function(e) {
+ e.preventDefault();
+ if (showUnusedOnly) {
+ $(this).find("i").addClass('fa-square-o').removeClass('fa-check-square-o');
+ } else {
+ $(this).find("i").removeClass('fa-square-o').addClass('fa-check-square-o');
+ }
+ showUnusedOnly = !showUnusedOnly;
+ refreshConfigNodeList();
+ })
+
}
function show() {
diff --git a/editor/js/ui/workspaces.js b/editor/js/ui/workspaces.js
index 29b37a56d..e4af50d0c 100644
--- a/editor/js/ui/workspaces.js
+++ b/editor/js/ui/workspaces.js
@@ -28,7 +28,6 @@ RED.workspaces = (function() {
var tabId = RED.nodes.id();
do {
workspaceIndex += 1;
- //TODO: nls of Sheet
} while($("#workspace-tabs a[title='"+RED._('workspace.defaultName',{number:workspaceIndex})+"']").size() !== 0);
ws = {type:"tab",id:tabId,label:RED._('workspace.defaultName',{number:workspaceIndex})};
diff --git a/editor/sass/sidebar.scss b/editor/sass/sidebar.scss
index e608d7d5e..e33889587 100644
--- a/editor/sass/sidebar.scss
+++ b/editor/sass/sidebar.scss
@@ -37,7 +37,6 @@
right: 0;
bottom: 25px;
left: 0px;
- padding-top: 3px;
overflow-y: auto;
}
@@ -66,3 +65,7 @@
#sidebar-footer {
@include component-footer;
}
+
+.sidebar-button {
+ @include component-footer-button;
+}
diff --git a/editor/templates/index.mst b/editor/templates/index.mst
index 5007ab907..6d0b6f717 100644
--- a/editor/templates/index.mst
+++ b/editor/templates/index.mst
@@ -104,9 +104,6 @@
-
diff --git a/red/api/locales/en-US/editor.json b/red/api/locales/en-US/editor.json
index 6a12fa990..b242ca551 100644
--- a/red/api/locales/en-US/editor.json
+++ b/red/api/locales/en-US/editor.json
@@ -9,8 +9,8 @@
}
},
"workspace": {
- "defaultName": "Sheet __number__",
- "renameSheet": "Rename sheet",
+ "defaultName": "Flow __number__",
+ "renameSheet": "Rename flow",
"confirmDelete": "Confirm delete",
"delete": "Are you sure you want to delete '__label__'?",
"dropFlowHere": "Drop the flow here"
@@ -82,7 +82,8 @@
"modifiedFlowsDesc": "Only deploys flows that contain changed nodes",
"modifiedNodes": "Modified Nodes",
"modifiedNodesDesc": "Only deploys nodes that have changed",
- "successfulDeploy": "Successfully Deployed",
+ "successfulDeploy": "Successfully deployed",
+
"errors": {
"noResponse": "no response from server"
},
@@ -94,7 +95,6 @@
"undeployedChanges": "You have undeployed changes.\n\nLeaving this page will lose these changes.",
"improperlyConfigured": "The workspace contains some nodes that are not properly configured:",
"unknown": "The workspace contains some unknown node types:",
- "unusedConfig": "The workspace contains some unused configuration nodes:",
"confirm": "Are you sure you want to deploy?"
}
},
@@ -201,11 +201,11 @@
"config": {
"name": "Configuration nodes",
"label": "config",
- "local": "on this flow",
- "global": "on all flows",
+ "global": "Global Nodes",
"none": "none",
"subflows": "subflows",
- "flows": "flows"
+ "flows": "flows",
+ "filterUnused":"show unused only"
}
},
"typedInput": {