@gregoriusrippenstein/node-red-contrib-nodedev 0.2.8 → 0.2.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.
- package/nodes/10-node-factory.html +63 -29
- package/package.json +1 -1
|
@@ -132,34 +132,7 @@
|
|
|
132
132
|
}
|
|
133
133
|
});
|
|
134
134
|
|
|
135
|
-
function
|
|
136
|
-
|
|
137
|
-
var data = {};
|
|
138
|
-
|
|
139
|
-
/* the data has not been stored on the node when this is called,
|
|
140
|
-
need to retrieve everything from the various fields...
|
|
141
|
-
*/
|
|
142
|
-
data["summary"] = node.editorSummary.getValue();
|
|
143
|
-
data["description"] = node.editorDesc.getValue();
|
|
144
|
-
|
|
145
|
-
data["color"] = $('#node-input-colour').val();
|
|
146
|
-
data["icon"] = $('#red-ui-editor-node-icon').val();
|
|
147
|
-
data["iconclass"] = "fa " + data["icon"].split("/")[1]; /* Assume font-awesomeness */
|
|
148
|
-
data["name"] = $('#node-input-nodename').val();
|
|
149
|
-
data["namelwr"] = data["name"].toLowerCase();
|
|
150
|
-
data["outputcount"] = $('#node-input-outputcount').val();
|
|
151
|
-
data["category"] = $('#node-input-category').val();
|
|
152
|
-
|
|
153
|
-
data["hasbutton"] = $('#node-input-hasbutton').is(":checked");
|
|
154
|
-
data["minify"] = $('#node-input-minify').is(":checked");
|
|
155
|
-
data["hasinput"] = $('#node-input-hasinput').is(":checked");
|
|
156
|
-
data["bak2frtcomm"] = $('#node-input-bak2frtcomm').is(":checked");
|
|
157
|
-
data["frt2bakcomm"] = $('#node-input-frt2bakcomm').is(":checked");
|
|
158
|
-
data["createmanifest"] = $('#node-input-createmanifest').is(":checked");
|
|
159
|
-
data["isplugin"] = $('#node-input-isplugin').is(":checked");
|
|
160
|
-
|
|
161
|
-
data["__task"] = "generate_from_templates";
|
|
162
|
-
|
|
135
|
+
function postDataOff(node,data) {
|
|
163
136
|
$.ajax({
|
|
164
137
|
url: "NodeFactory/" + node.id,
|
|
165
138
|
type: "POST",
|
|
@@ -201,7 +174,52 @@
|
|
|
201
174
|
}
|
|
202
175
|
});
|
|
203
176
|
}
|
|
204
|
-
|
|
177
|
+
|
|
178
|
+
function doSubmission(node) {
|
|
179
|
+
let data = {};
|
|
180
|
+
|
|
181
|
+
/* the data has not been stored on the node when this is called,
|
|
182
|
+
need to retrieve everything from the various fields...
|
|
183
|
+
*/
|
|
184
|
+
data["summary"] = node.editorSummary.getValue();
|
|
185
|
+
data["description"] = node.editorDesc.getValue();
|
|
186
|
+
|
|
187
|
+
data["color"] = $('#node-input-colour').val();
|
|
188
|
+
data["icon"] = $('#red-ui-editor-node-icon').val();
|
|
189
|
+
data["iconclass"] = "fa " + data["icon"].split("/")[1]; /* Assume font-awesomeness */
|
|
190
|
+
data["name"] = $('#node-input-nodename').val();
|
|
191
|
+
data["namelwr"] = data["name"].toLowerCase();
|
|
192
|
+
data["outputcount"] = $('#node-input-outputcount').val();
|
|
193
|
+
data["category"] = $('#node-input-category').val();
|
|
194
|
+
|
|
195
|
+
data["hasbutton"] = $('#node-input-hasbutton').is(":checked");
|
|
196
|
+
data["minify"] = $('#node-input-minify').is(":checked");
|
|
197
|
+
data["hasinput"] = $('#node-input-hasinput').is(":checked");
|
|
198
|
+
data["bak2frtcomm"] = $('#node-input-bak2frtcomm').is(":checked");
|
|
199
|
+
data["frt2bakcomm"] = $('#node-input-frt2bakcomm').is(":checked");
|
|
200
|
+
data["createmanifest"] = $('#node-input-createmanifest').is(":checked");
|
|
201
|
+
data["isplugin"] = $('#node-input-isplugin').is(":checked");
|
|
202
|
+
|
|
203
|
+
data["__task"] = "generate_from_templates";
|
|
204
|
+
|
|
205
|
+
postDataOff(node,data)
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
function doButtonSubmission(node) {
|
|
209
|
+
let data = {}
|
|
210
|
+
|
|
211
|
+
Object.keys(node._def.defaults).forEach( attrname => {
|
|
212
|
+
data[attrname] = node[attrname]
|
|
213
|
+
})
|
|
214
|
+
|
|
215
|
+
data["name"] = node.nodename; // name clashes with the default 'name' attribute
|
|
216
|
+
data["namelwr"] = data["name"].toLowerCase();
|
|
217
|
+
data["iconclass"] = "fa " + data["icon"].split("/")[1]; /* Assume font-awesomeness */
|
|
218
|
+
data["__task"] = "generate_from_templates";
|
|
219
|
+
|
|
220
|
+
postDataOff(node,data)
|
|
221
|
+
}
|
|
222
|
+
|
|
205
223
|
RED.nodes.registerType('NodeFactory', {
|
|
206
224
|
color: "#e5e4ef",
|
|
207
225
|
category: 'nodedev',
|
|
@@ -364,6 +382,22 @@
|
|
|
364
382
|
|
|
365
383
|
oneditresize: function (size) {
|
|
366
384
|
},
|
|
385
|
+
|
|
386
|
+
button: {
|
|
387
|
+
enabled: function() {
|
|
388
|
+
return !this.changed
|
|
389
|
+
},
|
|
390
|
+
|
|
391
|
+
onclick: function () {
|
|
392
|
+
if (this.changed) {
|
|
393
|
+
return RED.notify(RED._("notification.warning", {
|
|
394
|
+
message: RED._("notification.warnings.undeployedChanges")
|
|
395
|
+
}), "warning");
|
|
396
|
+
}
|
|
397
|
+
|
|
398
|
+
doButtonSubmission(this)
|
|
399
|
+
}
|
|
400
|
+
},
|
|
367
401
|
});
|
|
368
402
|
})();
|
|
369
403
|
|