@gregoriusrippenstein/node-red-contrib-nodedev 0.0.7 → 0.0.8
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.
- package/nodes/10-node-factory.html +40 -43
- package/nodes/10-node-factory.js +20 -24
- package/package.json +1 -1
|
@@ -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
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
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
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
data["
|
|
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(
|
|
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(
|
|
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>
|
package/nodes/10-node-factory.js
CHANGED
|
@@ -213,18 +213,16 @@ module.exports = function (RED) {
|
|
|
213
213
|
|
|
214
214
|
send({ payload: nodeImpStr })
|
|
215
215
|
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
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
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
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
|
})
|