@gregoriusrippenstein/node-red-contrib-nodedev 0.0.7 → 0.0.9

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.
@@ -4,13 +4,6 @@
4
4
  <div style="display: inline-block; width: calc(100% - 105px)"><input type="text" id="node-input-name" placeholder="Name"></div>
5
5
  </div>
6
6
 
7
- <div class="form-row">
8
- <label for="node-input-autoimport">
9
- <span>Auto Import of Nodes?</span>
10
- </label>
11
- <input type="checkbox" id="node-input-autoimport" style="display:inline-block; width:15px; vertical-align:baseline;">
12
- </div>
13
-
14
7
  <div class="form-row">
15
8
  <label for="node-input-nodename"><i class="fa fa-tag"></i> Node Name</label>
16
9
  <div style="display: inline-block; width: calc(100% - 105px)"><input type="text" id="node-input-nodename" placeholder="Node Name">
@@ -69,6 +62,12 @@
69
62
  </div>
70
63
  </div>
71
64
 
65
+
66
+ <div class="form-row">
67
+ <button id="node-input-generate-tmplnodes-but"
68
+ class="red-ui-button">Generate Template Nodes</button>
69
+ </div>
70
+
72
71
  </script>
73
72
 
74
73
  <script type="text/javascript">
@@ -76,25 +75,37 @@
76
75
 
77
76
  RED.comms.subscribe("nodedev:perform-autoimport-nodes", (event,data) => {
78
77
  if ( data.msg == "autoimport" ) {
79
- RED.clipboard.import();
80
-
81
78
  setTimeout(() => {
82
- $('#red-ui-clipboard-dialog-import-text').val(
83
- data.payload
84
- ).trigger("paste");
85
- }, 300);
79
+ RED.clipboard.import();
80
+
81
+ setTimeout(() => {
82
+ $('#red-ui-clipboard-dialog-import-text').val(
83
+ data.payload
84
+ ).trigger("paste");
85
+ }, 300);
86
+ },400)
86
87
  }
87
88
  });
88
89
 
