aboutsummaryrefslogtreecommitdiffstats
path: root/dgbuilder/core_nodes/core
diff options
context:
space:
mode:
Diffstat (limited to 'dgbuilder/core_nodes/core')
-rw-r--r--dgbuilder/core_nodes/core/20-inject.html437
-rw-r--r--dgbuilder/core_nodes/core/20-inject.js97
-rw-r--r--dgbuilder/core_nodes/core/58-debug.html248
-rw-r--r--dgbuilder/core_nodes/core/58-debug.js114
-rw-r--r--dgbuilder/core_nodes/core/75-exec.html68
-rw-r--r--dgbuilder/core_nodes/core/75-exec.js84
-rw-r--r--dgbuilder/core_nodes/core/80-function.html110
-rw-r--r--dgbuilder/core_nodes/core/80-function.js79
-rw-r--r--dgbuilder/core_nodes/core/80-template.html102
-rw-r--r--dgbuilder/core_nodes/core/80-template.js61
-rw-r--r--dgbuilder/core_nodes/core/89-delay.html167
-rw-r--r--dgbuilder/core_nodes/core/89-delay.js171
-rw-r--r--dgbuilder/core_nodes/core/89-trigger.html130
-rw-r--r--dgbuilder/core_nodes/core/89-trigger.js91
-rw-r--r--dgbuilder/core_nodes/core/90-comment.html86
-rw-r--r--dgbuilder/core_nodes/core/90-comment.js23
-rw-r--r--dgbuilder/core_nodes/core/98-unknown.html49
-rw-r--r--dgbuilder/core_nodes/core/98-unknown.js23
18 files changed, 0 insertions, 2140 deletions
diff --git a/dgbuilder/core_nodes/core/20-inject.html b/dgbuilder/core_nodes/core/20-inject.html
deleted file mode 100644
index 38aa6efe..00000000
--- a/dgbuilder/core_nodes/core/20-inject.html
+++ /dev/null
@@ -1,437 +0,0 @@
-<!--
- Copyright 2013 IBM Corp.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<script type="text/x-red" data-template-name="inject">
- <div class="form-row node-input-payload">
- <label for="node-input-payloadType"><i class="fa fa-envelope"></i> Payload</label>
- <select id="node-input-payloadType" style="width:125px !important">
- <option value="date">timestamp</option>
- <option value="none">blank</option>
- <option value="string">string</option>
- </select>
- </div>
-
- <div class="form-row" id="node-input-row-payload">
- <label for="node-input-payload"></label>
- <input type="text" id="node-input-payload" placeholder="payload">
- </div>
-
- <div class="form-row">
- <label for="node-input-topic"><i class="fa fa-tasks"></i> Topic</label>
- <input type="text" id="node-input-topic" placeholder="topic">
- </div>
-
- <div class="form-row">
- <label for=""><i class="fa fa-repeat"></i> Repeat</label>
- <select id="inject-time-type-select" style="width: 288px"><option value="none">none</option><option value="interval">interval</option><option value="interval-time">interval between times</option><option value="time">at a specific time</option></select>
- <input type="hidden" id="node-input-repeat" placeholder="payload">
- <input type="hidden" id="node-input-crontab" placeholder="payload">
- </div>
-
- <div class="form-row inject-time-row hidden" id="inject-time-row-interval">
- every <input id="inject-time-interval-count" class="inject-time-count" value="1"></input>
- <select style="width: 100px" id="inject-time-interval-units"><option value="s">seconds</option><option value="m">minutes</option><option value="h">hours</option></select><br/>
- <!-- on <select disabled id="inject-time-interval-days" class="inject-time-days"></select> -->
- </div>
-
- <div class="form-row inject-time-row hidden" id="inject-time-row-interval-time">
- at every <select style="width: 90px" id="inject-time-interval-time-units" class="inject-time-int-count" value="1">
- <option value="1">1</option>
- <option value="2">2</option>
- <option value="3">3</option>
- <option value="4">4</option>
- <option value="5">5</option>
- <option value="6">6</option>
- <option value="10">10</option>
- <option value="12">12</option>
- <option value="15">15</option>
- <option value="20">20</option>
- <option value="30">30</option>
- <option value="0">60</option>
- </select> minutes<br/>
- between <select id="inject-time-interval-time-start" class="inject-time-times"></select>
- and <select id="inject-time-interval-time-end" class="inject-time-times"></select><br/>
- on <select id="inject-time-interval-time-days" class="inject-time-days"></select>
- </div>
-
- <div class="form-row inject-time-row hidden" id="inject-time-row-time">
- at <input id="inject-time-time" value="12:00"></input><br/>
- on <select id="inject-time-time-days" class="inject-time-days"></select>
- </div>
-
- <div class="form-row" id="node-once">
- <label>&nbsp;</label>
- <input type="checkbox" id="node-input-once" style="display: inline-block; width: auto; vertical-align: top;">
- <label for="node-input-once" style="width: 70%;">Fire once at start ?</label>
- </div>
-
- <div class="form-row">
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
- <input type="text" id="node-input-name" placeholder="name">
- </div>
-
- <div class="form-tips"><b>Note:</b> "interval between times" and "at a specific time" will use cron.<br/>See info box for details.</div>
-</script>
-<style>
- .inject-time-row {
- padding-left: 110px;
- }
- .inject-time-row select {
- margin: 3px 0;
- }
- .inject-time-days {
- width: 262px;
- }
- .inject-time-times {
- width: 90px;
- }
- .inject-time-row > .ui-spinner {
- height: 28px;
- margin: 3px 0;
- border-color: rgb(204, 204, 204);
- }
- #inject-time-time {
- margin-top: 3px;
- width: 75px;
- }
- .inject-time-count {
- width: 40px !important;
- }
-</style>
-<script type="text/x-red" data-help-name="inject">
- <p>Pressing the button on the left side of the node allows a message on a topic to be injected into the flow. This is mainly for test purposes.</p>
- <p>If no payload is specified the payload is set to the current time in millisecs since 1970. This allows subsequent functions to perform time based actions.</p>
- <p>The repeat function does what it says on the tin and continuously sends the payload every x seconds.</p>
- <p>The Fire once at start option actually waits 50mS before firing to give other nodes a chance to instantiate properly.</p>
- <p><b>Note: </b>"Interval between times" and "at a specific time" will use cron. This means that 20 minutes will be at the next hour, 20 minutes past and 40 minutes past - not in 20 minutes time.
- If you want every 20 minutes from now - use the basic "interval" option.</p>
-</script>
-
-<script type="text/javascript">
- RED.nodes.registerType('inject',{
- category: 'input',
- color:"#a6bbcf",
- defaults: {
- name: {value:""},
- topic: {value:""},
- payload: {value:""},
- payloadType: {value:"date"},
- repeat: {value:""},
- crontab: {value:""},
- once: {value:false}
- },
- inputs:0,
- outputs:1,
- icon: "inject.png",
- label: function() {
- if (this.payloadType === "string") {
- return this.name||this.topic||this.payload||"inject";
- }
- else { return this.name||this.topic||"inject"; }
- },
- labelStyle: function() {
- return this.name?"node_label_italic":"";
- },
- oneditprepare: function() {
- $("#inject-time-type-select").change(function() {
- $("#node-input-crontab").val('');
- var id = $("#inject-time-type-select option:selected").val();
- $(".inject-time-row").hide();
- $("#inject-time-row-"+id).show();
- if ((id == "none") || (id == "interval")) {
- $("#node-once").show();
- }
- else {
- $("#node-once").hide();
- $("#node-input-once").prop('checked', false);
- }
- });
-
- var days = [
- {v:"*",t:"every day"},
- {v:"1-5",t:"Mondays to Fridays"},
- {v:"0,6",t:"Saturdays and Sundays"},
- {v:"1",t:"Mondays"},
- {v:"2",t:"Tuesdays"},
- {v:"3",t:"Wednesdays"},
- {v:"4",t:"Thursdays"},
- {v:"5",t:"Fridays"},
- {v:"6",t:"Saturdays"},
- {v:"0",t:"Sundays"}
- ];
-
- $(".inject-time-days").each(function() {
- for (var d in days) {
- $(this).append($("<option></option>").val(days[d].v).text(days[d].t));
- }
- });
-
- $(".inject-time-times").each(function() {
- for (var i=0;i<24;i++) {
- var l = (i<10?"0":"")+i+":00";
- $(this).append($("<option></option>").val(i).text(l));
- }
- });
-
- $(".inject-time-count").spinner({
- //max:60,
- min:1
- });
-
- $("#inject-time-interval-units").change(function() {
- var units = $("#inject-time-interval-units option:selected").val();
- //$("#inject-time-interval-days").prop("disabled",(units == "s")?"disabled":false);
- //$(".inject-time-count").spinner("option","max",(units == "h")?24:60);
- });
-
- $.widget( "ui.injecttimespinner", $.ui.spinner, {
- options: {
- // seconds
- step: 60 * 1000,
- // hours
- page: 60
- },
- _parse: function( value ) {
- if ( typeof value === "string" ) {
- // already a timestamp
- if ( Number( value ) == value ) {
- return Number( value );
- }
- var p = value.split(":");
- var offset = new Date().getTimezoneOffset();
- return (((Number(p[0])+1)*60)+Number(p[1])+offset)*60*1000;
- }
- return value;
- },
- _format: function( value ) {
- var d = new Date(value);
- var h = d.getHours();
- var m = d.getMinutes();
- return ((h < 10)?"0":"")+h+":"+((m < 10)?"0":"")+m;
- }
- });
-
- $("#inject-time-time").injecttimespinner();
-
- var repeattype = "none";
- if (this.repeat != "" && this.repeat != 0) {
- repeattype = "interval";
- var r = "s";
- var c = this.repeat;
- if (this.repeat % 60 === 0) { r = "m"; c = c/60; }
- if (this.repeat % 1440 === 0) { r = "h"; c = c/24; }
- $("#inject-time-interval-count").val(c);
- $("#inject-time-interval-units").val(r);
- //$("#inject-time-interval-units option").filter(function() {return $(this).val() == "s";}).attr('selected',true);
- $("#inject-time-interval-days").prop("disabled","disabled");
- } else if (this.crontab) {
- var cronparts = this.crontab.split(" ");
- var days = cronparts[4];
- if (!isNaN(cronparts[0]) && !isNaN(cronparts[1])) {
- repeattype = "time";
- // Fixed time
- var time = cronparts[1]+":"+cronparts[0];
- $("#inject-time-time").val(time);
- $("#inject-time-type-select option").filter(function() {return $(this).val() == "s";}).attr('selected',true);
- $("#inject-time-time-days option").filter(function() {return $(this).val() == days;}).attr('selected',true);
- }
- //else if (cronparts[0] == "0") {
- // // interval - hours
- // var hours = cronparts[1].slice(2);
- // repeattype = "interval";
- // $("#inject-time-interval-days").prop("disabled",false);
- // $("#inject-time-interval-days option").filter(function() {return $(this).val() == days;}).attr('selected',true);
- // $("#inject-time-interval-count").val(hours)
- // $("#inject-time-interval-units option").filter(function() {return $(this).val() == "h";}).attr('selected',true);
- //} else if (cronparts[1] == "*") {
- // // interval - minutes
- // var minutes = cronparts[0].slice(2);
- // repeattype = "interval";
- // $("#inject-time-interval-days").prop("disabled",false);
- // $("#inject-time-interval-days option").filter(function() {return $(this).val() == days;}).attr('selected',true);
- // $("#inject-time-interval-count").val(minutes)
- // $("#inject-time-interval-units option").filter(function() {return $(this).val() == "m";}).attr('selected',true);
- //}
- else {
- repeattype = "interval-time";
- // interval - time period
- var minutes = cronparts[0].slice(2);
- if (minutes === "") { minutes = "0"; }
- $("#inject-time-interval-time-units").val(minutes);
- $("#inject-time-interval-time-days option").filter(function() {return $(this).val() == days;}).attr('selected',true);
- var time = cronparts[1];
- var timeparts = time.split(",");
- var start;
- var end;
- if (timeparts.length == 1) {
- // 0 or 0-10
- var hours = timeparts[0].split("-");
- if (hours.length == 1) {
- if (hours[0] === "") {
- start = "0";
- end = "0";
- }
- else {
- start = hours[0];
- end = Number(hours[0])+1;
- }
- } else {
- start = hours[0];
- end = (Number(hours[1])+1)%24;
- }
- } else {
- // 23,0 or 17-23,0-10 or 23,0-2 or 17-23,0
- var startparts = timeparts[0].split("-");
- start = startparts[0];
-
- var endparts = timeparts[1].split("-");
- if (endparts.length == 1) {
- end = Number(endparts[0])+1;
- } else {
- end = Number(endparts[1])+1;
- }
- }
- $("#inject-time-interval-time-start option").filter(function() {return $(this).val() == start;}).attr('selected',true);
- $("#inject-time-interval-time-end option").filter(function() {return $(this).val() == end;}).attr('selected',true);
-
- }
- } else {
- $("#inject-time-type-select option").filter(function() {return $(this).val() == "none";}).attr('selected',true);
- }
-
- $(".inject-time-row").hide();
- $("#inject-time-type-select option").filter(function() {return $(this).val() == repeattype;}).attr('selected',true);
- $("#inject-time-row-"+repeattype).show();
-
- if (this.payloadType == null) {
- if (this.payload == "") {
- this.payloadType = "date";
- } else {
- this.payloadType = "string";
- }
- }
-
- $("#node-input-payloadType").change(function() {
- var id = $("#node-input-payloadType option:selected").val();
- if (id == "string") {
- $("#node-input-row-payload").show();
- } else {
- $("#node-input-row-payload").hide();
- }
- });
- $("#node-input-payloadType").val(this.payloadType);
- $("#node-input-payloadType").change();
- $("#inject-time-type-select").change();
-
- },
- oneditsave: function() {
- var repeat = "";
- var crontab = "";
- var type = $("#inject-time-type-select option:selected").val();
- if (type == "none") {
- // nothing
- } else if (type == "interval") {
- var count = $("#inject-time-interval-count").val();
- var units = $("#inject-time-interval-units option:selected").val();
- var days = $("#inject-time-interval-days option:selected").val();
- if (units == "s") {
- repeat = count;
- } else {
- if (units == "m") {
- //crontab = "*/"+count+" * * * "+days;
- repeat = count * 60;
- } else if (units == "h") {
- //crontab = "0 */"+count+" * * "+days;
- repeat = count * 60 * 24;
- }
- }
- } else if (type == "interval-time") {
- var count = $("#inject-time-interval-time-units").val();
- var startTime = Number($("#inject-time-interval-time-start option:selected").val());
- var endTime = Number($("#inject-time-interval-time-end option:selected").val());
- var days = $("#inject-time-interval-time-days option:selected").val();
- var timerange = "*";
- if (startTime == endTime) {
- //TODO: invalid
- repeat = "";
- crontab = "";
- } else if (endTime == 0) {
- timerange = startTime+"-23";
- } else if (startTime+1 < endTime) {
- timerange = startTime+"-"+(endTime-1);
- } else if (startTime+1 == endTime) {
- timerange = startTime;
- } else {
- var startpart = "";
- var endpart = "";
- if (startTime == 23) {
- startpart = "23";
- } else {
- startpart = startTime+"-23";
- }
- if (endTime == 1) {
- endpart = "0";
- } else {
- endpart = "0-"+(endTime-1);
- }
- timerange = startpart+","+endpart;
- }
- repeat = "";
- if (count === "0") {
- crontab = count+" "+timerange+" * * "+days;
- }
- else {
- crontab = "*/"+count+" "+timerange+" * * "+days;
- }
- } else if (type == "time") {
- var time = $("#inject-time-time").val();
- var days = $("#inject-time-time-days option:selected").val();
- var parts = time.split(":");
- repeat = "";
- crontab = parts[1]+" "+parts[0]+" * * "+days;
- }
-
- $("#node-input-repeat").val(repeat);
- $("#node-input-crontab").val(crontab);
-
- },
- button: {
- onclick: function() {
- var label = (this.name||this.payload).replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
- if (this.payloadType === "date") { label = "timestamp"; }
- if (this.payloadType === "none") { label = "blank"; }
- d3.xhr("inject/"+this.id).post(function(err,resp) {
- if (err) {
- if (err.status == 404) {
- RED.notify("<strong>Error</strong>: inject node not deployed","error");
- } else if (err.status == 500) {
- RED.notify("<strong>Error</strong>: inject failed, see log for details.","error");
- } else if (err.status == 0) {
- RED.notify("<strong>Error</strong>: no response from server","error");
- } else {
- RED.notify("<strong>Error</strong>: unexpected error: ("+err.status+")"+err.response,"error");
- }
- } else if (resp.status == 200) {
- RED.notify("Successfully injected: "+label,"success");
- } else {
- RED.notify("<strong>Error</strong>: unexpected response: ("+resp.status+") "+resp.response,"error");
- }
- });
- }
- }
- });
-
-</script>
diff --git a/dgbuilder/core_nodes/core/20-inject.js b/dgbuilder/core_nodes/core/20-inject.js
deleted file mode 100644
index dff0fb65..00000000
--- a/dgbuilder/core_nodes/core/20-inject.js
+++ /dev/null
@@ -1,97 +0,0 @@
-/**
- * Copyright 2013, 2014 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-
-module.exports = function(RED) {
- var cron = require("cron");
-
- function InjectNode(n) {
- RED.nodes.createNode(this,n);
- this.topic = n.topic;
- this.payload = n.payload;
- this.payloadType = n.payloadType;
- this.repeat = n.repeat;
- this.crontab = n.crontab;
- this.once = n.once;
- var node = this;
- this.interval_id = null;
- this.cronjob = null;
-
- if (this.repeat && !isNaN(this.repeat) && this.repeat > 0) {
- this.repeat = this.repeat * 1000;
- this.log("repeat = "+this.repeat);
- this.interval_id = setInterval( function() {
- node.emit("input",{});
- }, this.repeat );
- } else if (this.crontab) {
- if (cron) {
- this.log("crontab = "+this.crontab);
- this.cronjob = new cron.CronJob(this.crontab,
- function() {
- node.emit("input",{});
- },
- null,true);
- } else {
- this.error("'cron' module not found");
- }
- }
-
- if (this.once) {
- setTimeout( function(){ node.emit("input",{}); }, 100);
- }
-
- this.on("input",function(msg) {
- var msg = {topic:this.topic};
- if ( (this.payloadType == null && this.payload == "") || this.payloadType == "date") {
- msg.payload = Date.now();
- } else if (this.payloadType == null || this.payloadType == "string") {
- msg.payload = this.payload;
- } else {
- msg.payload = "";
- }
- this.send(msg);
- msg = null;
- });
- }
-
- RED.nodes.registerType("inject",InjectNode);
-
- InjectNode.prototype.close = function() {
- if (this.interval_id != null) {
- clearInterval(this.interval_id);
- this.log("inject: repeat stopped");
- } else if (this.cronjob != null) {
- this.cronjob.stop();
- this.log("inject: cronjob stopped");
- delete this.cronjob;
- }
- }
-
- RED.httpAdmin.post("/inject/:id", function(req,res) {
- var node = RED.nodes.getNode(req.params.id);
- if (node != null) {
- try {
- node.receive();
- res.send(200);
- } catch(err) {
- res.send(500);
- node.error("Inject failed:"+err);
- console.log(err.stack);
- }
- } else {
- res.send(404);
- }
- });
-}
diff --git a/dgbuilder/core_nodes/core/58-debug.html b/dgbuilder/core_nodes/core/58-debug.html
deleted file mode 100644
index 04aa5078..00000000
--- a/dgbuilder/core_nodes/core/58-debug.html
+++ /dev/null
@@ -1,248 +0,0 @@
-<!--
- Copyright 2013 IBM Corp.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<script type="text/x-red" data-template-name="debug">
- <div class="form-row">
- <label for="node-input-complete"><i class="fa fa-list"></i> Output</label>
- <select type="text" id="node-input-complete" style="display: inline-block; width: 250px; vertical-align: top;">
- <option value="false">payload only</option>
- <option value="true">complete msg object</option>
- </select>
- </div>
- <div class="form-row">
- <label for="node-input-console"><i class="fa fa-random"></i> to</label>
- <select type="text" id="node-input-console" style="display: inline-block; width: 250px; vertical-align: top;">
- <option value="false">debug tab</option>
- <option value="true">debug tab and console</option>
- </select>
- </div>
- <div class="form-row">
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
- <input type="text" id="node-input-name" placeholder="Name">
- </div>
-</script>
-
-<script type="text/x-red" data-help-name="debug">
- <p>The Debug node can be connected to the output of any node. It will display the timestamp, <b>msg.topic</b> and <b>msg.payload</b> fields of any messages it receives in the debug tab of the sidebar.
- <br/>The sidebar can be accessed under the options drop-down in the top right corner.</p>
- <p>The button to the right of the node will toggle it's output on and off so you can de-clutter the debug window.</p>
- <p>If the payload is an object it will be stringified first for display and indicate that by saying "(Object) ".</p>
- <p>If the payload is a buffer it will be stringified first for display and indicate that by saying "(Buffer) ".</p>
- <p>Selecting any particular message will highlight (in red) the debug node that reported it. This is useful if you wire up multiple debug nodes.</p>
- <p>Optionally can show the complete msg object - but the screen can get messy.</p>
- <p>In addition any calls to node.warn or node.error will appear here.</p>
-</script>
-
-<script type="text/javascript">
- RED.nodes.registerType('debug',{
- category: 'output',
- defaults: {
- name: {value:""},
- active: {value:true},
- console: {value:"false"},
- complete: {value:"false"}
- },
- label: function() {
- return this.name||"debug";
- },
- labelStyle: function() {
- return this.name?"node_label_italic":"";
- },
- color:"#87a980",
- inputs:1,
- outputs:0,
- icon: "debug.png",
- align: "right",
- button: {
- toggle: "active",
- onclick: function() {
- var label = this.name||"debug";
- d3.xhr("debug/"+this.id+"/"+(this.active?"enable":"disable")).post(function(err,resp) {
- if (err) {
- if (err.status == 404) {
- RED.notify("<strong>Error</strong>: debug node not deployed","error");
- } else if (err.status == 0) {
- RED.notify("<strong>Error</strong>: no response from server","error");
- } else {
- RED.notify("<strong>Error</strong>: unexpected error: ("+err.status+")"+err.response,"error");
- }
- } else if (resp.status == 200) {
- RED.notify("Successfully activated: "+label,"success");
- } else if (resp.status == 201) {
- RED.notify("Successfully deactivated: "+label,"success");
- } else {
- RED.notify("<strong>Error</strong>: unexpected response: ("+resp.status+") "+resp.response,"error");
- }
- });
- }
- },
- onpaletteadd: function() {
- var content = document.createElement("div");
- content.id = "tab-debug";
-
- var toolbar = document.createElement("div");
- toolbar.id = "debug-toolbar";
- content.appendChild(toolbar);
-
- toolbar.innerHTML = '<div class="btn-group pull-right"><a id="debug-tab-clear" title="clear log" class="btn btn-mini" href="#"><i class="fa fa-trash"></i></a></div> ';
-
- var messages = document.createElement("div");
- messages.id = "debug-content";
- content.appendChild(messages);
-
- RED.sidebar.addTab("debug",content);
-
- function getTimestamp() {
- var d = new Date();
- return d.toLocaleString();
- }
-
- var sbc = document.getElementById("debug-content");
-
- var messageCount = 0;
- var that = this;
- RED._debug = function(msg) {
- that.handleDebugMessage("",{
- name:"debug",
- msg:msg
- });
- }
-
- this.handleDebugMessage = function(t,o) {
- var msg = document.createElement("div");
- msg.onmouseover = function() {
- msg.style.borderRightColor = "#999";
- var n = RED.nodes.node(o.id);
- if (n) {
- n.highlighted = true;
- n.dirty = true;
- }
- RED.view.redraw();
- };
- msg.onmouseout = function() {
- msg.style.borderRightColor = "";
- var n = RED.nodes.node(o.id);
- if (n) {
- n.highlighted = false;
- n.dirty = true;
- }
- RED.view.redraw();
- };
- msg.onclick = function() {
- var node = RED.nodes.node(o.id);
- if (node) {
- RED.view.showWorkspace(node.z);
- }
-
- };
- var name = (o.name?o.name:o.id).toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
- var topic = (o.topic||"").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
- var payload = (o.msg||"").toString().replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
- msg.className = 'debug-message'+(o.level?(' debug-message-level-'+o.level):'');
- msg.innerHTML = '<span class="debug-message-date">'+getTimestamp()+'</span>'+
- '<span class="debug-message-name">['+name+']</span>'+
- (o.topic?'<span class="debug-message-topic">'+topic+'</span>':'')+
- '<span class="debug-message-payload">'+payload+'</span>';
- var atBottom = (sbc.scrollHeight-messages.offsetHeight-sbc.scrollTop) < 5;
- messageCount++;
- $(messages).append(msg);
-
- if (messageCount > 200) {
- $("#debug-content .debug-message:first").remove();
- messageCount--;
- }
- if (atBottom) {
- $(sbc).scrollTop(sbc.scrollHeight);
- }
- };
- RED.comms.subscribe("debug",this.handleDebugMessage);
-
- $("#debug-tab-clear").click(function() {
- $(".debug-message").remove();
- messageCount = 0;
- RED.nodes.eachNode(function(node) {
- node.highlighted = false;
- node.dirty = true;
- });
- RED.view.redraw();
- });
- },
- onpaletteremove: function() {
- RED.comms.unsubscribe("debug",this.handleDebugMessage);
- RED.sidebar.removeTab("debug");
- delete RED._debug;
- }
- });
-</script>
-
-<style>
- #debug-content {
- position: absolute;
- top: 30px;
- bottom: 0px;
- left:0px;
- right: 0px;
- overflow-y: scroll;
- }
- #debug-toolbar {
- padding: 3px 10px;
- height: 24px;
- background: #f3f3f3;
- }
- .debug-message {
- cursor: pointer;
- border-bottom: 1px solid #eee;
- border-left: 8px solid #eee;
- border-right: 8px solid #eee;
- padding: 2px;
- }
- .debug-message-date {
- background: #fff;
- font-size: 9px;
- color: #aaa;
- padding: 1px 5px 1px 1px;
- }
- .debug-message-topic {
- display: block;
- background: #fff;
- padding: 1px 5px;
- font-size: 9px;
- color: #a66;
- }
- .debug-message-name {
- background: #fff;
- padding: 1px 5px;
- font-size: 9px;
- color: #aac;
- }
- .debug-message-payload {
- display: block;
- padding: 2px;
- background: #fff;
- }
- .debug-message-level-log {
- border-left-color: #eee;
- border-right-color: #eee;
- }
- .debug-message-level-warn {
- border-left-color: #ffdf9d;
- border-right-color: #ffdf9d;
- }
- .debug-message-level-error {
- border-left-color: #f99;
- border-right-color: #f99;
- }
-</style>
diff --git a/dgbuilder/core_nodes/core/58-debug.js b/dgbuilder/core_nodes/core/58-debug.js
deleted file mode 100644
index 7436bf2c..00000000
--- a/dgbuilder/core_nodes/core/58-debug.js
+++ /dev/null
@@ -1,114 +0,0 @@
-/**
- * Copyright 2013 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-
-module.exports = function(RED) {
- var util = require("util");
- var events = require("events");
- var debuglength = RED.settings.debugMaxLength||1000;
- var useColors = false;
- // util.inspect.styles.boolean = "red";
-
- function DebugNode(n) {
- RED.nodes.createNode(this,n);
- this.name = n.name;
- this.complete = n.complete;
- this.console = n.console;
- this.active = (n.active == null)||n.active;
- var node = this;
-
- this.on("input",function(msg) {
- if (this.complete == "true") { // debug complete msg object
- if (this.console == "true") {
- node.log("\n"+util.inspect(msg, {colors:useColors, depth:10}));
- }
- if (this.active) {
- sendDebug({id:this.id,name:this.name,topic:msg.topic,msg:msg,_path:msg._path});
- }
- } else { // debug just the msg.payload
- if (this.console == "true") {
- if (typeof msg.payload === "string") {
- node.log((msg.payload.indexOf("\n") != -1 ? "\n" : "") + msg.payload);
- }
- else if (typeof msg.payload === "object") { node.log("\n"+util.inspect(msg.payload, {colors:useColors, depth:10})); }
- else { node.log(util.inspect(msg.payload, {colors:useColors})); }
- }
- if (this.active) {
- sendDebug({id:this.id,name:this.name,topic:msg.topic,msg:msg.payload,_path:msg._path});
- }
- }
- });
- }
-
- RED.nodes.registerType("debug",DebugNode);
-
- function sendDebug(msg) {
- if (msg.msg instanceof Error) {
- msg.msg = msg.msg.toString();
- } else if (msg.msg instanceof Buffer) {
- msg.msg = "(Buffer) "+msg.msg.toString('hex');
- } else if (typeof msg.msg === 'object') {
- var seen = [];
- var ty = "(Object) ";
- if (util.isArray(msg.msg)) { ty = "(Array) "; }
- msg.msg = ty + JSON.stringify(msg.msg, function(key, value) {
- if (typeof value === 'object' && value !== null) {
- if (seen.indexOf(value) !== -1) { return "[circular]"; }
- seen.push(value);
- }
- return value;
- }," ");
- seen = null;
- } else if (typeof msg.msg === "boolean") {
- msg.msg = "(boolean) "+msg.msg.toString();
- } else if (msg.msg === 0) {
- msg.msg = "0";
- } else if (msg.msg == null) {
- msg.msg = "(undefined)";
- }
-
- if (msg.msg.length > debuglength) {
- msg.msg = msg.msg.substr(0,debuglength) +" ....";
- }
-
- RED.comms.publish("debug",msg);
- }
-
- DebugNode.logHandler = new events.EventEmitter();
- DebugNode.logHandler.on("log",function(msg) {
- if (msg.level == "warn" || msg.level == "error") {
- sendDebug(msg);
- }
- });
- RED.log.addHandler(DebugNode.logHandler);
-
- RED.httpAdmin.post("/debug/:id/:state", function(req,res) {
- var node = RED.nodes.getNode(req.params.id);
- var state = req.params.state;
- if (node != null) {
- if (state === "enable") {
- node.active = true;
- res.send(200);
- } else if (state === "disable") {
- node.active = false;
- res.send(201);
- } else {
- res.send(404);
- }
- } else {
- res.send(404);
- }
- });
-}
diff --git a/dgbuilder/core_nodes/core/75-exec.html b/dgbuilder/core_nodes/core/75-exec.html
deleted file mode 100644
index 567a34c1..00000000
--- a/dgbuilder/core_nodes/core/75-exec.html
+++ /dev/null
@@ -1,68 +0,0 @@
-<!--
- Copyright 2013 IBM Corp.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<script type="text/x-red" data-template-name="exec">
- <div class="form-row">
- <label for="node-input-command"><i class="fa fa-file"></i> Command</label>
- <input type="text" id="node-input-command" placeholder="command">
- </div>
- <div class="form-row">
- <label for="node-input-append"><i class="fa fa-list"></i> Append</label>
- <input type="text" id="node-input-append" placeholder="extra input">
- </div>
- <div class="form-row">
- <label>&nbsp;</label>
- <input type="checkbox" id="node-input-useSpawn" placeholder="spawn" style="display: inline-block; width: auto; vertical-align: top;">
- <label for="node-input-useSpawn" style="width: 70%;">Use spawn() instead of exec() ?</label>
- </div>
- <div class="form-row">
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
- <input type="text" id="node-input-name" placeholder="Name">
- </div>
- <div class="form-tips">Tip: <i>spawn</i> expects only one command word - and appended args to be comma separated.</div>
-</script>
-
-<script type="text/x-red" data-help-name="exec">
- <p>Calls out to a system command.<br/></p>
- <p>Provides 3 outputs... stdout, stderr, and return code.</p>
- <p>By default uses exec() which calls the command, blocks while waiting for completion, and then returns the complete result in one go, along with any errors.</p>
- <p>Optionally can use spawn() instead, which returns output from stdout and stderr as the command runs (ie one line at a time). On completion it then returns a return code (on the 3rd output).</p>
- <p>Spawn only expect one command word, with all extra parameters to be comma separated and passed as the append.</p>
- <p>The optional append gets added to the command after the <b>msg.payload</b> - so you can do things like pipe the result to another command.</p>
-</script>
-
-<script type="text/javascript">
- RED.nodes.registerType('exec',{
- category: 'advanced-function',
- color:"darksalmon",
- defaults: {
- command: {value:"",required:true},
- append: {value:""},
- useSpawn: {value:""},
- name: {value:""}
- },
- inputs:1,
- outputs:3,
- icon: "arrow-in.png",
- align: "right",
- label: function() {
- return this.name||this.command;
- },
- labelStyle: function() {
- return this.name?"node_label_italic":"";
- }
- });
-</script>
diff --git a/dgbuilder/core_nodes/core/75-exec.js b/dgbuilder/core_nodes/core/75-exec.js
deleted file mode 100644
index a07b1401..00000000
--- a/dgbuilder/core_nodes/core/75-exec.js
+++ /dev/null
@@ -1,84 +0,0 @@
-/**
- * Copyright 2013 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-
-module.exports = function(RED) {
- "use strict";
- var spawn = require('child_process').spawn;
- var exec = require('child_process').exec;
-
- function ExecNode(n) {
- RED.nodes.createNode(this,n);
- this.cmd = n.command.trim();
- this.append = n.append.trim() || "";
- this.useSpawn = n.useSpawn;
-
- var node = this;
- this.on("input", function(msg) {
- node.status({fill:"blue",shape:"dot"});
- if (this.useSpawn === true) {
- // make the extra args into an array
- // then prepend with the msg.payload
- if (typeof(msg.payload !== "string")) { msg.payload = msg.payload.toString(); }
- var arg = [];
- if (node.append.length > 0) { arg = node.append.split(","); }
- if (msg.payload.trim() !== "") { arg.unshift(msg.payload); }
- node.log(node.cmd+" ["+arg+"]");
- if (node.cmd.indexOf(" ") == -1) {
- var ex = spawn(node.cmd,arg);
- ex.stdout.on('data', function (data) {
- //console.log('[exec] stdout: ' + data);
- msg.payload = data.toString();
- node.send([msg,null,null]);
- });
- ex.stderr.on('data', function (data) {
- //console.log('[exec] stderr: ' + data);
- msg.payload = data.toString();
- node.send([null,msg,null]);
- });
- ex.on('close', function (code) {
- //console.log('[exec] result: ' + code);
- msg.payload = code;
- node.status({});
- node.send([null,null,msg]);
- });
- ex.on('error', function (code) {
- node.warn(code);
- });
- }
- else { node.error("Spawn command must be just the command - no spaces or extra parameters"); }
- }
- else {
- var cl = node.cmd+" "+msg.payload+" "+node.append;
- node.log(cl);
- var child = exec(cl, function (error, stdout, stderr) {
- msg.payload = stdout;
- var msg2 = {payload:stderr};
- var msg3 = null;
- //console.log('[exec] stdout: ' + stdout);
- //console.log('[exec] stderr: ' + stderr);
- if (error !== null) {
- msg3 = {payload:error};
- //console.log('[exec] error: ' + error);
- }
- node.status({});
- node.send([msg,msg2,msg3]);
- });
- }
- });
- }
-
- RED.nodes.registerType("exec",ExecNode);
-}
diff --git a/dgbuilder/core_nodes/core/80-function.html b/dgbuilder/core_nodes/core/80-function.html
deleted file mode 100644
index 442c391d..00000000
--- a/dgbuilder/core_nodes/core/80-function.html
+++ /dev/null
@@ -1,110 +0,0 @@
-<!--
- Copyright 2013 IBM Corp.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<script type="text/x-red" data-template-name="function">
- <div class="form-row">
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
- <input type="text" id="node-input-name" placeholder="Name">
- </div>
- <div class="form-row">
- <label for="node-input-func"><i class="fa fa-wrench"></i> Function</label>
- <input type="hidden" id="node-input-func" autofocus="autofocus">
- <div style="height: 250px;" class="node-text-editor" id="node-input-func-editor" ></div>
- </div>
- <div class="form-row">
- <label for="node-input-outputs"><i class="fa fa-random"></i> Outputs</label>
- <input id="node-input-outputs" style="width: 60px; height: 1.7em;" value="1">
- </div>
- <div class="form-tips">See the Info tab for help writing functions.</div>
-</script>
-
-<script type="text/x-red" data-help-name="function">
- <p>A function block where you can write code to do more interesting things.</p>
- <p>The message is passed in as a JavaScript object called <code>msg</code>.</p>
- <p>By convention it will have a <code>msg.payload</code> property containing
- the body of the message.</p>
- <p>The function should return the messages it wants to pass on to the next nodes
- in the flow. It can return:</p>
- <ul>
- <li>a single message object - passed to nodes connected to the first output</li>
- <li>an array of message objects - passed to nodes connected to the corresponding outputs</li>
- </ul>
- <p>If any element of the array is itself an array of messages, multiple
- messages are sent to the corresponding output.</p>
- <p>If null is returned, either by itself or as an element of the array, no
- message is passed on.</p>
- <p>See the <a target="_new" href="http://nodered.org/docs/writing-functions.html">online documentation</a> for more help.</p>
-
-</script>
-
-<script type="text/javascript">
- RED.nodes.registerType('function',{
- color:"#fdd0a2",
- category: 'function',
- defaults: {
- name: {value:""},
- func: {value:"\nreturn msg;"},
- outputs: {value:1}
- },
- inputs:1,
- outputs:1,
- icon: "function.png",
- label: function() {
- return this.name;
- },
- oneditprepare: function() {
- $( "#node-input-outputs" ).spinner({
- min:1
- });
-
- function functionDialogResize(ev,ui) {
- $("#node-input-func-editor").css("height",(ui.size.height-275)+"px");
- };
-
- $( "#dialog" ).on("dialogresize", functionDialogResize);
- $( "#dialog" ).one("dialogopen", function(ev) {
- var size = $( "#dialog" ).dialog('option','sizeCache-function');
- if (size) {
- functionDialogResize(null,{size:size});
- }
- });
- $( "#dialog" ).one("dialogclose", function(ev,ui) {
- var height = $( "#dialog" ).dialog('option','height');
- $( "#dialog" ).off("dialogresize",functionDialogResize);
- });
- var that = this;
- require(["orion/editor/edit"], function(edit) {
- that.editor = edit({
- parent:document.getElementById('node-input-func-editor'),
- lang:"js",
- contents: $("#node-input-func").val()
- });
- RED.library.create({
- url:"functions", // where to get the data from
- type:"function", // the type of object the library is for
- editor:that.editor, // the field name the main text body goes to
- fields:['name','outputs']
- });
- $("#node-input-name").focus();
-
- });
- },
- oneditsave: function() {
- $("#node-input-func").val(this.editor.getText())
- delete this.editor;
- }
- });
-</script>
diff --git a/dgbuilder/core_nodes/core/80-function.js b/dgbuilder/core_nodes/core/80-function.js
deleted file mode 100644
index e1413a7a..00000000
--- a/dgbuilder/core_nodes/core/80-function.js
+++ /dev/null
@@ -1,79 +0,0 @@
-/**
- * Copyright 2013 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-
-module.exports = function(RED) {
- "use strict";
- var util = require("util");
- var vm = require("vm");
-
- function FunctionNode(n) {
- RED.nodes.createNode(this,n);
- this.name = n.name;
- this.func = n.func;
- var functionText = "var results = null; results = (function(msg){"+this.func+"\n})(msg);";
- this.topic = n.topic;
- var sandbox = {
- console:console,
- util:util,
- Buffer:Buffer,
- context: {
- global:RED.settings.functionGlobalContext || {}
- }
- };
- var context = vm.createContext(sandbox);
- try {
- this.script = vm.createScript(functionText);
- this.on("input", function(msg) {
- try {
- var start = process.hrtime();
- context.msg = msg;
- this.script.runInContext(context);
- var results = context.results;
- if (results == null) {
- results = [];
- } else if (results.length == null) {
- results = [results];
- }
- if (msg._topic) {
- for (var m in results) {
- if (results[m]) {
- if (util.isArray(results[m])) {
- for (var n=0; n < results[m].length; n++) {
- results[m][n]._topic = msg._topic;
- }
- } else {
- results[m]._topic = msg._topic;
- }
- }
- }
- }
- this.send(results);
- var duration = process.hrtime(start);
- if (process.env.NODE_RED_FUNCTION_TIME) {
- this.status({fill:"yellow",shape:"dot",text:""+Math.floor((duration[0]* 1e9 + duration[1])/10000)/100});
- }
- } catch(err) {
- this.error(err.toString());
- }
- });
- } catch(err) {
- this.error(err);
- }
- }
-
- RED.nodes.registerType("function",FunctionNode);
- RED.library.register("functions");
-}
diff --git a/dgbuilder/core_nodes/core/80-template.html b/dgbuilder/core_nodes/core/80-template.html
deleted file mode 100644
index dc014d37..00000000
--- a/dgbuilder/core_nodes/core/80-template.html
+++ /dev/null
@@ -1,102 +0,0 @@
-<!--
- Copyright 2013,2014 IBM Corp.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<script type="text/x-red" data-template-name="template">
- <div class="form-row">
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
- <input type="text" id="node-input-name" placeholder="Name">
- </div>
- <div class="form-row">
- <label for="node-input-template"><i class="fa fa-file-code-o"></i> Template</label>
- <input type="hidden" id="node-input-template" autofocus="autofocus">
- <div style="height: 250px;" class="node-text-editor" id="node-input-template-editor" ></div>
- </div>
- <div class="form-row">
- <label for="node-input-field"><i class="fa fa-edit"></i> Property</label>
- msg.<input type="text" id="node-input-field" placeholder="payload" style="width: 64%;">
- </div>
-</script>
-
-<script type="text/x-red" data-help-name="template">
- <p>Creates a new message based on the provided template.</p>
- <p>This uses the <i><a href="http://mustache.github.io/mustache.5.html" target="_new">mustache</a></i> format.</p>
- <p>For example, when a template of:
- <pre>Hello {{name}}. Today is {{date}}</pre>
- <p>receives a message containing:
- <pre>{
- name: "Fred",
- date: "Monday"
- payload: ...
-}</pre>
- <p>The resulting payload will be:
- <pre>Hello Fred. Today is Monday</pre>
-</script>
-
-<script type="text/javascript">
- RED.nodes.registerType('template',{
- color:"rgb(243, 181, 103)",
- category: 'function',
- defaults: {
- name: {value:""},
- field: {value:"payload"},
- template: {value:"This is the payload: {{payload}}!"},
- },
- inputs:1,
- outputs:1,
- icon: "template.png",
- label: function() {
- return this.name;
- },
- oneditprepare: function() {
-
- function templateDialogResize(ev,ui) {
- $("#node-input-template-editor").css("height",(ui.size.height-200)+"px");
- };
-
- $( "#dialog" ).on("dialogresize", templateDialogResize);
- $( "#dialog" ).one("dialogopen", function(ev) {
- var size = $( "#dialog" ).dialog('option','sizeCache-template');
- if (size) {
- templateDialogResize(null,{size:size});
- }
- });
- $( "#dialog" ).one("dialogclose", function(ev,ui) {
- var height = $( "#dialog" ).dialog('option','height');
- $( "#dialog" ).off("dialogresize",templateDialogResize);
- });
-
- var that = this;
- require(["orion/editor/edit"], function(edit) {
- that.editor = edit({
- parent:document.getElementById('node-input-template-editor'),
- lang:"html",
- contents: $("#node-input-template").val()
- });
- RED.library.create({
- url:"templates", // where to get the data from
- type:"template", // the type of object the library is for
- editor:that.editor, // the field name the main text body goes to
- fields:['name','field']
- });
- $("#node-input-name").focus();
- });
- },
- oneditsave: function() {
- $("#node-input-template").val(this.editor.getText())
- delete this.editor;
- }
- });
-</script>
diff --git a/dgbuilder/core_nodes/core/80-template.js b/dgbuilder/core_nodes/core/80-template.js
deleted file mode 100644
index 7c84142d..00000000
--- a/dgbuilder/core_nodes/core/80-template.js
+++ /dev/null
@@ -1,61 +0,0 @@
-/**
- * Copyright 2013 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-
-module.exports = function(RED) {
- "use strict";
- var mustache = require("mustache");
-
- function TemplateNode(n) {
- RED.nodes.createNode(this,n);
- this.name = n.name;
- this.field = n.field || "payload";
- this.template = n.template;
- var node = this;
-
- var b = node.field.split(".");
- var i = 0;
- var m = null;
- var rec = function(obj) {
- i += 1;
- if ((i < b.length) && (typeof obj[b[i-1]] === "object")) {
- rec(obj[b[i-1]]); // not there yet - carry on digging
- }
- else {
- if (i === b.length) { // we've finished so assign the value
- obj[b[i-1]] = mustache.render(node.template,m);
- node.send(m);
- }
- else {
- obj[b[i-1]] = {}; // needs to be a new object so create it
- rec(obj[b[i-1]]); // and carry on digging
- }
- }
- }
-
- node.on("input", function(msg) {
- try {
- m = msg;
- i = 0;
- rec(msg);
- } catch(err) {
- node.error(err.message);
- }
- });
- }
-
- RED.nodes.registerType("template",TemplateNode);
- RED.library.register("templates");
-}
diff --git a/dgbuilder/core_nodes/core/89-delay.html b/dgbuilder/core_nodes/core/89-delay.html
deleted file mode 100644
index dcb0a5b9..00000000
--- a/dgbuilder/core_nodes/core/89-delay.html
+++ /dev/null
@@ -1,167 +0,0 @@
-<!--
- Copyright 2013 IBM Corp.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<!-- First, the content of the edit dialog is defined. -->
-<script type="text/x-red" data-template-name="delay">
-
- <div class="form-row">
- <label for="node-input-pauseType"><i class="fa fa-tasks"></i> Action</label>
- <select id="node-input-pauseType" style="width:270px !important">
- <option value="delay">Delay message</option>
- <option value="rate">Limit rate to</option>
- <option value="random">Random delay</option>
- </select>
- </div>
- <div id="delay-details" class="form-row">
- <label for="node-input-timeout"><i class="fa fa-clock-o"></i> For</label>
- <input type="text" id="node-input-timeout" placeholder="Time" style="direction:rtl; width:50px !important">
- <select id="node-input-timeoutUnits" style="width:200px !important">
- <option value="milliseconds">Milliseconds</option>
- <option value="seconds">Seconds</option>
- <option value="minutes">Minutes</option>
- <option value="hours">Hours</option>
- <option value="days">Days</option>
- </select>
- </div>
-
- <div id="rate-details" class="form-row">
- <label for="node-input-rate"><i class="fa fa-clock-o"></i> To</label>
- <input type="text" id="node-input-rate" placeholder="1" style="direction:rtl; width:30px !important">
- <label for="node-input-reateUnits">msg(s) per</label>
- <select id="node-input-rateUnits" style="width:140px !important">
- <option value="second">Second</option>
- <option value="minute">Minute</option>
- <option value="hour">Hour</option>
- <option value="day">Day</option>
- </select>
- <br/>
- <input style="margin: 20px 0 20px 100px; width: 30px;" type="checkbox" id="node-input-drop"><label style="width: 250px;" for="node-input-drop">drop intermediate messages</label>
- </div>
-
- <div id="random-details" class="form-row">
- <label for="node-input-randomFirst"><i class="fa fa-clock-o"></i> Between</label>
- <input type="text" id="node-input-randomFirst" placeholder="" style="directon:rtl; width:30px !important">
- <label for="node-input-randomLast" style="width:20px"> &amp; </label>
- <input type="text" id="node-input-randomLast" placeholder="" style="directon:rtl; width:30px !important">
- <select id="node-input-randomUnits" style="width:140px !important">
- <option value="milliseconds">Milliseconds</option>
- <option value="seconds">Seconds</option>
- <option value="minutes">Minutes</option>
- <option value="hours">Hours</option>
- <option value="days">Days</option>
- </select>
- </div>
-
- <div class="form-row">
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
- <input type="text" id="node-input-name" placeholder="Name">
- </div>
-
-</script>
-
-<!-- Next, some simple help text is provided for the node. -->
-<script type="text/x-red" data-help-name="delay">
- <p>Introduces a delay into a flow or rate limts messges</p>
- <p>Default delay is 5 seconds and rate limit of 1 msg/second, but both can be configured</p>
-</script>
-
-<!-- Finally, the node type is registered along with all of its properties -->
-<script type="text/javascript">
- RED.nodes.registerType('delay',{
- category: 'function', // the palette category
- color:"#E6E0F8",
- defaults: { // defines the editable properties of the node
- name: {value:""}, // along with default values.
- pauseType: {value:"delay", required:true},
- timeout: {value:"5", required:true, validate:RED.validators.number()},
- timeoutUnits: {value:"seconds"},
- rate: {value:"1", required:true, validate:RED.validators.number()},
- rateUnits: {value: "second"},
- randomFirst: {value:"1", required:true, validate:RED.validators.number()},
- randomLast: {value:"5", required:true, validate:RED.validators.number()},
- randomUnits: {value: "seconds"},
- drop: {value:false}
- },
- inputs:1, // set the number of inputs - only 0 or 1
- outputs:1, // set the number of outputs - 0 to n
- icon: "timer.png", // set the icon (held in public/icons)
- label: function() { // sets the default label contents
- if (this.pauseType == "delay") {
- var units = this.timeoutUnits ? this.timeoutUnits.charAt(0) : "s";
- if (this.timeoutUnits == "milliseconds") { units = "ms"; }
- return this.name||"delay "+this.timeout+" " + units;
- } else if (this.pauseType == "rate") {
- var units = this.rateUnits ? this.rateUnits.charAt(0) : "s";
- return this.name||"limit "+this.rate+" msg/"+ units;
- } else if (this.pauseType == "random") {
- return this.name || "random";
- }
- return "foo";
- },
- labelStyle: function() { // sets the class to apply to the label
- return this.name?"node_label_italic":"";
- },
- oneditprepare: function() {
- $( "#node-input-timeout" ).spinner({min:1,max:60});
- $( "#node-input-rate" ).spinner({min:1});
-
- $( "#node-input-randomFirst" ).spinner({min:0});
- $( "#node-input-randomLast" ).spinner({min:1});
-
- if (this.pauseType == "delay") {
- $("#delay-details").show();
- $("#rate-details").hide();
- $("#random-details").hide();
- } else if (this.pauseType == "rate") {
- $("#delay-details").hide();
- $("#rate-details").show();
- $("#random-details").hide();
- } else if (this.pauseType == "random") {
- $("#delay-details").hide();
- $("#rate-details").hide();
- $("#random-details").show();
- }
-
- if (!this.timeoutUnits) {
- $("#node-input-timeoutUnits option").filter(function() {
- return $(this).val() == 'seconds';
- }).attr('selected', true);
- }
-
- if (!this.randomUnits) {
- $("#node-input-randomUnits option").filter(function() {
- return $(this).val() == 'seconds';
- }).attr('selected', true);
- }
-
- $("#node-input-pauseType").on("change",function() {
- if (this.value == "delay") {
- $("#delay-details").show();
- $("#rate-details").hide();
- $("#random-details").hide();
- } else if (this.value == "rate") {
- $("#delay-details").hide();
- $("#rate-details").show();
- $("#random-details").hide();
- } else if (this.value == "random") {
- $("#delay-details").hide();
- $("#rate-details").hide();
- $("#random-details").show();
- }
- });
- }
- });
-</script>
diff --git a/dgbuilder/core_nodes/core/89-delay.js b/dgbuilder/core_nodes/core/89-delay.js
deleted file mode 100644
index 3c4e1c01..00000000
--- a/dgbuilder/core_nodes/core/89-delay.js
+++ /dev/null
@@ -1,171 +0,0 @@
-/**
- * Copyright 2013, 2014 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-
-//Simple node to introduce a pause into a flow
-module.exports = function(RED) {
- "use strict";
-
- var MILLIS_TO_NANOS = 1000000;
- var SECONDS_TO_NANOS = 1000000000;
-
- function random(n) {
- var wait = n.randomFirst + (n.diff * Math.random());
- if (n.buffer.length > 0) {
- n.send(n.buffer.pop());
- n.randomID = setTimeout(function() {random(n);},wait);
- } else {
- n.randomID = -1;
- }
- }
-
- function DelayNode(n) {
- RED.nodes.createNode(this,n);
-
- this.pauseType = n.pauseType;
- this.timeoutUnits = n.timeoutUnits;
- this.randomUnits = n.randomUnits;
- this.rateUnits = n.rateUnits;
-
- if (n.timeoutUnits === "milliseconds") {
- this.timeout = n.timeout;
- } else if (n.timeoutUnits === "seconds") {
- this.timeout = n.timeout * 1000;
- } else if (n.timeoutUnits === "minutes") {
- this.timeout = n.timeout * (60 * 1000);
- } else if (n.timeoutUnits === "hours") {
- this.timeout = n.timeout * (60 * 60 * 1000);
- } else if (n.timeoutUnits === "days") {
- this.timeout = n.timeout * (24 * 60 * 60 * 1000);
- }
-
- if (n.rateUnits === "second") {
- this.rate = 1000/n.rate;
- } else if (n.rateUnits === "minute") {
- this.rate = (60 * 1000)/n.rate;
- } else if (n.rateUnits === "hour") {
- this.rate = (60 * 60 * 1000)/n.rate;
- } else if (n.rateUnits === "day") {
- this.rate = (24 * 60 * 60 * 1000)/n.rate;
- }
-
- if (n.randomUnits === "milliseconds") {
- this.randomFirst = n.randomFirst;
- this.randomLast = n.randomLast;
- } else if (n.randomUnits === "seconds") {
- this.randomFirst = n.randomFirst * 1000;
- this.randomLast = n.randomLast * 1000;
- } else if (n.randomUnits === "minutes") {
- this.randomFirst = n.randomFirst * (60 * 1000);
- this.randomLast = n.randomLast * (60 * 1000);
- } else if (n.randomUnits === "hours") {
- this.randomFirst = n.randomFirst * (60 * 60 * 1000);
- this.randomLast = n.randomLast * (60 * 60 * 1000);
- } else if (n.randomUnits === "days") {
- this.randomFirst = n.randomFirst * (24 * 60 * 60 * 1000);
- this.randomLast = n.randomLast * (24 * 60 * 60 * 1000);
- }
-
- this.diff = this.randomLast - this.randomFirst;
- this.name = n.name;
- this.idList = [];
- this.buffer = [];
- this.intervalID = -1;
- this.randomID = -1;
- this.lastSent;
- this.drop = n.drop;
- var node = this;
-
- if (this.pauseType === "delay") {
- this.on("input", function(msg) {
- var id;
- id = setTimeout(function(){
- node.idList.splice(node.idList.indexOf(id),1);
- node.send(msg);
- }, node.timeout);
- this.idList.push(id);
- });
-
- this.on("close", function() {
- for (var i=0; i<this.idList.length; i++ ) {
- clearTimeout(this.idList[i]);
- }
- this.idList = [];
- });
-
- } else if (this.pauseType === "rate") {
- this.on("input", function(msg) {
- if (!node.drop) {
- if ( node.intervalID !== -1) {
- node.buffer.push(msg);
- if (node.buffer.length > 0) {
- node.status({text:node.buffer.length});
- }
- if (node.buffer.length > 1000) {
- node.warn(this.name + " buffer exceeded 1000 messages");
- }
- } else {
- node.send(msg);
- node.intervalID = setInterval(function() {
- if (node.buffer.length === 0) {
- clearInterval(node.intervalID);
- node.intervalID = -1;
- node.status({text:""});
- }
-
- if (node.buffer.length > 0) {
- node.send(node.buffer.shift());
- node.status({text:node.buffer.length});
- }
- },node.rate);
- }
- } else {
- var timeSinceLast;
- if (node.lastSent) {
- timeSinceLast = process.hrtime(node.lastSent);
- }
- if (!node.lastSent) { // ensuring that we always send the first message
- node.lastSent = process.hrtime();
- node.send(msg);
- } else if ( ( (timeSinceLast[0] * SECONDS_TO_NANOS) + timeSinceLast[1] ) > (node.rate * MILLIS_TO_NANOS) ) {
- node.lastSent = process.hrtime();
- node.send(msg);
- }
- }
- });
-
- this.on("close", function() {
- clearInterval(this.intervalID);
- this.buffer = [];
- });
-
- } else if (this.pauseType === "random") {
- this.on("input",function(msg){
- node.buffer.push(msg);
- if (node.randomID === -1) {
- var wait = node.randomFirst + (node.diff * Math.random());
- node.randomID = setTimeout(function() {random(node);},wait);
- }
- });
-
- this.on("close", function (){
- if (this.randomID !== -1) {
- clearTimeout(this.randomID);
- }
- });
- }
- }
- RED.nodes.registerType("delay",DelayNode);
-}
diff --git a/dgbuilder/core_nodes/core/89-trigger.html b/dgbuilder/core_nodes/core/89-trigger.html
deleted file mode 100644
index f3ec530d..00000000
--- a/dgbuilder/core_nodes/core/89-trigger.html
+++ /dev/null
@@ -1,130 +0,0 @@
-<!--
- Copyright 2014 IBM Corp.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<script type="text/x-red" data-template-name="trigger">
- <div class="form-row">
- <label for="node-input-op1type"><i class="fa fa-arrow-up"></i> Output</label>
- <select id="node-input-op1type" style="width:73% !important">
- <option value="val">the value below</option>
- <option value="pay">the existing payload</option>
- <option value="nul">nothing (no output)</option>
- </select>
- </div>
- <div class="form-row" id="node-op1">
- <label for="node-input-op1">&nbsp;</label>
- <input type="text" id="node-input-op1">
- </div>
- <div class="form-row">
- <label for="node-input-duration"><i class="fa fa-clock-o"></i> then wait</label>
- <input type="text" id="node-input-duration" placeholder="250" style="direction:rtl; width:70px !important">
- <select id="node-input-units" style="width:140px !important">
- <option value="ms">Milliseconds</option>
- <option value="s">Seconds</option>
- <option value="min">Minutes</option>
- <option value="hr">Hours</option>
- </select>
- </div>
- <div class="form-row">
- <label for="node-input-op2type"><i class="fa fa-arrow-down"></i> output</label>
- <select id="node-input-op2type" style="width:73% !important">
- <option value="val">the value below</option>
- <option value="pay">the existing payload</option>
- <option value="nul">nothing (no output)</option>
- </select>
- </div>
- <div class="form-row" id="node-op2">
- <label for="node-input-op2">&nbsp;</label>
- <input type="text" id="node-input-op2">
- </div>
- <div class="form-row">
- <label for="node-input-extend"><i class="fa fa-repeat"></i> and</label>
- <select id="node-input-extend" style="width:73% !important">
- <option value="false">don't extend the timer if retriggered</option>
- <option value="true">extend the timer if retriggered</option>
- </select>
- </div>
- <div class="form-row">
- <label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
- <input type="text" id="node-input-name" placeholder="Name">
- </div>
- <!-- <div class="form-tips">Tip: Outputs can be values, null, {{templated}} or msg.payload<br/> -->
- <div class="form-tips">Setting the timeout to 0 sets an infinite timeout = single shot.</div>
- <script>
- {
- $("#node-input-op1type").change(function() {
- if ($("#node-input-op1type").val() == "val") { $("#node-op1").show(); }
- else { $("#node-op1").hide(); }
- });
- $("#node-input-op2type").change(function() {
- if ($("#node-input-op2type").val() == "val") { $("#node-op2").show(); }
- else { $("#node-op2").hide(); }
- });
- }
- </script>
-</script>
-
-<script type="text/x-red" data-help-name="trigger">
- <p>Creates two messages on the output separated by a timeout whenever ANY <b>msg</b> arrives on the input.</p>
- <p>For example, this can be used to toggle a Raspberry PI GPIO pin on and off.</p>
- <p>The two output states can be specified as can the duration of the timer.
- Either output can be set to a value, or templated from the inbound
- <b>msg</b> using mustache syntax. <pre>The payload is {{payload}}</pre></p>
- <p>If the payload is an object then setting the output to <i>existing payload</i> will pass the complete payload object through.</p>
- <p>Optionally the timer can be extended by being retriggered... or not.</p>
- <p>By setting the first output to <i>nothing</i>, and selecting extend timer - a watchdog timer can be created.
- No output will happen as long as repeated inputs occur within the timeout period.</p>
- <p>Setting the timer to 0 creates an "infinite" timeout - the first output will happen but the second
- never will, and neither can the first be retriggered - so a true one shot.</p>
- <p>If a <b>msg.reset</b> property is present any timeout currently in progress
- will be cleared and the second output will not happen.</p>
-</script>
-
-<script type="text/javascript">
- RED.nodes.registerType('trigger',{
- category: 'function',
- color:"#E6E0F8",
- defaults: {
- op1: {value:"1"},
- op2: {value:"0"},
- op1type: {value:""},
- op2type: {value:""},
- duration: {value:"250",required:true,validate:RED.validators.number()},
- extend: {value:"false"},
- units: {value: "ms"},
- name: {value:""}
- },
- inputs:1,
- outputs:1,
- icon: "trigger.png",
- label: function() {
- if (this.duration > 0) {
- return this.name||"trigger "+this.duration+this.units;
- }
- else {
- return this.name||"trigger once &infin;";
- }
- },
- labelStyle: function() {
- return this.name?"node_label_italic":"";
- },
- oneditprepare: function() {
- $( "#node-input-duration" ).spinner({
- min:1,
- increment:25
- });
- }
- });
-</script>
diff --git a/dgbuilder/core_nodes/core/89-trigger.js b/dgbuilder/core_nodes/core/89-trigger.js
deleted file mode 100644
index d86a2130..00000000
--- a/dgbuilder/core_nodes/core/89-trigger.js
+++ /dev/null
@@ -1,91 +0,0 @@
-/**
- * Copyright 2014 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-
-module.exports = function(RED) {
- "use strict";
- var mustache = require("mustache");
- function TriggerNode(n) {
- RED.nodes.createNode(this,n);
- this.op1 = n.op1 || "1";
- this.op2 = n.op2 || "0";
- this.op1type = n.op1type || "val";
- this.op2type = n.op2type || "val";
- this.extend = n.extend || false;
- this.units = n.units || "ms";
- this.duration = n.duration || 250;
- if (this.duration <= 0) { this.duration = 0; }
- else {
- if (this.units == "s") { this.duration = this.duration * 1000; }
- if (this.units == "min") { this.duration = this.duration * 1000 * 60; }
- if (this.units == "hr") { this.duration = this.duration * 1000 *60 * 60; }
- }
- this.op1Templated = this.op1.indexOf("{{") != -1;
- this.op2Templated = this.op2.indexOf("{{") != -1;
- if (!isNaN(this.op1)) { this.op1 = Number(this.op1); }
- if (!isNaN(this.op2)) { this.op2 = Number(this.op2); }
- if (this.op1 == "true") { this.op1 = true; }
- if (this.op2 == "true") { this.op1 = true; }
- if (this.op1 == "false") { this.op2 = false; }
- if (this.op2 == "false") { this.op2 = false; }
- if (this.op1 == "null") { this.op1 = null; }
- if (this.op2 == "null") { this.op1 = null; }
- try { this.op1 = JSON.parse(this.op1); }
- catch(e) { this.op1 = this.op1; }
- try { this.op2 = JSON.parse(this.op2); }
- catch(e) { this.op2 = this.op2; }
-
- var node = this;
- var tout = null;
- var m2;
- this.on("input", function(msg) {
- if (msg.hasOwnProperty("reset")) {
- clearTimeout(tout);
- tout = null;
- }
- else {
- if (!tout) {
- if (node.op2type === "pay") { m2 = msg.payload; }
- else if (node.op2Templated) { m2 = mustache.render(node.op2,msg); }
- else { m2 = node.op2; }
- if (node.op1type === "pay") { }
- else if (node.op1Templated) { msg.payload = mustache.render(node.op1,msg); }
- else { msg.payload = node.op1; }
- if (node.op1type !== "nul") { node.send(msg); }
- if (node.duration === 0) { tout = "infinite"; }
- else {
- tout = setTimeout(function() {
- msg.payload = m2;
- if (node.op2type !== "nul") { node.send(msg); }
- tout = null;
- },node.duration);
- }
- }
- else if ((node.extend == "true") && (node.duration > 0)) {
- clearTimeout(tout);
- tout = setTimeout(function() {
- msg.payload = m2;
- if (node.op2type !== "nul") { node.send(msg); }
- tout = null;
- },node.duration);
- }
- }
- });
- this.on("close", function() {
- if (tout) { clearTimeout(tout); }
- });
- }
- RED.nodes.registerType("trigger",TriggerNode);
-}
diff --git a/dgbuilder/core_nodes/core/90-comment.html b/dgbuilder/core_nodes/core/90-comment.html
deleted file mode 100644
index 3638fdaa..00000000
--- a/dgbuilder/core_nodes/core/90-comment.html
+++ /dev/null
@@ -1,86 +0,0 @@
-<!--
- Copyright 2013 IBM Corp.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<script type="text/x-red" data-template-name="comment">
- <div class="form-row">
- <label for="node-input-name"><i class="fa fa-comment"></i> Comment</label>
- <input type="text" id="node-input-name" placeholder="Comment">
- </div>
- <div class="form-row">
- <label for="node-input-info" style="width: 100% !important;"><i class="fa fa-comments"></i> More</label>
- <input type="hidden" id="node-input-info" autofocus="autofocus">
- <div style="height: 250px;" class="node-text-editor" id="node-input-info-editor" ></div>
- </div>
- <div class="form-tips">Tip: this isn't meant for "War and Peace" - but useful notes can be kept here.</div>
-</script>
-
-<script type="text/x-red" data-help-name="comment">
- <p>Simple comment block.</p>
-</script>
-
-<script type="text/javascript">
- RED.nodes.registerType('comment',{
- category: 'function',
- color:"#ffffff",
- defaults: {
- name: {value:""},
- info: {value:""}
- },
- inputs:0,
- outputs:0,
- icon: "comment.png",
- label: function() {
- return this.name||"";
- },
- labelStyle: function() {
- return this.name?"node_label_italic":"";
- },
- oneditprepare: function() {
- $( "#node-input-outputs" ).spinner({
- min:1
- });
- function functionDialogResize(ev,ui) {
- $("#node-input-info-editor").css("height",(ui.size.height-235)+"px");
- };
- $( "#dialog" ).on("dialogresize", functionDialogResize);
- $( "#dialog" ).one("dialogopen", function(ev) {
- var size = $( "#dialog" ).dialog('option','sizeCache-function');
- if (size) {
- functionDialogResize(null,{size:size});
- }
- });
- $( "#dialog" ).one("dialogclose", function(ev,ui) {
- var height = $( "#dialog" ).dialog('option','height');
- $( "#dialog" ).off("dialogresize",functionDialogResize);
- });
- var that = this;
- require(["orion/editor/edit"], function(edit) {
- that.editor = edit({
- parent:document.getElementById('node-input-info-editor'),
- lang:"text",
- showLinesRuler:false,
- showFoldingRuler:false,
- contents: $("#node-input-info").val()
- });
- $("#node-input-name").focus();
- });
- },
- oneditsave: function() {
- $("#node-input-info").val(this.editor.getText());
- delete this.editor;
- }
- });
-</script>
diff --git a/dgbuilder/core_nodes/core/90-comment.js b/dgbuilder/core_nodes/core/90-comment.js
deleted file mode 100644
index ef5f0800..00000000
--- a/dgbuilder/core_nodes/core/90-comment.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright 2013 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-
-module.exports = function(RED) {
- "use strict";
- function CommentNode(n) {
- RED.nodes.createNode(this,n);
- }
- RED.nodes.registerType("comment",CommentNode);
-}
diff --git a/dgbuilder/core_nodes/core/98-unknown.html b/dgbuilder/core_nodes/core/98-unknown.html
deleted file mode 100644
index 19a4ad59..00000000
--- a/dgbuilder/core_nodes/core/98-unknown.html
+++ /dev/null
@@ -1,49 +0,0 @@
-<!--
- Copyright 2013 IBM Corp.
-
- Licensed under the Apache License, Version 2.0 (the "License");
- you may not use this file except in compliance with the License.
- You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
- Unless required by applicable law or agreed to in writing, software
- distributed under the License is distributed on an "AS IS" BASIS,
- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- See the License for the specific language governing permissions and
- limitations under the License.
--->
-
-<script type="text/x-red" data-template-name="unknown">
- <div class="form-tips"><p>This node is a type unknown to your installation of Node-RED.</p>
- <p><i>If you deploy with the node in this state, it will lose all of its configuration.</i></p>
- <p>See the Info side bar for more help</p></div>
-</script>
-
-<script type="text/x-red" data-help-name="unknown">
- <p>This node is a type unknown to your installation of Node-RED.</p>
- <p><i>If you deploy with the node in this state, it will lose all of its configuration.</i></p>
- <p>It is possible this node type is already installed, but is missing a dependency. Check the Node-RED start-up log for
- any error messages associated with the missing node type. Use <b>npm install &lt;module&gt;</b> to install any missing modules
- and restart Node-RED and reimport the nodes.</p>
- <p>Otherwise, you should contact the author of the flow to obtain a copy of the missing node type.</p>
-</script>
-
-<script type="text/javascript">
- RED.nodes.registerType('unknown',{
- category: 'unknown',
- color:"#fff0f0",
- defaults: {
- name: {value:""}
- },
- inputs:1,
- outputs:1,
- icon: "",
- label: function() {
- return "("+this.name+")"||"unknown";
- },
- labelStyle: function() {
- return "node_label_unknown";
- }
- });
-</script>
diff --git a/dgbuilder/core_nodes/core/98-unknown.js b/dgbuilder/core_nodes/core/98-unknown.js
deleted file mode 100644
index ed4716b8..00000000
--- a/dgbuilder/core_nodes/core/98-unknown.js
+++ /dev/null
@@ -1,23 +0,0 @@
-/**
- * Copyright 2013 IBM Corp.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- **/
-
-module.exports = function(RED) {
- "use strict";
- function UnknownNode(n) {
- RED.nodes.createNode(this,n);
- }
- RED.nodes.registerType("unknown",UnknownNode);
-}