@gregoriusrippenstein/node-red-contrib-nodedev 0.5.1 → 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 Name</label>
9
- <div style="display: inline-block; width: calc(100% - 105px)"><input type="text" id="node-input-nodename" placeholder="Node Name">
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"] = node.nodename; // name clashes with the default 'name' attribute
231
- data["namelwr"] = data["name"].toLowerCase();
232
- data["iconclass"] = "fa " + data["icon"].split("/")[1]; /* Assume font-awesomeness */
233
- data["__task"] = "generate_from_templates";
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 },
@@ -54,6 +54,7 @@
54
54
  color: '{{ node.color }}',
55
55
  icon: "{{{ node.icon }}}",
56
56
  category: '{{ node.category }}',
57
+ paletteLabel: '{{ node.nodelabel }}',
57
58
  defaults: {
58
59
  name: {
59
60
  value:"",
@@ -1,5 +1,5 @@
1
1
  module.exports = function(RED) {
2
- function Core{{ node.name }}Functionality(config) {
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.name }}Functionality);
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 this.name || "{{ node.name }}"},
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
  }
@@ -7,7 +7,7 @@
7
7
  name: { value: "" },
8
8
  data: { value: "" }
9
9
  },
10
- paletteLabel: '{{ node.name }}Cfg',
10
+ paletteLabel: '{{ node.nodelabel }}',
11
11
  label: function () {
12
12
  return this.name;
13
13
  }
@@ -1,9 +1,9 @@
1
1
  module.exports = function (RED) {
2
- function Config{{ node.name }}Functionality(config) {
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.name }}Functionality);
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",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name" : "@gregoriusrippenstein/node-red-contrib-nodedev",
3
- "version": "0.5.1",
3
+ "version": "0.5.3",
4
4
  "dependencies": {
5
5
  "pako": "^2.1.0",
6
6
  "tar-stream": "^3.1.6",
@@ -160,20 +160,24 @@
160
160
  }
161
161
  });
162
162
 
163
- // Add first tab, pkg importer
164
163
  tabs.addTab({
165
164
  id: 'func-nodedev-pkgimporter-tab-pkgimport',
166
165
  iconClass: 'fa fa-industry',
167
166
  label: 'PkgImporter'
168
167
  });
169
168
 
170
- // Add first tab, otp
171
169
  tabs.addTab({
172
170
  id: 'func-nodedev-pkgimporter-tab-otpgenerator',
173
171
  iconClass: 'fa fa-user-secret',
174
172
  label: 'OTP Generator'
175
173
  });
176
174
 
175
+ tabs.addTab({
176
+ id: 'func-nodedev-pkgimporter-tab-options',
177
+ iconClass: 'fa fa-cog',
178
+ label: 'Options'
179
+ });
180
+
177
181
  ensureYourConfigNodeExists();
178
182
 
179
183
  /*
@@ -464,5 +468,16 @@
464
468
  <input type="text" id="node-input-nodedev-sidebar-otp" placeholder="OTP...">
465
469
  </div>
466
470
  </div>
471
+
472
+ <div id="func-nodedev-pkgimporter-tab-options" style="display:none">
473
+ <div class="form-row" style="margin-left: 10px;">
474
+ Drag & Drop
475
+ </div>
476
+
477
+ <div class="form-row" style="margin-left: 10px;">
478
+ <input style="width: 10%;" type="checkbox" id="nodedev-drag-drop-generate-pkgfile-nodes"/>
479
+ <label for="nodedev-drag-drop-generate-pkgfile-nodes" style="width: 40%;"><i class="fa fa-code" ></i> Create PkgFile nodes on drop?</label>
480
+ </div>
481
+ </div>
467
482
  </div>
468
483
  </script>
@@ -9,6 +9,11 @@
9
9
  */
10
10
  window.ddEvent = event
11
11
 
12
+ // checkbox on the options tab
13
+ if ( !$("#nodedev-drag-drop-generate-pkgfile-nodes").is(":checked") ) {
14
+ return
15
+ }
16
+
12
17
  let itemPtr = event.originalEvent.dataTransfer.items
13
18
  let itemCount = itemPtr.length
14
19