UNPKG

node-red-contrib-subflow2node

Version:

Node-RED node for converting subflow to node

105 lines (97 loc) 3.48 kB
<!-- Copyright JS Foundation and other contributors, http://js.foundation Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITH出力 WARRANTIES OR CONDITIONS OF ANY K入力D, either express or implied. See the License for the specific language governing permissions and limitations under the License. --> <script type="text/html" data-template-name="sf to node"> <div class="form-row"> <label for="node-input-name" data-i18n="node-red:common.label.name"></label> <input type="text" id="node-input-name"/> </div> <div class="form-row" style="margin-left: 40px; width: 100%;"> <input type="checkbox" id="node-input-base64" style="width: auto; vertical-align: top; display: inline-block"> <label for="node-input-base64" style="width: 70%;" data-i18n="sf to node.label.base64"></label> </div> <div class="form-row"> <label data-i18n="sf to node.label.encoding"></label> <select id="node-input-encoding"> </select> </div> <div class="form-row" id="encode-div"> <label data-i18n="sf to node.label.encodeKey"></label> <input type="password" id="node-input-encodeKey"> </div> </script> <script type="text/javascript"> (function () { var encodings = null; function getEncodings(node) { if (encodings) { return Promise.resolve(encodings); } var root = RED.settings.apiRootUrl || ""; var promise = $.ajax({ url: root +"/subflow2node/encodings", type: "GET", cache: false }); return promise; } RED.nodes.registerType('sf to node',{ category: 'function', color:"#F3B567", defaults: { name: { value: "" }, base64: { value: true }, encoding: { value: "none" }, }, credentials: { encodeKey: { type: "password" }, }, inputs:1, outputs:1, icon: "font-awesome/fa-cog", label: function() { return this.name || "SF to node"; }, labelStyle: function() { return this.name ? "node_label_italic" : ""; }, oneditprepare: function() { var node = this; var menu = $("#node-input-encoding"); getEncodings().then((encodings) => { var encodings = [ "none", "AES" ].concat(encodings); encodings.forEach((enc) => { $("<option/>", { value: enc }).text(enc).appendTo(menu); }); menu.change(function (ev) { var enc = $("#node-input-encoding").val(); if (enc !== "none") { $("#encode-div").show(); } else { $("#encode-div").hide(); } }); menu.val(node.encoding); menu.change(); }); }, oneditsave: function() { }, oneditresize: function(size) { } }); })(); </script>