@gregoriusrippenstein/node-red-contrib-nodedev 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -5,11 +5,17 @@
|
|
|
5
5
|
</div>
|
|
6
6
|
|
|
7
7
|
<div class="form-row">
|
|
8
|
-
<label for="node-input-nodename"><i class="fa fa-tag"></i> Node
|
|
9
|
-
<div style="display: inline-block; width: calc(100% - 105px)"><input type="text" id="node-input-nodename" placeholder="Node
|
|
8
|
+
<label for="node-input-nodename"><i class="fa fa-tag"></i> Node Type</label>
|
|
9
|
+
<div style="display: inline-block; width: calc(100% - 105px)"><input type="text" id="node-input-nodename" placeholder="Node Type">
|
|
10
10
|
</div>
|
|
11
11
|
</div>
|
|
12
12
|
|
|
13
|
+
<div class="form-row">
|
|
14
|
+
<label for="node-input-nodelabel"><i class="fa fa-tag"></i> Node Label</label>
|
|
15
|
+
<div style="display: inline-block; width: calc(100% - 105px)"><input type="text" id="node-input-nodelabel" placeholder="Node Label">
|
|
16
|
+
</div>
|
|
17
|
+
</div>
|
|
18
|
+
|
|
13
19
|
<div class="form-row">
|
|
14
20
|
<label for="node-input-category"><i class="fa fa-tag"></i> Node Category</label>
|
|
15
21
|
<div style="display: inline-block; width: calc(100% - 105px)"><input type="text" id="node-input-category" placeholder="Node Category">
|
|
@@ -195,6 +201,7 @@
|
|
|
195
201
|
data["icon"] = $('#red-ui-editor-node-icon').val();
|
|
196
202
|
data["iconclass"] = "fa " + data["icon"].split("/")[1]; /* Assume font-awesomeness */
|
|
197
203
|
data["name"] = $('#node-input-nodename').val();
|
|
204
|
+
data["nodelabel"] = $('#node-input-nodelabel').val();
|
|
198
205
|
data["namelwr"] = data["name"].toLowerCase();
|
|
199
206
|
data["outputcount"] = $('#node-input-outputcount').val();
|
|
200
207
|
data["category"] = $('#node-input-category').val();
|
|
@@ -227,10 +234,11 @@
|
|
|
227
234
|
data[attrname] = node[attrname]
|
|
228
235
|
})
|
|
229
236
|
|
|
230
|
-
data["name"]
|
|
231
|
-
data["namelwr"]
|
|
232
|
-
data["iconclass"]
|
|
233
|
-
data["__task"]
|
|
237
|
+
data["name"] = node.nodename; // name clashes with the default 'name' attribute
|
|
238
|
+
data["namelwr"] = data["name"].toLowerCase();
|
|
239
|
+
data["iconclass"] = "fa " + data["icon"].split("/")[1]; /* Assume font-awesomeness */
|
|
240
|
+
data["__task"] = "generate_from_templates";
|
|
241
|
+
data["name_escaped"] = data["name"].replaceAll("-",'_').replace(new RegExp(/[ \t\s]/g),'')
|
|
234
242
|
|
|
235
243
|
postDataOff(node,data)
|
|
236
244
|
}
|
|
@@ -241,6 +249,7 @@
|
|
|
241
249
|
defaults: {
|
|
242
250
|
name: { value: "" },
|
|
243
251
|
nodename: { value: "", required: true },
|
|
252
|
+
nodelabel: { value: "", required: true },
|
|
244
253
|
color: { value: "#e5e4ef" },
|
|
245
254
|
hasbutton: { value: false },
|
|
246
255
|
minify: { value: false },
|
package/nodes/templates/tmpl.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
module.exports = function(RED) {
|
|
2
|
-
function Core{{ node.
|
|
2
|
+
function Core{{ node.name_escaped }}Functionality(config) {
|
|
3
3
|
RED.nodes.createNode(this,config);
|
|
4
4
|
|
|
5
5
|
var node = this;
|
|
@@ -41,7 +41,7 @@ module.exports = function(RED) {
|
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
|
|
44
|
-
RED.nodes.registerType("{{ node.name }}", Core{{ node.
|
|
44
|
+
RED.nodes.registerType("{{ node.name }}", Core{{ node.name_escaped }}Functionality);
|
|
45
45
|
|
|
46
46
|
{{ #node.frt2bakcomm }}
|
|
47
47
|
RED.httpAdmin.post("/{{ node.name }}/:id",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
hasUsers: false,
|
|
46
46
|
users: [],
|
|
47
47
|
name: "{{ node.name }}",
|
|
48
|
-
label: function() { return
|
|
48
|
+
label: function() { return "{{ node.nodelabel }}" || this.name },
|
|
49
49
|
/* values and data defined by this config node */
|
|
50
50
|
data: "some default value", // Default data
|
|
51
51
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
module.exports = function (RED) {
|
|
2
|
-
function Config{{ node.
|
|
2
|
+
function Config{{ node.name_escaped }}Functionality(config) {
|
|
3
3
|
RED.nodes.createNode(this, config)
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
RED.nodes.registerType('{{ node.name }}Cfg', Config{{ node.
|
|
6
|
+
RED.nodes.registerType('{{ node.name }}Cfg', Config{{ node.name_escaped }}Functionality);
|
|
7
7
|
|
|
8
8
|
{{ #node.frt2bakcomm }}
|
|
9
9
|
RED.httpAdmin.post("/{{ node.name }}Cfg",
|