89
90
  function doSubmission(node) {
90
91
 
91
92
  var data = {};
92
- Object.keys(node._def.defaults).forEach( (nam) => {
93
- data[nam] = node[nam]
94
- })
95
- data["name"] = node.nodename;
96
- data["__task"] = "generate_from_templates";
97
-
93
+
94
+ /* the data has not been stored on the node when this is called,
95
+ need to retrieve everything from the various fields...
96
+ */
97
+ data["summary"] = node.editorSummary.getValue();
98
+ data["description"] = node.editorDesc.getValue();
99
+ data["hasbutton"] = $('#node-input-hasbutton').is(":checked");
100
+ data["hasinput"] = $('#node-input-hasinput').is(":checked");
101
+ data["color"] = $('#node-input-colour').val();
102
+ data["icon"] = $('#red-ui-editor-node-icon').val();
103
+ data["name"] = $('#node-input-nodename').val();
104
+ data["outputcount"] = $('#node-input-outputcount').val();
105
+ data["category"] = $('#node-input-category').val();
106
+
107
+ data["__task"] = "generate_from_templates";
108
+
98
109
  $.ajax({
99
110
  url: "NodeFactory/" + node.id,
100
111
  type: "POST",
@@ -105,22 +116,19 @@
105
116
  }),
106
117
 
107
118
  success: function (resp) {
119
+ $('#node-dialog-ok').trigger('click');
120
+
108
121
  RED.notify("Data sent", {
109
122
  type: "warning",
110
- id: "FlowHubPush",
111
123
  timeout: 2000
112
124
  });
113
125
  },
114
126
 
115
127
  error: function (jqXHR, textStatus, errorThrown) {
116
128
  if (jqXHR.status == 404) {
117
- RED.notify(node._("common.notification.error", {
118
- message: node._("common.notification.errors.not-deployed")
119
- }), "error");
129
+ RED.notify("Node has not yet been deployed, please deploy.", "error");
120
130
  } else if (jqXHR.status == 405) {
121
- RED.notify(node._("common.notification.not_allowed", {
122
- message: node._("inject.errors.not_allowed")
123
- }), "error");
131
+ RED.notify("Not Allowed.", "error");
124
132
  } else if (jqXHR.status == 500) {
125
133
  RED.notify(node._("common.notification.error", {
126
134
  message: node._("inject.errors.failed")
@@ -150,7 +158,6 @@
150
158
  hasbutton: { value: false },
151
159
  hasinput: { value: true },
152
160
  outputcount: { value: 1 },
153
- autoimport: { value: true },
154
161
  category: { value: "" },
155
162
  summary: { value: ""},
156
163
  description: { value: ""},
@@ -178,6 +185,11 @@
178
185
 
179
186
  sltObj.val(this.outputcount || "1");
180
187
 
188
+ $('#node-input-generate-tmplnodes-but').on('click', (e) => {
189
+ e.preventDefault()
190
+ doSubmission(that)
191
+ });
192
+
181
193
  var colorPalette = [
182
194
  "#DDAA99",
183
195
  "#3FADB5", "#87A980", "#A6BBCF",
@@ -290,22 +302,7 @@
290
302
 
291
303
  oneditresize: function (size) {
292
304
  },
293
-
294
- button: {
295
- enabled: function () {
296
- return !this.changed
297
- },
298
-
299
- onclick: function () {
300
- if (this.changed) {
301
- return RED.notify(RED._("notification.warning", {
302
- message: RED._("notification.warnings.undeployedChanges")
303
- }), "warning");
304
- }
305
-
306
- doSubmission(this)
307
- }
308
- },
309
305
  });
310
306
  })();
307
+
311
308
  </script>
@@ -213,18 +213,16 @@ module.exports = function (RED) {
213
213
 
214
214
  send({ payload: nodeImpStr })
215
215
 
216
- if (cfg.autoimport) {
217
- RED.comms.publish(
218
- "nodedev:perform-autoimport-nodes",
219
- RED.util.encodeObject({
220
- msg: "autoimport",
221
- payload: nodeImpStr,
222
- topic: msg.topic,
223
- nodeid: node.id,
224
- _msg: msg
225
- })
226
- );
227
- }
216
+ RED.comms.publish(
217
+ "nodedev:perform-autoimport-nodes",
218
+ RED.util.encodeObject({
219
+ msg: "autoimport",
220
+ payload: nodeImpStr,
221
+ topic: msg.topic,
222
+ nodeid: node.id,
223
+ _msg: msg
224
+ })
225
+ );
228
226
 
229
227
  done()
230
228
  }).catch((err) => {
@@ -316,18 +314,16 @@ module.exports = function (RED) {
316
314
  msg.payload = JSON.stringify(allFiles);
317
315
  send(msg)
318
316
 
319
- if (cfg.autoimport) {
320
- RED.comms.publish(
321
- "nodedev:perform-autoimport-nodes",
322
- RED.util.encodeObject({
323
- msg: "autoimport",
324
- payload: msg.payload,
325
- topic: msg.topic,
326
- nodeid: node.id,
327
- _msg: msg
328
- })
329
- );
330
- }
317
+ RED.comms.publish(
318
+ "nodedev:perform-autoimport-nodes",
319
+ RED.util.encodeObject({
320
+ msg: "autoimport",
321
+ payload: msg.payload,
322
+ topic: msg.topic,
323
+ nodeid: node.id,
324
+ _msg: msg
325
+ })
326
+ );
331
327
 
332
328
  done()
333
329
  })
@@ -1,4 +1,13 @@
1
1
  <script type="text/javascript">
2
+ (function(){
3
+
4
+ function frontendSupportFunction() {
5
+ }
6
+
7
+ var functTwo = (arg) => {
8
+
9
+ };
10
+
2
11
  RED.nodes.registerType('{{ node.name }}',{
3
12
  color: '{{ node.color }}',
4
13
  icon: "{{{ node.icon }}}",
@@ -55,12 +64,13 @@
55
64
  {{/node.hasbutton}}
56
65
 
57
66
  });
67
+ })();
58
68
  </script>
59
69
 
60
70
  <script type="text/html" data-template-name="{{ node.name }}">
61
71
  <div class="form-row">
62
72
  <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
63
- <input type="text" id="node-input-name" placeholder="Name">
73
+ <input type="text" id="node-input-name" placeholder="Name"/>
64
74
  </div>
65
75
  </script>
66
76
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name" : "@gregoriusrippenstein/node-red-contrib-nodedev",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "dependencies": {
5
5
  "pako": "latest",
6
6
  "tar-stream": "latest",
@@ -17,7 +17,7 @@
17
17
  "license": "Don't do evil.",
18
18
  "author": "Gerrit Riessen <does.anyone@spread-the.love> (https://spread-the.love)",
19
19
  "engines": {
20
- "node": ">=16"
20
+ "node": ">=8"
21
21
  },
22
22
 
23
23
  "node-red" : {