diff --git a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js index 4547dc756..2682ea858 100644 --- a/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js +++ b/packages/node_modules/@node-red/editor-client/src/js/ui/editor.js @@ -953,8 +953,70 @@ RED.editor = (function() { var i,row; + if (node.type === "subflow") { + var categoryRow = $("
", { + class: "form-row" + }).appendTo(dialogForm); + $("", { + class: "fa fa-folder-o" + }).appendTo(categoryRow); + $("").text(" ").appendTo(categoryRow); + $("", { + for: "subflow-appearance-input-category", + "data-i18n": "editor:subflow.category" + }).appendTo(categoryRow); + var categorySelector = $("", { + id: "subflow-appearance-input-category" + }).css({ + width: "250px" + }).appendTo(categoryRow); + $("", { + type: "text", + id: "subflow-appearance-input-custom-category" + }).css({ + display: "none", + "margin-left": "10px", + width: "calc(100% - 250px)" + }).appendTo(categoryRow); + + var categories = RED.palette.getCategories(); + categories.sort(function(A,B) { + return A.label.localeCompare(B.label); + }) + categories.forEach(function(cat) { + categorySelector.append($("").val(cat.id).text(cat.label)); + }) + categorySelector.append($("").attr('disabled',true).text("---")); + categorySelector.append($("").val("_custom_").text(RED._("palette.addCategory"))); + + $("#subflow-appearance-input-category").on("change", function() { + var val = $(this).val(); + if (val === "_custom_") { + $("#subflow-appearance-input-category").width(120); + $("#subflow-appearance-input-custom-category").show(); + } else { + $("#subflow-appearance-input-category").width(250); + $("#subflow-appearance-input-custom-category").hide(); + } + }) + + $("#subflow-appearance-input-category").val(node.category||"subflows"); + var userCount = 0; + var subflowType = "subflow:"+node.id; + + RED.nodes.eachNode(function(n) { + if (n.type === subflowType) { + userCount++; + } + }); + $("#red-ui-editor-subflow-user-count") + .text(RED._("subflow.subflowInstances", {count:userCount})).show(); + } + $('