-
-
-
- inputs
-
-
-
- outputs
-
-
-
- functions
-
-
-
- social
-
-
-
-
-
-
-
- storage
-
-
-
-
-
-
-
- analysis
-
-
-
-
-
-
-
+ advanced
-
-
-
-
-
-
diff --git a/public/red/ui/palette.js b/public/red/ui/palette.js
index b75766591..e02312350 100644
--- a/public/red/ui/palette.js
+++ b/public/red/ui/palette.js
@@ -12,73 +12,105 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- **/
-RED.palette = function() {
-
+ **/
+
+RED.palette = function() {
+
+ var exclusion = ['config','unknown','deprecated'];
+ var core = ['input', 'output', 'function', 'social', 'storage', 'analysis', 'advanced'];
+
+ function createCategoryContainer(category){
+
+ $("#palette-container").append('\
+
\
+
');
+
+ }
+
+ core.forEach(createCategoryContainer);
+
function addNodeType(nt,def) {
- if (def.category != 'config') {
- var d = document.createElement("div");
- d.id = "pn_"+nt;
- d.type = nt;
-
- var label = /^(.*?)([ -]in|[ -]out)?$/.exec(nt)[1];
- d.innerHTML = ''+category+'
\
+ \
+ \
+ \
+ \
+
\
+ '+label+"
";
- d.className="palette_node";
- if (def.icon) {
- d.style.backgroundImage = "url(icons/"+def.icon+")";
- if (def.align == "right") {
- d.style.backgroundPosition = "95% 50%";
- } else if (def.inputs > 0) {
- d.style.backgroundPosition = "10% 50%";
- }
- }
-
- d.style.backgroundColor = def.color;
-
- if (def.outputs > 0) {
- var port = document.createElement("div");
- port.className = "palette_port palette_port_output";
- d.appendChild(port);
- }
-
- if (def.inputs > 0) {
- var port = document.createElement("div");
- port.className = "palette_port";
- d.appendChild(port);
- }
-
- // TODO: add categories dynamically?
- $("#palette-"+def.category).append(d);
-
- d.onmousedown = function(e) { e.preventDefault(); }
-
- $(d).popover({
- title:d.type,
- placement:"right",
- trigger: "hover",
- delay: { show: 750, hide: 50 },
- html: true,
- container:'body',
- content: $(($("script[data-help-name|='"+nt+"']").html()||"no information available
").trim())[0] - }); - $(d).click(function() { - var help = ''+($("script[data-help-name|='"+d.type+"']").html()||"")+"
";
- $("#tab-info").html(help);
- });
- $(d).draggable({
- helper: 'clone',
- appendTo: 'body',
- revert: true,
- revertDuration: 50
- });
- }
+ if (exclusion.indexOf(def.category)===-1) {
+
+ var category = def.category.split("-");
+
+ var d = document.createElement("div");
+ d.id = "pn_"+nt;
+ d.type = nt;
+
+ var label = /^(.*?)([ -]in|[ -]out)?$/.exec(nt)[1];
+
+ d.innerHTML = ''+label+"
";
+ d.className="palette_node";
+ if (def.icon) {
+ d.style.backgroundImage = "url(icons/"+def.icon+")";
+ if (def.align == "right") {
+ d.style.backgroundPosition = "95% 50%";
+ } else if (def.inputs > 0) {
+ d.style.backgroundPosition = "10% 50%";
+ }
+ }
+
+ d.style.backgroundColor = def.color;
+
+ if (def.outputs > 0) {
+ var port = document.createElement("div");
+ port.className = "palette_port palette_port_output";
+ d.appendChild(port);
+ }
+
+ if (def.inputs > 0) {
+ var port = document.createElement("div");
+ port.className = "palette_port";
+ d.appendChild(port);
+ }
+
+ if($("#palette-base-category-"+category[0]).length == 0){
+ createCategoryContainer(category[0]);
+ }
+
+ if($("#palette-"+def.category).length == 0){
+ $("#palette-base-category-"+category[0]).append('\
+ ');
+ }
+
+ $("#palette-"+def.category).append(d);
+ d.onmousedown = function(e) { e.preventDefault(); }
+
+ $(d).popover({
+ title:d.type,
+ placement:"right",
+ trigger: "hover",
+ delay: { show: 750, hide: 50 },
+ html: true,
+ container:'body',
+ content: $(($("script[data-help-name|='"+nt+"']").html()||"no information available
").trim())[0] + }); + $(d).click(function() { + var help = ''+($("script[data-help-name|='"+d.type+"']").html()||"")+"
";
+ $("#tab-info").html(help);
+ });
+ $(d).draggable({
+ helper: 'clone',
+ appendTo: 'body',
+ revert: true,
+ revertDuration: 50
+ });
+
+ $("#header-"+category[0]).off('click').on('click', function(e) {
+ $(this).next().slideToggle();
+ $(this).children("i").toggleClass("expanded");
+ });
+
+ }
}
- $(".palette-header").click(function(e) {
- $(this).next().slideToggle();
- $(this).children("i").toggleClass("expanded");
- });
-
function filterChange() {
var val = $("#palette-search-input").val();
if (val == "") {