-
Notifications
You must be signed in to change notification settings - Fork 0
/
subflow2node.html
104 lines (97 loc) · 3.4 KB
/
subflow2node.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!--
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>