diff options
Diffstat (limited to 'dgbuilder/nodes')
68 files changed, 0 insertions, 8485 deletions
diff --git a/dgbuilder/nodes/99-sample.html.demo b/dgbuilder/nodes/99-sample.html.demo deleted file mode 100644 index 4dcc8ba5..00000000 --- a/dgbuilder/nodes/99-sample.html.demo +++ /dev/null @@ -1,79 +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. ---> - -<!-- Sample html file that corresponds to the 99-sample.js file --> -<!-- This creates and configures the onscreen elements of the node --> - -<!-- If you use this as a template, update the copyright with your own name. --> - -<!-- First, the content of the edit dialog is defined. --> - -<script type="text/x-red" data-template-name="sample"> - <!-- data-template-name identifies the node type this is for --> - - <!-- Each of the following divs creates a field in the edit dialog. --> - <!-- Generally, there should be an input for each property of the node. --> - <!-- The for and id attributes identify the corresponding property --> - <!-- (with the 'node-input-' prefix). --> - <!-- The available icon classes are defined Twitter Bootstrap glyphicons --> - <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> - - <br/> - <!-- By convention, most nodes have a 'name' property. The following div --> - <!-- provides the necessary field. Should always be the last option --> - <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="sample"> - <!-- data-help-name identifies the node type this help is for --> - <!-- This content appears in the Info sidebar when a node is selected --> - <!-- The first <p> is used as the pop-up tool tip when hovering over a --> - <!-- node in the palette. --> - <p>Simple sample input node. Just sends a single message when it starts up. - This is not very useful.</p> - <p>Outputs an object called <b>msg</b> containing <b>msg.topic</b> and - <b>msg.payload</b>. msg.payload is a String.</p> -</script> - -<!-- Finally, the node type is registered along with all of its properties --> -<!-- The example below shows a small subset of the properties that can be set--> -<script type="text/javascript"> - RED.nodes.registerType('sample',{ - category: 'input', // the palette category - defaults: { // defines the editable properties of the node - name: {value:""}, // along with default values. - topic: {value:"", required:true} - }, - inputs:1, // set the number of inputs - only 0 or 1 - outputs:1, // set the number of outputs - 0 to n - // set the icon (held in icons dir below where you save the node) - icon: "myicon.png", // saved in icons/myicon.png - label: function() { // sets the default label contents - return this.name||this.topic||"sample"; - }, - labelStyle: function() { // sets the class to apply to the label - return this.name?"node_label_italic":""; - } - }); -</script> diff --git a/dgbuilder/nodes/99-sample.js.demo b/dgbuilder/nodes/99-sample.js.demo deleted file mode 100644 index f9269451..00000000 --- a/dgbuilder/nodes/99-sample.js.demo +++ /dev/null @@ -1,64 +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. - **/ - -// If you use this as a template, update the copyright with your own name. - -// Sample Node-RED node file - - -module.exports = function(RED) { - "use strict"; - // require any external libraries we may need.... - //var foo = require("foo-library"); - - // The main node definition - most things happen in here - function SampleNode(n) { - // Create a RED node - RED.nodes.createNode(this,n); - - // Store local copies of the node configuration (as defined in the .html) - this.topic = n.topic; - - // Do whatever you need to do in here - declare callbacks etc - // Note: this sample doesn't do anything much - it will only send - // this message once at startup... - // Look at other real nodes for some better ideas of what to do.... - var msg = {}; - msg.topic = this.topic; - msg.payload = "Hello world !" - - // send out the message to the rest of the workspace. - this.send(msg); - - // respond to inputs.... - this.on('input', function (msg) { - node.warn("I saw a payload: "+msg.payload); - // in this example just send it straight on... should process it here really - this.send(msg); - }); - - this.on("close", function() { - // Called when the node is shutdown - eg on redeploy. - // Allows ports to be closed, connections dropped etc. - // eg: this.client.disconnect(); - }); - } - - // Register the node by name. This must be called before overriding any of the - // Node functions. - RED.nodes.registerType("sample",SampleNode); - -} diff --git a/dgbuilder/nodes/dge/dgelogic/block.html b/dgbuilder/nodes/dge/dgelogic/block.html deleted file mode 100644 index fadf8a8c..00000000 --- a/dgbuilder/nodes/dge/dgelogic/block.html +++ /dev/null @@ -1,223 +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="block"> - <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"> - <div> - <table border='0' width='100%' style='cellspacing:5px;'> - <tr> - <td> - <input type="checkbox" id="node-input-atomic-chkBox" onclick=updateXml()> - <input type="hidden" id="node-input-atomic" value=""> - </td> - <td> - <span style="font-size:.8em;">Atomic</span> - </td> - </tr> - </table> - </div> - <label for="node-input-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="block"> - <p>A block node.</p> - <p>Name can be anything.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - - <div class="section"> -<h3><a name="Flow_Control"></a>Flow Control</h3> -<div class="section"> -<h4><a name="Block_node"></a>Block node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>block</b> node is used to executes a set of nodes. </p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>atomic</b></td> -<td align="left">if <i>true</i>, then if a node returns failure, subsequent nodes will not be executed and nodes already executed will be backed out.</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>None</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<p>None</p></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><block> - <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder"> - <parameter name="file" value="/tmp/sample_r1.log" /> - <parameter name="field1" value="__TIMESTAMP__"/> - <parameter name="field2" value="RESERVED"/> - <parameter name="field3" value="$asePort.uni_circuit_id"/> - </record> - <return status="success"> - <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" /> - </return> -</block></pre></div></div></div> - -</script> - - -<script type="text/javascript"> - var blockXmlEditor ; - RED.nodes.registerType('block',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"block"}, - xml: {value:"<block>\n"}, - atomic: {value:"false"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - var atomic = $( "#node-input-atomic").val(); - if(atomic == "true"){ - $('#node-input-atomic-chkBox').prop('checked', true); - }else{ - $('#node-input-atomic-chkBox').prop('checked', false); - } - - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").val() - }); - blockXmlEditor=that.editor; - 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(); - $("#node-input-validate").click(function(){ - //console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - //console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - delete blockXmlEditor; - } - }); -function updateXml(){ - if($("#node-input-atomic-chkBox").is(':checked')){ - $("#node-input-name").val("block : atomic"); - $("#node-input-atomic").val("true"); - //alert($("#node-input-xml-editor div.textview div.textviewContent").text()); - var xmlStr = blockXmlEditor.getText(); - var re = new RegExp("<block[^<]+"); - xmlStr=xmlStr.replace(re,"<block atomic='true'>"); - //$("#node-input-xml-editor div.textview div.textviewContent").text(xmlStr); - blockXmlEditor.setText(xmlStr); - //console.log("block xmlStr:" + xmlStr); - }else{ - $("#node-input-name").val("block"); - $("#node-input-atomic").val("false"); - var xmlStr = blockXmlEditor.getText(); - var re = new RegExp("<block[^<]+"); - xmlStr=xmlStr.replace(re,"<block>"); - blockXmlEditor.setText(xmlStr); - //$("#node-input-xml-editor div.textview div.textviewContent").text(xmlStr); - //console.log("block xmlStr:" + xmlStr); - } -} -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/block.js b/dgbuilder/nodes/dge/dgelogic/block.js deleted file mode 100644 index 4414d86d..00000000 --- a/dgbuilder/nodes/dge/dgelogic/block.js +++ /dev/null @@ -1,31 +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 block(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("block",block); - // RED.library.register("block"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/breakNode.html b/dgbuilder/nodes/dge/dgelogic/breakNode.html deleted file mode 100644 index e3edef9d..00000000 --- a/dgbuilder/nodes/dge/dgelogic/breakNode.html +++ /dev/null @@ -1,161 +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="break"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="break"> - <p>A break node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Break_node"></a>Break node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>break</b> node works like a break in any programming language. So you can break out of a for loop.</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<p>Not applicable. The <b>break</b> node does not have attributes.</p></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>Not applicable. The <b>break</b> node does not have attributes.</p> </div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<p>Not applicable. The <b>break</b> node has no outcomes.</p></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><break> -</pre></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('break',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"break"}, - xml: {value:"<break>\n"}, - comments:{value:""} - }, - inputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/breakNode.js b/dgbuilder/nodes/dge/dgelogic/breakNode.js deleted file mode 100644 index 9b0b1b00..00000000 --- a/dgbuilder/nodes/dge/dgelogic/breakNode.js +++ /dev/null @@ -1,31 +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 breakNode(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("break",breakNode); - // RED.library.register("block"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/call.html b/dgbuilder/nodes/dge/dgelogic/call.html deleted file mode 100644 index 0e49e26c..00000000 --- a/dgbuilder/nodes/dge/dgelogic/call.html +++ /dev/null @@ -1,183 +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="call"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="call"> - <p>A call node.</p> - <p>Name can be anything.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Call_node"></a>Call node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>call</b> node is used to call another graph</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>module</b></td> -<td align="left">Module of directed graph to call. If unset, defaults to that of calling graph</td></tr> -<tr class="b"> -<td align="center"><b>rpc</b></td> -<td align="left">rpc of directed graph to call.</td></tr> -<tr class="a"> -<td align="center"><b>version</b></td> -<td align="left">version of graph to call, If unset, uses active version.</td></tr> -<tr class="b"> -<td align="center"><b>mode</b></td> -<td align="left">mode (sync/async) of graph to call. If unset, defaults to that of calling graph.</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>Not applicable</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"><caption> .</caption> -<tr class="a"> -<td align="center"><b>success</b></td> -<td align="left">Sub graph returned success</td></tr> -<tr class="b"> -<td align="center"><b>not-found</b></td> -<td align="left">Graph not found</td></tr> -<tr class="a"> -<td align="center"><b>failure</b></td> -<td align="left">Subgraph returned success</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><call rpc="svc-topology-reserve" mode="sync" /></pre></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('call',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"call"}, - xml: {value:"<call module='' rpc='' mode='sync' >\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - //console.log("show Values clicked."); - showValuesBox(that.editor,rpcValues); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/call.js b/dgbuilder/nodes/dge/dgelogic/call.js deleted file mode 100644 index 3570e3db..00000000 --- a/dgbuilder/nodes/dge/dgelogic/call.js +++ /dev/null @@ -1,31 +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 call(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("call",call); - // RED.library.register("call"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/configure.html b/dgbuilder/nodes/dge/dgelogic/configure.html deleted file mode 100644 index 69db7638..00000000 --- a/dgbuilder/nodes/dge/dgelogic/configure.html +++ /dev/null @@ -1,227 +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="configure"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="configure"> - <p>A configure node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - - - <div class="section"> -<h3><a name="Device_Management"></a>Device Management</h3> -<div class="section"> -<h4><a name="Configure_node"></a>Configure node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>configure</b> node is used to configure a device.</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class of resource adaptor to be used</td></tr> -<tr class="b"> -<td align="center"><b>activate</b></td> -<td align="left">Activate device/interface, for devices that support a separate activation step.</td></tr> -<tr class="a"> -<td align="center"><b>key</b></td> -<td align="left">SQL-like string specifying criteria for item to configure</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>Specific to device adaptor.</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>success</b></td> -<td align="left">Device successfully configured</td></tr> -<tr class="b"> -<td align="center"><b>not-found</b></td> -<td align="left">Element to be configured does not exist.</td></tr> -<tr class="a"> -<td align="center"><b>not-ready</b></td> -<td align="left">Element is not in a state where it can be configured/activated</td></tr> -<tr class="b"> -<td align="center"><b>already-active</b></td> -<td align="left">Attempt to activate element that is already active</td></tr> -<tr class="a"> -<td align="center"><b>failure</b></td> -<td align="left">Configure failed for some other reason</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><configure adaptor="org.onap.ccsdk.sli.core.sli.adaptor.emt.EmtAdaptor" - key="$uni-circuit-id" activate="true"> - <parameter name="circuit.id" value="$uni-circuit-id" /> - <parameter name="subscriber.name" value="$subscriber-name" /> - <parameter name="emt.clli" value="$edge-device-clli" /> - <parameter name="port.tagging" value="$port-tagging" /> - <parameter name="port.mediaSpeed" value="$media-speed" /> - <parameter name="location.state" value="$uni-location-state" /> - <parameter name="location.city" value="$uni-location-city" /> - <parameter name="cosCategory" value="$cos-category" /> - <parameter name="gosProfile" value="$gos-profile" /> - <parameter name="lldp" value="$asePort.resource-lldp" /> - <parameter name="mtu" value="$asePort.resource-mtu" /> - <outcome value="success"> - <block> - <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder"> - <parameter name="file" value="/tmp/sampler1.log" /> - <parameter name="field1" value="__TIMESTAMP__"/> - <parameter name="field2" value="ACTIVE"/> - <parameter name="field3" value="$uni-circuit-id"/> - </record> - <return status="success"> - <parameter name="edge-device-clli" value="$asePort.resource-emt-clli" /> - </return> - </block> - </outcome> - <outcome value="already-active"> - <return status="failure"> - <parameter name="error-code" value="1590" /> - <parameter name="error-message" value="Port already active" /> - </return> - </outcome> - <outcome value="Other"> - <return status="failure"> - <parameter name="error-code" value="1542" /> - <parameter name="error-message" value="Activation failure" /> - </return> - </outcome> -</configure></pre></div></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('configure',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"configure"}, - xml: {value:"<configure adaptor='' key='' activate='' >\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/configure.js b/dgbuilder/nodes/dge/dgelogic/configure.js deleted file mode 100644 index 7345750d..00000000 --- a/dgbuilder/nodes/dge/dgelogic/configure.js +++ /dev/null @@ -1,31 +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 configure(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("configure",configure); - // RED.library.register("configure"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/delete.html b/dgbuilder/nodes/dge/dgelogic/delete.html deleted file mode 100644 index e81a9645..00000000 --- a/dgbuilder/nodes/dge/dgelogic/delete.html +++ /dev/null @@ -1,187 +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="delete"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="delete"> - <p>A delete node.</p> - <p>Name can be anything.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Delete_node"></a>Delete node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>delete</b> node is used to delete a resource from the local resource inventory.</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class of resource adaptor to be used</td></tr> -<tr class="b"> -<td align="center"><b>resource</b></td> -<td align="left">Type of resource to delete</td></tr> -<tr class="a"> -<td align="center"><b>key</b></td> -<td align="left">SQL-like string specifying key to delete</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>None</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>success</b></td> -<td align="left">Resource specified deleted successfully.</td></tr> -<tr class="b"> -<td align="center"><i>failure</i>></td> -<td align="left">Resource specified was not deleted</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><delete plugin="org.onap.ccsdk.sli.core.sli.resource.samplesvc.SampleServiceResource" - resource="ase-port" - key="uni_circuit_id == $uni-circuit-id"> - <outcome value="true"> - <return status="success"/> - </outcome> - <outcome value="false"> - <return status="failure"/> - </outcome> -</delete></pre></div></div></div> - - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('delete',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"delete"}, - xml: {value:"<delete plugin='' resource='' key=''>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/delete.js b/dgbuilder/nodes/dge/dgelogic/delete.js deleted file mode 100644 index 37731061..00000000 --- a/dgbuilder/nodes/dge/dgelogic/delete.js +++ /dev/null @@ -1,31 +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 deleteNode(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("delete",deleteNode); - // RED.library.register("delete"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/execute.html b/dgbuilder/nodes/dge/dgelogic/execute.html deleted file mode 100644 index 6980cf18..00000000 --- a/dgbuilder/nodes/dge/dgelogic/execute.html +++ /dev/null @@ -1,197 +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="execute"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="execute"> - <p>A execute node.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - <div class="section"> -<h3><a name="Java_Plugin_Support"></a>Java Plugin Support</h3> -<div class="section"> -<h4><a name="Execute_node"></a>Execute node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>An <b>execute</b> node is used to execute Java code supplied as a plugin</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class of plugin to be used</td></tr> -<tr class="b"> -<td align="center"><b>method</b></td> -<td align="left">Name of method in the plugin class to execute. Method must return void, and take 2 arguments: a Map (for parameters) and a SvcLogicContext (to allow plugin read/write access to context memory)</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>Specific to plugin / method</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>success</b></td> -<td align="left">Device successfully configured</td></tr> -<tr class="b"> -<td align="center"><b>not-found</b></td> -<td align="left">Plugin class could not be loaded</td></tr> -<tr class="a"> -<td align="center"><b>unsupported-method</b></td> -<td align="left">Named method taking (Map, SvcLogicContext) could not be found</td></tr> -<tr class="b"> -<td align="center"><b>failure</b></td> -<td align="left">Configure failed for some other reason</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><execute plugin="org.onap.ccsdk.sli.core.sli.plugin.HelloWorld" - method="log"> - <parameter name="message" value="Hello, world!" /> - <outcome value="success"> - <return status="success"/> - </outcome> - <outcome value="not-found"> - <return status="failure"> - <parameter name="error-code" value="1590" /> - <parameter name="error-message" value="Could not locate plugin" /> - </return> - </outcome> - <outcome value="Other"> - <return status="failure"> - <parameter name="error-code" value="1542" /> - <parameter name="error-message" value="Internal error" /> - </return> - </outcome> -</execute></pre></div></div></div></div> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('execute',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"execute"}, - xml: {value:"<execute plugin='' method='' >\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/execute.js b/dgbuilder/nodes/dge/dgelogic/execute.js deleted file mode 100644 index 66265f98..00000000 --- a/dgbuilder/nodes/dge/dgelogic/execute.js +++ /dev/null @@ -1,31 +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 execute(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("execute",execute); - // RED.library.register("configure"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/exists.html b/dgbuilder/nodes/dge/dgelogic/exists.html deleted file mode 100644 index 0d1c6697..00000000 --- a/dgbuilder/nodes/dge/dgelogic/exists.html +++ /dev/null @@ -1,187 +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="exists"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="exists"> - <p>A exists node.</p> - <p>Name can be anything.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Exists_node"></a>Exists node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>An <b>exists</b> node is used to determine whether a particular instance of a resource exists. For example, this might be used to test whether a particular switch CLLI is provisioned.</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class of resource adaptor to be used</td></tr> -<tr class="b"> -<td align="center"><b>resource</b></td> -<td align="left">Type of resource to check</td></tr> -<tr class="a"> -<td align="center"><b>key</b></td> -<td align="left">SQL-like string specifying key to check for</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>None</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>true</b></td> -<td align="left">Resource specified exists.</td></tr> -<tr class="b"> -<td align="center"><b>false</b></td> -<td align="left">Resource specified is unknown</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><exists plugin="org.onap.ccsdk.sli.core.sli.resource.samplesvc.SampleServiceResource" - resource="ase-port" - key="uni_circuit_id == $uni-circuit-id"> - <outcome value="true"> - <return status="success"/> - </outcome> - <outcome value="false"> - <return status="failure"/> - </outcome> -</exists></pre></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('exists',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"exists"}, - xml: {value:"<exists plugin='' resource='' key=''>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/exists.js b/dgbuilder/nodes/dge/dgelogic/exists.js deleted file mode 100644 index d4482afc..00000000 --- a/dgbuilder/nodes/dge/dgelogic/exists.js +++ /dev/null @@ -1,31 +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 exists(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("exists",exists); - // RED.library.register("exists"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/forNode.html b/dgbuilder/nodes/dge/dgelogic/forNode.html deleted file mode 100644 index b6095a5a..00000000 --- a/dgbuilder/nodes/dge/dgelogic/forNode.html +++ /dev/null @@ -1,172 +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="for"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="for"> - <p>A for node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>for</b> node provides a fixed iteration looping mechanism, similar to the Java for loop</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>index</b></td> -<td align="left">index variable</td></tr> -<tr class="b"> -<td align="center"><b>start</b></td> -<td align="left">initial value</td></tr> -<tr class="a"> -<td align="center"><b>end</b></td> -<td align="left">maximum value</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>Not applicable.</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<p>Not applicable. The <b>status</b> node has no outcomes.</p></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><for index="i" start="0" end="$network.num-segments"> - <set> - <parameter name="$vlanlist" value="eval($vlanlist+','+$network.segment[i].provider-segmentation-id)"/> - </set> -</for></pre></div></div></div> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('for',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"for"}, - xml: {value:"<for index='' start='' end='' >\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/forNode.js b/dgbuilder/nodes/dge/dgelogic/forNode.js deleted file mode 100644 index 567da858..00000000 --- a/dgbuilder/nodes/dge/dgelogic/forNode.js +++ /dev/null @@ -1,31 +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 forNode(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("for",forNode); - // RED.library.register("for"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/get-resource.html b/dgbuilder/nodes/dge/dgelogic/get-resource.html deleted file mode 100644 index b0b59d07..00000000 --- a/dgbuilder/nodes/dge/dgelogic/get-resource.html +++ /dev/null @@ -1,192 +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="get-resource"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="get-resource"> - <p>A get-resource node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Get-resource_node"></a>Get-resource node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>get-resource</b> node is used to retrieve information about a particular resource and make it available to other nodes in the service logic tree. For example, this might be used to retrieve information about a particular uni-port.</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class of resource adaptor to be used</td></tr> -<tr class="b"> -<td align="center"><b>resource</b></td> -<td align="left">Type of resource to retrieve</td></tr> -<tr class="a"> -<td align="center"><b>key</b></td> -<td align="left">SQL-like string specifying criteria for retrieval</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>None</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>success</b></td> -<td align="left">Resource successfully released</td></tr> -<tr class="b"> -<td align="center"><b>not-found</b></td> -<td align="left">Resource referenced does not exist</td></tr> -<tr class="a"> -<td align="center"><b>failure</b></td> -<td align="left">Resource release failed for some other reason</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><get-resource plugin="org.onap.ccsdk.sli.core.sli.resource.samplesvc.SampleServiceResource" - resource="ase-port" - key="uni_circuit_id == $uni-circuit-id"> - <outcome value="success"> - <return status="success"/> - </outcome> - <outcome value="not-found"> - <return status="failure"/> - </outcome> - <outcome value="failure"> - <return status="failure"/> - </outcome> -</get-resource></pre></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('get-resource',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"get-resource"}, - xml: {value:"<get-resource plugin='' resource='' key='' >\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/get-resource.js b/dgbuilder/nodes/dge/dgelogic/get-resource.js deleted file mode 100644 index 597e0219..00000000 --- a/dgbuilder/nodes/dge/dgelogic/get-resource.js +++ /dev/null @@ -1,31 +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 getResource(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("get-resource",getResource); - // RED.library.register("get-resource"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/is-available.html b/dgbuilder/nodes/dge/dgelogic/is-available.html deleted file mode 100644 index 60d2b0ee..00000000 --- a/dgbuilder/nodes/dge/dgelogic/is-available.html +++ /dev/null @@ -1,186 +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="is-available"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="is-available"> - <p>A is-available node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Is-available_node"></a>Is-available node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>An <b>is-available</b> node is used to determine whether a particular type of resource is available. For example, this might be used to test whether any ports are available for assignment on a particular switch.</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class of resource adaptor to be used</td></tr> -<tr class="b"> -<td align="center"><b>resource</b></td> -<td align="left">Type of resource to check</td></tr> -<tr class="a"> -<td align="center"><b>key</b></td> -<td align="left">SQL-like string specifying key to check for</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>None</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>true</b></td> -<td align="left">Resource requested is available</td></tr> -<tr class="b"> -<td align="center"><b>false</b></td> -<td align="left">Resource requested is not available</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><is-available plugin="org.onap.ccsdk.sli.core.sli.resource.samplesvc.SampleServiceResource" - resource="ase-port" - key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value"> - <outcome value="true"> - <return status="success"/> - </outcome> - <outcome value="false"> - <return status="failure"/> - </outcome> -</is-available></pre></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('is-available',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"is-available"}, - xml: {value:"<is-available plugin='' resource='' key=''>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/is-available.js b/dgbuilder/nodes/dge/dgelogic/is-available.js deleted file mode 100644 index 93f23f48..00000000 --- a/dgbuilder/nodes/dge/dgelogic/is-available.js +++ /dev/null @@ -1,31 +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 isAvailable(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("is-available",isAvailable); - // RED.library.register("is-available"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/notify.html b/dgbuilder/nodes/dge/dgelogic/notify.html deleted file mode 100644 index d006e252..00000000 --- a/dgbuilder/nodes/dge/dgelogic/notify.html +++ /dev/null @@ -1,195 +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="notify"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="notify"> - <p>A notify node.</p> - <p>Do not include closing tag - it will be automatically generated.</p> -<!-- -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>An <b>notify</b> node is used to execute Java code supplied as a plugin</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class of plugin to be used</td></tr> -<tr class="b"> -<td align="center"><b>method</b></td> -<td align="left">Name of method in the plugin class to execute. Method must return void, and take 2 arguments: a Map (for parameters) and a SvcLogicContext (to allow plugin read/write access to context memory)</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>Specific to plugin / method</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>success</b></td> -<td align="left">Device successfully configured</td></tr> -<tr class="b"> -<td align="center"><b>not-found</b></td> -<td align="left">Plugin class could not be loaded</td></tr> -<tr class="a"> -<td align="center"><b>unsupported-method</b></td> -<td align="left">Named method taking (Map, SvcLogicContext) could not be found</td></tr> -<tr class="b"> -<td align="center"><b>failure</b></td> -<td align="left">Configure failed for some other reason</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><notify plugin="org.onap.ccsdk.sli.core.sli.resource.samplesvc.SampleServiceResource" - resource="network-connection" action="DELETE" > - <parameter name="message" value="Hello, world!" /> - <outcome value="success"> - <return status="success"/> - </outcome> - <outcome value="not-found"> - <return status="failure"> - <parameter name="error-code" value="1590" /> - <parameter name="error-message" value="Could not locate plugin" /> - </return> - </outcome> - <outcome value="Other"> - <return status="failure"> - <parameter name="error-code" value="1542" /> - <parameter name="error-message" value="Internal error" /> - </return> - </outcome> -</notify></pre></div></div></div></div> ---> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('notify',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"notify"}, - xml: {value:"<notify plugin='' resource='' action='' >\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - //console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - //console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/notify.js b/dgbuilder/nodes/dge/dgelogic/notify.js deleted file mode 100644 index 8b58e9e4..00000000 --- a/dgbuilder/nodes/dge/dgelogic/notify.js +++ /dev/null @@ -1,31 +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 notify(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("notify",notify); - // RED.library.register("configure"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/record.html b/dgbuilder/nodes/dge/dgelogic/record.html deleted file mode 100644 index 3eb7a2e6..00000000 --- a/dgbuilder/nodes/dge/dgelogic/record.html +++ /dev/null @@ -1,185 +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="record"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="record"> - <p>A record node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h3><a name="Recording"></a>Recording</h3> -<div class="section"> -<h4><a name="Record_node"></a>Record node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>record</b> node is used to record an event. For example, this might be used to log provisioning events.</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class to handle recording.</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>Parameters will depend on the plugin being used. For the FileRecorder class, the parameters are as follows</p> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>file</b></td> -<td align="left">The file to which the record should be written</td></tr> -<tr class="b"> -<td align="center"><b>field1</b></td> -<td align="left">First field to write. There will be <b>field</b> parameters for each field to write, from <b>field1</b> through <b>fieldN</b>. A special value __TIMESTAMP__ may be assigned to a field to insert the current timestamp</td></tr></table></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>success</b></td> -<td align="left">Record successfully written</td></tr> -<tr class="b"> -<td align="center"><b>failure</b></td> -<td align="left">Record could not be successfully written</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder"> - <parameter name="file" value="/tmp/sample_r1.log" /> - <parameter name="field1" value="__TIMESTAMP__"/> - <parameter name="field2" value="ACTIVE"/> - <parameter name="field3" value="$uni-circuit-id"/> -</record></pre></div></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('record',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"record"}, - xml: {value:"<record>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/record.js b/dgbuilder/nodes/dge/dgelogic/record.js deleted file mode 100644 index f29bf8f5..00000000 --- a/dgbuilder/nodes/dge/dgelogic/record.js +++ /dev/null @@ -1,31 +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 record(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("record",record); - // RED.library.register("record"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/release.html b/dgbuilder/nodes/dge/dgelogic/release.html deleted file mode 100644 index d39d4109..00000000 --- a/dgbuilder/nodes/dge/dgelogic/release.html +++ /dev/null @@ -1,192 +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="release"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="release"> - <p>A release node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Release_node"></a>Release node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>release</b> node is used to mark a resource as no longer in use, and thus available for assignment.</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class of resource adaptor to be used</td></tr> -<tr class="b"> -<td align="center"><b>resource</b></td> -<td align="left">Type of resource to release</td></tr> -<tr class="a"> -<td align="center"><b>key</b></td> -<td align="left">SQL-like string specifying key to check of resource to release</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>None</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>success</b></td> -<td align="left">Resource successfully released</td></tr> -<tr class="b"> -<td align="center"><b>not-found</b></td> -<td align="left">Resource referenced does not exist</td></tr> -<tr class="a"> -<td align="center"><b>failure</b></td> -<td align="left">Resource release failed for some other reason</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><release plugin="org.onap.ccsdk.sli.core.sli.resource.samplesvc.SampleServiceResource" - resource="ase-port" - key="uni_circuit_id == $uni-circuit-id"> - <outcome value="success"> - <return status="success"/> - </outcome> - <outcome value="not-found"> - <return status="failure"/> - </outcome> - <outcome value="failure"> - <return status="failure"/> - </outcome> -</release></pre></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('release',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"release"}, - xml: {value:"<release plugin='' resource='' key='' >\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/release.js b/dgbuilder/nodes/dge/dgelogic/release.js deleted file mode 100644 index ff03fff6..00000000 --- a/dgbuilder/nodes/dge/dgelogic/release.js +++ /dev/null @@ -1,31 +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 release(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("release",release); - // RED.library.register("release"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/reserve.html b/dgbuilder/nodes/dge/dgelogic/reserve.html deleted file mode 100644 index 40945559..00000000 --- a/dgbuilder/nodes/dge/dgelogic/reserve.html +++ /dev/null @@ -1,189 +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="reserve"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="reserve"> - <p>A reserve node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Reserve_node"></a>Reserve node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>reserve</b> node is used to reserve a particular type of resource.. For example, this might be used to reserve a port on a particular switch.</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class of resource adaptor to be used</td></tr> -<tr class="b"> -<td align="center"><b>resource</b></td> -<td align="left">Type of resource to reserve</td></tr> -<tr class="a"> -<td align="center"><b>key</b></td> -<td align="left">SQL-like string specifying criteria for reservation</td></tr> -<tr class="b"> -<td align="center"><b>select</b></td> -<td align="left">String to specify, if <b>key</b> matches multiple entries, which entry should take precedence</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>None</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>success</b></td> -<td align="left">Resource requested was successfully reserved</td></tr> -<tr class="b"> -<td align="center"><b>failure</b></td> -<td align="left">Resource requested was not successfully reserved</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><reserve plugin="org.onap.ccsdk.sli.core.sli.resource.samplesvc.SampleServiceResource" - resource="ase-port" - key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value" - select="min(speed)"> - <outcome value="success"> - <return status="success"/> - </outcome> - <outcome value="failure"> - <return status="failure"/> - </outcome> -</reserve></pre></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('reserve',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"reserve"}, - xml: {value:"<reserve plugin='' resource='' key='' select=''>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/reserve.js b/dgbuilder/nodes/dge/dgelogic/reserve.js deleted file mode 100644 index 6aab1bd7..00000000 --- a/dgbuilder/nodes/dge/dgelogic/reserve.js +++ /dev/null @@ -1,31 +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 reserve(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("reserve",reserve); - // RED.library.register("reserve"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/save.html b/dgbuilder/nodes/dge/dgelogic/save.html deleted file mode 100644 index 6e022154..00000000 --- a/dgbuilder/nodes/dge/dgelogic/save.html +++ /dev/null @@ -1,189 +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="save"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="save"> - <p>A save node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Save_node"></a>Save node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>save</b> node is used to save information about a particular resource to persistent storage. For example, this might be used to save information about a particular uni-port.</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class of resource adaptor to be used</td></tr> -<tr class="b"> -<td align="center"><b>resource</b></td> -<td align="left">Type of resource to save</td></tr> -<tr class="a"> -<td align="center"><b>key</b></td> -<td align="left">SQL-like string specifying criteria for retrieval</td></tr> -<tr class="b"> -<td align="center"><b>force</b></td> -<td align="left">If "true", save resource even if this resource is already stored in persistent storage</td></tr> -<tr class="a"> -<td align="center"><b>pfx</b></td> -<td align="left">Prefix to be prepended to variable names, when attributes are set in SvcLogicContext</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>Values to save (columns) are specified as parameters, with each name corresponding to a column name and each value corresponding to the value to set.</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>success</b></td> -<td align="left">Resource successfully saved</td></tr> -<tr class="b"> -<td align="center"><b>failure</b></td> -<td align="left">Resource save failed</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><save plugin="`$resource-plugin`" resource="resourceName" - key="keyName=value" - pfx="requests.resourceName"> - <parameter name="parameter1" - value="`$parameterOneValue`" /> - <parameter name="parameter2" value="`$parameterparameterTwoValue`" /> -</save></pre></div></div></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('save',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"save"}, - xml: {value:"<save plugin='' resource='' key='' force='' pfx=''>\n<parameter name='' value='' />\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/save.js b/dgbuilder/nodes/dge/dgelogic/save.js deleted file mode 100644 index 5771ae98..00000000 --- a/dgbuilder/nodes/dge/dgelogic/save.js +++ /dev/null @@ -1,31 +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 save(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("save",save); - // RED.library.register("save"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/set.html b/dgbuilder/nodes/dge/dgelogic/set.html deleted file mode 100644 index bcbcae30..00000000 --- a/dgbuilder/nodes/dge/dgelogic/set.html +++ /dev/null @@ -1,162 +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="set"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="set"> - <p>A set node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Set_node"></a>Set node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>set</b> node is used to set one or more values in the execution context</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<p>Not applicable. The <b>set</b> node does not have attributes.</p></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>Values to be set are passed as parameters</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<p>Not applicable. The <b>set</b> node has no outcomes.</p></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><set> - <parameter name="vlan" value="$network.provider-segmentation-id" /> -</set></pre></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('set',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"set"}, - xml: {value:"<set>\n<parameter name='' value='' />\n"}, - comments:{value:""} - }, - inputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/set.js b/dgbuilder/nodes/dge/dgelogic/set.js deleted file mode 100644 index 9b939507..00000000 --- a/dgbuilder/nodes/dge/dgelogic/set.js +++ /dev/null @@ -1,31 +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 set(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("set",set); - // RED.library.register("set"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/switchNode.html b/dgbuilder/nodes/dge/dgelogic/switchNode.html deleted file mode 100644 index 5cbcfea7..00000000 --- a/dgbuilder/nodes/dge/dgelogic/switchNode.html +++ /dev/null @@ -1,232 +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="switchNode"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="switchNode"> - <p>A switch node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Switch_node"></a>Switch node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>switch</b> node is used to make a decision based on its <b>test</b> attribute.</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>test</b></td> -<td align="left">Condition to test</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>None</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<p>Depends on the <b>test</b> condition</p></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><switch test="$uni-cir-units"> - <outcome value="Mbps"> - <reserve plugin="org.onap.ccsdk.sli.core.sli.resource.samplesvc.SampleServiceResource" - resource="ase-port" - key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value" - pfx="asePort"> - - <outcome value="success"> - <return status="success"> - <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" /> - </return> - </outcome> - <outcome value="Other"> - <return status="failure"> - <parameter name="error-code" value="1010" /> - <parameter name="error-message" value="No ports found that match criteria" /> - </return> - </outcome> - </reserve> - </outcome> - <outcome value="Gbps"> - <reserve plugin="org.onap.ccsdk.sli.core.sli.resource.samplesvc.SampleServiceResource" - resource="ase-port" - key="resource-emt-clli == $edge-device-clli and speed >= $uni-cir-value*1000" - pfx="asePort"> - - <outcome value="success"> - <return status="success"> - <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" /> - </return> - </outcome> - <outcome value="Other"> - <return status="failure"> - <parameter name="error-code" value="1010" /> - <parameter name="error-message" value="No ports found that match criteria" /> - </return> - </outcome> - </reserve> - </outcome> -</switch></pre></div></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('switchNode',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"switch"}, - xml: {value:"<switch test=''>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - //To increase the width of dialogbox - //$(".ui-dialog.ui-widget.ui-widget-content.ui-corner-all.ui-front.ui-dialog-buttons.ui-draggable.ui-resizable").css("width","1400px"); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); - -function encodeTestStr(xmlStr){ - var updatedXmlStr=xmlStr; - if(updatedXmlStr != null){ - var testCondition = getAttributeValue(xmlStr,"test"); - if(testCondition != null && testCondition != ''){ - if(testCondition.indexOf("<") == -1){ - testCondition=testCondition.replace(/</g,"<"); - } - updatedXmlStr="<switch test=\"" + testCondition + "\" >"; - } - } - return updatedXmlStr; -} - -function decodeTestStr(xmlStr){ - var updatedXmlStr=xmlStr; - if(updatedXmlStr != null){ - var testCondition = getAttributeValue(xmlStr,"test"); - if(testCondition != null && testCondition != ''){ - testCondition=testCondition.replace(/</g,"<"); - updatedXmlStr="<switch test=\"" + testCondition + "\" >"; - } - } - return updatedXmlStr; -} -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/switchNode.js b/dgbuilder/nodes/dge/dgelogic/switchNode.js deleted file mode 100644 index 6a7a545d..00000000 --- a/dgbuilder/nodes/dge/dgelogic/switchNode.js +++ /dev/null @@ -1,31 +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 switchNode(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("switchNode",switchNode); - // RED.library.register("switch"); -} diff --git a/dgbuilder/nodes/dge/dgelogic/update.html b/dgbuilder/nodes/dge/dgelogic/update.html deleted file mode 100644 index 0b3b9bbd..00000000 --- a/dgbuilder/nodes/dge/dgelogic/update.html +++ /dev/null @@ -1,195 +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="update"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="update"> - <p>A update node.</p> - <p>Do not include closing tag - it will be automatically generated.</p> -<!-- -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>An <b>update</b> node is used to execute Java code supplied as a plugin</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>plugin</b></td> -<td align="left">Fully qualified Java class of plugin to be used</td></tr> -<tr class="b"> -<td align="center"><b>method</b></td> -<td align="left">Name of method in the plugin class to execute. Method must return void, and take 2 arguments: a Map (for parameters) and a SvcLogicContext (to allow plugin read/write access to context memory)</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>Specific to plugin / method</p></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>success</b></td> -<td align="left">Device successfully configured</td></tr> -<tr class="b"> -<td align="center"><b>not-found</b></td> -<td align="left">Plugin class could not be loaded</td></tr> -<tr class="a"> -<td align="center"><b>unsupported-method</b></td> -<td align="left">Named method taking (Map, SvcLogicContext) could not be found</td></tr> -<tr class="b"> -<td align="center"><b>failure</b></td> -<td align="left">Configure failed for some other reason</td></tr></table></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><update plugin="org.onap.ccsdk.sli.core.sli.resource.samplesvc.SampleServiceResource" - resource="network-connection" action="DELETE" > - <parameter name="message" value="Hello, world!" /> - <outcome value="success"> - <return status="success"/> - </outcome> - <outcome value="not-found"> - <return status="failure"> - <parameter name="error-code" value="1590" /> - <parameter name="error-message" value="Could not locate plugin" /> - </return> - </outcome> - <outcome value="Other"> - <return status="failure"> - <parameter name="error-code" value="1542" /> - <parameter name="error-message" value="Internal error" /> - </return> - </outcome> -</update></pre></div></div></div></div> ---> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('update',{ - color:"#fdd0a2", - category: 'DGElogic', - defaults: { - name: {value:"update"}, - xml: {value:"<update resource='' force='' plugin='' key='' pfx='' local-only=''>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - //console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - //console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgelogic/update.js b/dgbuilder/nodes/dge/dgelogic/update.js deleted file mode 100644 index f614af8b..00000000 --- a/dgbuilder/nodes/dge/dgelogic/update.js +++ /dev/null @@ -1,31 +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 update(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("update",update); - // RED.library.register("configure"); -} diff --git a/dgbuilder/nodes/dge/dgemain/GenericXML.html b/dgbuilder/nodes/dge/dgemain/GenericXML.html deleted file mode 100644 index 4c9c01a6..00000000 --- a/dgbuilder/nodes/dge/dgemain/GenericXML.html +++ /dev/null @@ -1,140 +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="GenericXML"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 250px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show SLI Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="GenericXML"> - <p>A generic DGEmain node.</p> - <p>Name can be anything.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('GenericXML',{ - color:"#fdd0a2", - category: 'DGEmain', - defaults: { - name: {value:"dge-node"}, - xml: {value:""}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-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}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - //console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgemain/GenericXML.js b/dgbuilder/nodes/dge/dgemain/GenericXML.js deleted file mode 100644 index e5fc0624..00000000 --- a/dgbuilder/nodes/dge/dgemain/GenericXML.js +++ /dev/null @@ -1,31 +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 GenericXML(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("GenericXML",GenericXML); - // RED.library.register("GenericXML"); -} diff --git a/dgbuilder/nodes/dge/dgemain/comment.html b/dgbuilder/nodes/dge/dgemain/comment.html deleted file mode 100644 index c34d14c9..00000000 --- a/dgbuilder/nodes/dge/dgemain/comment.html +++ /dev/null @@ -1,97 +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> - <input type="hidden" id="node-input-comments"> - </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: 'DGEmain', - color:"#ffffff", - defaults: { - name: {value:""}, - info: {value:""}, - comments:{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 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - 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/nodes/dge/dgemain/comment.js b/dgbuilder/nodes/dge/dgemain/comment.js deleted file mode 100644 index ef5f0800..00000000 --- a/dgbuilder/nodes/dge/dgemain/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/nodes/dge/dgemain/dgstart.html b/dgbuilder/nodes/dge/dgemain/dgstart.html deleted file mode 100644 index 9caa841a..00000000 --- a/dgbuilder/nodes/dge/dgemain/dgstart.html +++ /dev/null @@ -1,1322 +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. ---> -<div id="svclogicPageDiv" ></div> -<!-- dgbuilder javascript files START --> -<script src="util/js/validateNodeXml.js"/> -<script src="util/js/sliValues.js"/> -<script src="util/js/dgeToXml.js"/> -<script src="util/js/vkbeautify.0.99.00.beta.js"/> -<!-- dgbuilder javascript files END --> - -<script type="text/x-red" data-template-name="dgstart"> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> -<style> -.no-close .ui-dialog-titlebar-close {display: none } -.alertDialogButton { - border-top: 1px solid #96d1f8; - background: #65a9d7; - background: -webkit-gradient(linear, left top, left bottom, from(#3e779d), to(#65a9d7)); - background: -webkit-linear-gradient(top, #3e779d, #65a9d7); - background: -moz-linear-gradient(top, #3e779d, #65a9d7); - background: -ms-linear-gradient(top, #3e779d, #65a9d7); - background: -o-linear-gradient(top, #3e779d, #65a9d7); - padding: 5px 10px; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - border-radius: 8px; - -webkit-box-shadow: rgba(0,0,0,1) 0 1px 0; - -moz-box-shadow: rgba(0,0,0,1) 0 1px 0; - box-shadow: rgba(0,0,0,1) 0 1px 0; - text-shadow: rgba(0,0,0,.4) 0 1px 0; - color: white; - font-size: 14px; - font-family: Georgia, serif; - text-decoration: none; - vertical-align: middle; - } -.alertDialogButton:hover { - border-top-color: #28597a; - background: #28597a; - color: #ccc; - } - -.alertDialogButton:active { - border-top-color: #1b435e; - background: #1b435e; - } -.disabled-button { - border-top: 1px solid #96d1f8; - background: lightgrey; - background: -webkit-gradient(linear, left top, left bottom, from(grey), to(lightgrey)); - background: -webkit-linear-gradient(top, grey, grey); - background: -moz-linear-gradient(top, grey, grey); - background: -ms-linear-gradient(top, grey, grey); - background: -o-linear-gradient(top, grey, grey); - padding: 5px 10px; - -webkit-border-radius: 8px; - -moz-border-radius: 8px; - border-radius: 8px; - -webkit-box-shadow: rgba(0,0,0,1) 0 1px 0; - -moz-box-shadow: rgba(0,0,0,1) 0 1px 0; - box-shadow: rgba(0,0,0,1) 0 1px 0; - text-shadow: rgba(0,0,0,.4) 0 1px 0; - color: lightgrey; - font-size: 14px; - font-family: Georgia, serif; - text-decoration: none; - vertical-align: middle; - } -</style> -<script type="text/javascript"> - -function activateDG(module,rpc,version,mode,displayOnlyCurrent){ - var paramsObj = {'module': module , 'rpc' : rpc , 'version' : version , 'mode' : mode,'displayOnlyCurrent' : false}; - if(displayOnlyCurrent){ - paramsObj = {'module': module , 'rpc' : rpc , 'version' : version , 'mode' : mode,'displayOnlyCurrent' : true}; - } - var dgInfo = "<div><table width='100%' border='1'><tr style='background-color:#65a9d7;color:white;' ><th>Module</th><th>RPC</th><th>Version</th></tr><tr style='background-color:white'><td>" + module +"</td><td>" + rpc + "</td><td>" +version + "</td></tr></table></div><br>"; - var alertMsg = dgInfo + "<p>Are you sure you want to Activate this DG ?</p>"; -$( "#alertdialog" ).dialog({ - dialogClass: "no-close", - autoOpen :false, - modal:true, - draggable : true, - /*dialogClass: "alert",*/ - title: "Confirm Activate", - width: 600, - buttons: [ - { - text: "Activate", - class:"alertDialogButton", - click: function() { - $.get("/activateDG" , paramsObj) - .done(function( data ) { - //RED.notify("<strong>Activated Successfully</strong>"); - var htmlStr = ""; - var title =""; - if(displayOnlyCurrent){ - htmlStr=getHtmlStr(data,true); - title="Service Logic Administration Module=" + module + " and RPC=" + rpc; - }else{ - htmlStr=getHtmlStr(data); - title= "Service Logic Administration - " + data.dbHost; - } - $("#svclogicPageDiv").dialog({ - modal:true, - title: title, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .fail(function( err ) { - RED.notify("<strong>Could not Activate</strong>"); - var htmlStr = "<p>" + "could not activate" + module + " " + rpc + " " + version +"</p> <a onclick='javascript:showSLA()'></a>"; - if(displayOnlyCurrent == true){ - htmlStr = "<p>" + "could not activate" + module + " " + rpc + " " + version +"</p> <a onclick='javascript:showCurrentDGs(\"" + module + "\",\"" + rpc + "\")'>Back to DG List</a>"; - } - $("#svclogicPageDiv").dialog({ - modal:true, - title: "Service Logic Administration - " + err.dbHost, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .always(function() { - // $('.ui-dialog:has(#alertdialog)').empty().remove(); - $("#alertdialog" ).dialog('close'); - - }); - } - }, - { - text: "Cancel", - class:"alertDialogButton", - click: function() { - //$('.ui-dialog:has(#alertdialog)').empty().remove(); - $( this ).dialog( "close" ); - } - } - ] -}).html(alertMsg).dialog('open'); -//var dialogClass = $("#alertdialog").dialog( "option", "dialogClass" ); -//$( "#alertdialog" ).dialog( "option", "dialogClass", "alert" ); -//$("#alertdialog").dialog("widget").find(".ui-dialog-buttonpane").css("background-color", "#ECECFF"); -/* -$('#alertdialog').css("background-color", "#ECECEC"); -$("#alertdialog").dialog("widget").find(".ui-dialog-buttonpane").css("background-color", "#ECECEC"); - -// button pane style -$("#alertdialog").dialog("widget").find(".ui-dialog-buttonpane").css({"padding":".1em .1em .1em 0","margin":"0 0 0 0"} ) - -// button style -$("#alertdialog").dialog("widget").find("button").css({"padding":"0 .2em 0 .2em","margin":"0 .5em 0 0"} ) -$("#alertdialog").dialog("widget").find("button").addClass("alertDialogButton"); -*/ -//console.dir($("#alertdialog")); -} - - -function deActivateDG(module,rpc,version,mode,displayOnlyCurrent){ - var paramsObj = {'module': module , 'rpc' : rpc , 'version' : version , 'mode' : mode,'displayOnlyCurrent' : false}; - if(displayOnlyCurrent){ - paramsObj = {'module': module , 'rpc' : rpc , 'version' : version , 'mode' : mode,'displayOnlyCurrent' : true}; - } - var dgInfo = "<div ><table width='100%' border='1'><tr style='background-color:#65a9d7;color:white;'><th>Module</th><th>RPC</th><th>Version</th></tr><tr style='background-color:white'><td>" + module +"</td><td>" + rpc + "</td><td>" +version + "</td></tr></table></div><br>"; - var alertMsg = dgInfo + "<p>Are you sure you want to De-Activate this DG ?</p>"; -$( "#alertdialog" ).dialog({ - dialogClass: "no-close", - autoOpen : false, - modal:true, - draggable : true, - title: "Confirm De-Activate", - width: 600, - buttons: [ - { - text: "De-Activate", - class:"alertDialogButton", - click: function() { - $.get("/deActivateDG" , paramsObj) - .done(function( data ) { - //RED.notify("<strong>deActivated Successfully</strong>"); - var htmlStr = ""; - var title =""; - if(displayOnlyCurrent){ - htmlStr=getHtmlStr(data,true); - title="Service Logic Administration Module=" + module + " and RPC=" + rpc; - }else{ - htmlStr=getHtmlStr(data); - title= "Service Logic Administration - " + data.dbHost; - } - $("#svclogicPageDiv").dialog({ - modal:true, - title: title, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .fail(function( err ) { - RED.notify("<strong>Could not De-Activate</strong>"); - var htmlStr = "<p>" + "could not deactivate" + module + " " + rpc + " " + version +"</p> <a onclick='javascript:showSLA()'></a>"; - if(displayOnlyCurrent == true){ - htmlStr = "<p>" + "could not deactivate" + module + " " + rpc + " " + version +"</p> <a onclick='javascript:showCurrentDGs(\"" + module + "\",\"" + rpc + "\")'>Back to DG List</a>"; - } - $("#svclogicPageDiv").dialog({ - modal:true, - title: "Service Logic Administration - " + err.dbHost, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .always(function() { - //$('.ui-dialog:has(#alertdialog)').empty().remove(); - $( "#alertdialog" ).dialog( "close" ); - //$("#alertdialog" ).dialog('destroy').remove(); - }); - } - }, - { - text: "Cancel", - class:"alertDialogButton", - click: function() { - //$('.ui-dialog:has(#alertdialog)').empty().remove(); - //$(this).dialog('destroy').remove() - //$( this ).dialog( "close" ); - /*if ($("#alertdialog").hasClass('ui-dialog-content')) { - $("#alertdialog" ).dialog('close'); - }else{ - $( this ).dialog( "close" ); - } - */ - $( this ).dialog( "close" ); - } - } - ] -}).html(alertMsg).dialog("open"); -} - -function deleteDG(module,rpc,version,mode,displayOnlyCurrent){ - var paramsObj = {'module': module , 'rpc' : rpc , 'version' : version , 'mode' : mode,'displayOnlyCurrent' : false}; - if(displayOnlyCurrent){ - paramsObj = {'module': module , 'rpc' : rpc , 'version' : version , 'mode' : mode,'displayOnlyCurrent' : true}; - } - var dgInfo = "<div ><table width='100%' border='1'><tr style='background-color:#65a9d7;color:white;'><th>Module</th><th>RPC</th><th>Version</th></tr><tr style='background-color:white'><td>" + module +"</td><td>" + rpc + "</td><td>" +version + "</td></tr></table></div><br>"; - var alertMsg = dgInfo + "<p>Are you sure you want to Delete this DG ?</p>"; -$( "#alertdialog" ).dialog({ - dialogClass: "no-close", - autoOpen: false, - modal:true, - draggable : true, - title: "Confirm Delete", - width: 600, - buttons: [ - { - text: "Delete", - class:"alertDialogButton", - click: function() { - $.get("/deleteDG" , paramsObj) - .done(function( data ) { - RED.notify("<strong>Deleted " + module + " " + rpc + " " + version + " Successfully</strong>"); - var htmlStr = ""; - var title =""; - if(displayOnlyCurrent){ - htmlStr=getHtmlStr(data,true); - title="Service Logic Administration Module=" + module + " and RPC=" + rpc; - }else{ - htmlStr=getHtmlStr(data); - title= "Service Logic Administration - " + data.dbHost; - } - $("#svclogicPageDiv").dialog({ - modal:true, - title: title, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .fail(function( err ) { - //RED.notify("<strong>Could not Delete" + module + " " + rpc + " " + version + "</strong>"); - var htmlStr = "<p>" + "could not delete" + module + " " + rpc + " " + version +"</p> <a onclick='javascript:showSLA()'></a>"; - if(displayOnlyCurrent == true){ - htmlStr = "<p>" + "could not delete" + module + " " + rpc + " " + version +"</p> <a onclick='javascript:showCurrentDGs(\"" + module + "\",\"" + rpc + "\")'>Back to DG List</a>"; - } - $("#svclogicPageDiv").dialog({ - modal:true, - title: "Service Logic Administration - " + err.dbHost, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .always(function() { - $( "#alertdialog" ).dialog( "close" ); - //$('.ui-dialog:has(#alertdialog)').empty().remove(); - //$("#alertdialog" ).dialog('destroy').remove(); - }); - } - }, - { - text: "Cancel", - class:"alertDialogButton", - click: function() { - /* - if ($("#alertdialog").hasClass('ui-dialog-content')) { - $("#alertdialog" ).dialog('close'); - }else{ - $( this ).dialog( "close" ); - } - */ - //$( "#alertdialog" ).dialog( "close" ); - //$('.ui-dialog:has(#alertdialog)').empty().remove(); - //$( this ).dialog( "close" ); - $( this ).dialog( "close" ); - } - } - ] -}).html(alertMsg).dialog("open"); -} -/* -function downloadDGXml(_module,rpc,version,mode){ - var paramsObj = {'_module': _module , 'rpc' : rpc , 'version' : version , 'mode' : mode}; - var form = $('<form id="dwnldDbXmlFormId" method="POST" action="/downloadDGXml"></form>'); - form.append('<input type="hidden" name="_module" value="' + _module + '"/>'); - form.append('<input type="hidden" name="rpc" value="' + rpc + '"/>'); - form.append('<input type="hidden" name="version" value="' + version + '"/>'); - form.append('<input type="hidden" name="mode" value="' + mode + '"/>'); - form.appendTo('body'); - $("#dwnldDbXmlFormId").submit(); -} -*/ - -function displayXml(module,rpc,version,mode,displayOnlyCurrent){ - var paramsObj = {'_module': module , 'rpc' : rpc , 'version' : version , 'mode' : mode,'displayOnlyCurrent' : false}; - var title="Service Logic Administration"; - if(displayOnlyCurrent){ - paramsObj = {'_module': module , 'rpc' : rpc , 'version' : version , 'mode' : mode,'displayOnlyCurrent' : true}; - title="Service Logic Administration Module=" + module + " and RPC=" + rpc; - }else{ - title="Service Logic Administration"; - } - //var headingStr = "<a style='color: #337ab7;' onclick='javascript:showSLA()'><<Back to DG List</a><br><div style='background-color:#337ab7;clear:both;'><table style='width:100%;' border='0'>" + - var headingStr = "<a style='color: #337ab7;cursor:pointer;' onclick='javascript:showSLA()'><<Back to DG List</a><br><div style='clear:both;'><table style='width:25%' border='0'>" ; - if(displayOnlyCurrent == true){ - headingStr = "<a style='color: #337ab7;cursor:pointer;' onclick='javascript:showCurrentDGs(\"" + module + "\",\"" + rpc + "\")'><<Back to DG List</a><br><div style='clear:both;'><table style='width:25%' border='0'>" ; - } - headingStr += "<tr><td><b>Module</b></td><td>" + module + "</td></tr>" + - "<tr><td><b>RPC</b></td><td>" + rpc + "</td></tr>" + - "<tr><td><b>Version</b></td><td>" + version + "</td></tr>" + - "<tr><td><b>Mode</b></td><td>" + mode + "</td></tr>" + - "</table></div>"; - - //var urlStr = "/displayXml?_module=" + module + "&rpc=" + rpc + "&version=" + version + "&mode=" + mode; - $.get("/displayXml",paramsObj) - .done(function( data ) { - //var htmlStr= headingStr + '<div style="clear:both;"></div><div style="background-color:lightgrey;border-style: solid;border-color:#337ab7;clear:both;">' + data.xmldata + "</div>"; - var htmlStr= headingStr + '<hr style="clear:both;height:5px;background-color:#337ab7;"><div>' + data.xmldata + "</div>"; - $("#svclogicPageDiv").dialog({ - modal:true, - title: title, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .fail(function( err ) { - //RED.notify("<strong>Could not display XML</strong>"); - var htmlStr = "<p>" + "Could not display xml for" + module + " " + rpc + " " + version + "</p><a style='color: #337ab7;cursor:pointer;' onclick='javascript:showSLA()'>Back to DG List</a><br>"; - if(displayOnlyCurrent == true){ - htmlStr = "<p>" + "could not display XML" + module + " " + rpc + " " + version +"</p> <a onclick='javascript:showCurrentDGs(\"" + module + "\",\"" + rpc + "\")'>Back to DG List</a>"; - } - $("#svclogicPageDiv").dialog({ - modal:true, - title: "Service Logic Administration", - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .always(function() { - }); -} - -function displayDG(module,rpc,version,mode,displayOnlyCurrent){ - var paramsObj = {'_module': module , 'rpc' : rpc , 'version' : version , 'mode' : mode,'displayOnlyCurrent' : false}; - var title="Service Logic Administration"; - if(displayOnlyCurrent){ - paramsObj = {'_module': module , 'rpc' : rpc , 'version' : version , 'mode' : mode,'displayOnlyCurrent' : true}; - } - //var headingStr = "<a style='color: #337ab7;cursor:pointer' onclick='javascript:showSLA()'><<Back to DG List</a><br><div><table id='msgTable' style='width:25%;background-color:lightgrey' border='0'>" + - var headingStr = "<a style='color: #337ab7;cursor:pointer;' onclick='javascript:showSLA()'><<Back to DG List</a><br><div><table id='msgTable' style='width:25%;' border='0'>" ; - if(displayOnlyCurrent == true){ - headingStr = "<a style='color: #337ab7;cursor:pointer;' onclick='javascript:showCurrentDGs(\"" + module + "\",\"" + rpc + "\")'><<Back to DG List</a><br><div style='clear:both;'><table style='width:25%' border='0'>" ; - title="Service Logic Administration Module=" + module + " and RPC=" + rpc; - } - headingStr +="<tr><td><b>Module</b></td><td>" + module + "</td></tr>" + - "<tr><td><b>RPC</b></td><td>" + rpc + "</td></tr>" + - "<tr><td><b>Version</b></td><td>" + version + "</td></tr>" + - "<tr><td><b>Mode</b></td><td>" + mode + "</td></tr>" + - "</table></div>"; - - //var urlStr = "/displayAsGv?_module=" + module + "&rpc=" + rpc + "&version=" + version + "&mode=" + mode; - $.get("/displayAsGv",paramsObj) - .done(function( data ) { - var htmlStr= headingStr + '<div style="background-color:white;">' + data.svg_html + "</div>"; - $("#svclogicPageDiv").dialog({ - modal:true, - title: "Service Logic Administration", - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .fail(function( err ) { - //RED.notify("<strong>Could not display XML</strong>"); - var htmlStr = "<p>" + "Could not display DG for" + module + " " + rpc + " " + version + "</p><a style='color: #337ab7;cursor:pointer;' onclick='javascript:showSLA()'>Back to DG List</a><br>"; - if(displayOnlyCurrent == true){ - htmlStr = "<p>" + "could not display DG for" + module + " " + rpc + " " + version +"</p> <a onclick='javascript:showCurrentDGs(\"" + module + "\",\"" + rpc + "\")'>Back to DG List</a>"; - } - $("#svclogicPageDiv").dialog({ - modal:true, - title: "Service Logic Administration", - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .always(function() { - }); -} - -function getHtmlStr(data,displayOnlyCurrent,module,rpc){ - var styleStr = "<style> " + - "table#t01 { width:100%; } \n" + - "table#t01 th,table#t01 td { border: 1px solid black; border-collapse: collapse; } \n" + - /*"table, th, td { border: 1px solid #65a9d7; border-collapse: collapse; } \n" +*/ - "table#t01 th,table#t01 td { padding: 5px; text-align: left; } \n" + - "table#t01 tr:nth-child(even) { background-color: #eee; }\n" + - "table#t01 tr:nth-child(odd) { background-color:#fff; }\n" + - "table#t01 th { background-color: #65a9d7; color: white; }\n" + - "table#t01 a { color: #337ab7; }\n" + - "table#t01 a:link { color: #65a9d7; }\n" + - "table#t01 a:visited { color: #636; }\n" + - "table#t01 a:hover { color: #3366CC; cursor: pointer }\n" + - "table#t01 a:active { color: #65a9d7 }\n" + - "</style>"; - if(data != null && data.rows != undefined && data.error == undefined){ - var alertDialog = '<div id="alertdialog"></div>'; - htmlStr= alertDialog + "<div style='width:1050;height:650'>" + styleStr; - htmlStr += "<table id='t01' >"; - htmlStr += "<tr>"; - htmlStr += "<th>Module</th>" ; - htmlStr += "<th>RPC</th>" ; - htmlStr += "<th>Version</th>" ; - htmlStr += "<th>Mode</th>" ; - htmlStr += "<th>Active</th>" ; - htmlStr += "<th>Activate/Deactivate</th>"; - htmlStr += "<th>Display DG</th>"; - htmlStr += "<th>XML</th>"; - htmlStr += "<th>Delete</th>"; - htmlStr += "</tr>"; - var rows = data.rows; - if(rows != null && rows.length == 0){ - htmlStr += "<tr>"; - htmlStr += "<td><b>No rows found</b></td>"; - htmlStr += "</tr></table></div>"; - return htmlStr; - } - for(var i=0;i<rows.length;i++){ - var row = rows[i]; - var _module = row.module; - var rpc = row.rpc; - var version = row.version; - var mode = row.mode; - var active = row.active; - htmlStr += "<tr>"; - htmlStr += "<td>" + _module + "</td>"; - htmlStr += "<td>" + rpc + "</td>"; - htmlStr += "<td>" + version + "</td>"; - htmlStr += "<td>" + mode + "</td>"; - htmlStr += "<td>" + active + "</td>"; - - var methodParams = "'" + _module + "','" + rpc + "','" + version + "','" + mode + "'"; - if(displayOnlyCurrent){ - methodParams+= ",true"; - } - if(active == 'Y'){ - htmlStr += "<td><a onclick=\"javascript:deActivateDG(" + methodParams + ")\">DeActivate</a></td>"; - }else{ - htmlStr += "<td><a onclick=\"javascript:activateDG(" + methodParams + ")\">Activate</a></td>"; - } - htmlStr += "<td><a onclick=\"javascript:displayDG(" + methodParams + ")\">Display</a></td>"; - - htmlStr += "<td><a onclick=\"javascript:displayXml(" + methodParams + ")\">XML</a></td>"; - - htmlStr += "<td><a onclick=\"javascript:deleteDG(" + methodParams + ")\">Delete</a></td>"; - htmlStr += "</tr>"; - } - htmlStr += "</table>"; - htmlStr += "</div>"; - } - return htmlStr; -} - -function showSLA(){ - var htmlStr = ""; - try{ - $.get("/listSLA") - .done(function( data ) { - var htmlStr=getHtmlStr(data); - $("#svclogicPageDiv").dialog({ - modal:true, - title: "Service Logic Administration - " + data.dbHost, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .fail(function(err) { - htmlStr= "<div>Error occured displaying the DG list</div>"; - $("#svclogicPageDiv").dialog({ - modal:true, - title: "Service Logic Administration - " + data.dbHost, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .always(function() { - }); - }catch(err){ - } -} - -function showCurrentDGs(module,rpc){ - var htmlStr = ""; - try{ - var params="?module=" + module + "&rpc=" + rpc; - var url="/listCurrentDGs" + params; - //console.log("url:" + url); - $.get(url) - .done(function( data ) { - var htmlStr=getHtmlStr(data,true); - $("#svclogicPageDiv").dialog({ - modal:true, - title:"Service Logic Administration Module=" + module + " and RPC=" + rpc, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .fail(function(err) { - htmlStr= "<div>Error occured displaying the DG list</div>"; - $("#svclogicPageDiv").dialog({ - modal:true, - title:"Service Logic Administration Module=" + module + " and RPC=" + rpc, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }) - .always(function() { - }); - }catch(err){ - } -} - - -function displaySLA(callback){ - var htmlStr = ""; - try{ - $.get("/listSLA") - .done(function( data ) { - var htmlStr=getHtmlStr(data); - callback(htmlStr,data.dbHost); - }) - .fail(function(err) { - htmlStr= "<div>Error occured displaying the DG list</div>"; - callback(htmlStr,err.dbHost); - }) - .always(function() { - }); - }catch(err){ - callback(htmlStr,""); - } -} - -function displayCurrentDGs(module,rpc,callback){ - var htmlStr = ""; - try{ - var params="?module=" + module + "&rpc=" + rpc; - var url="/listCurrentDGs" + params; - //console.log("url:" + url); - $.get(url ) - .done(function( data ) { - var htmlStr=getHtmlStr(data,true); - callback(htmlStr,data.dbHost); - }) - .fail(function(err) { - htmlStr= "<div>Error occured displaying the Current DG list</div>"; - callback(htmlStr,err.dbHost); - }) - .always(function() { - }); - }catch(err){ - callback(htmlStr,""); - } -} - - -window.onbeforeunload = function (event) { - var dis = $('#btn-deploy').attr('class') - if ( dis.indexOf('disabled') == -1 ) { - var message = 'Important: You have changes that were not \'deployed\'.'; - if (typeof event == 'undefined') { - event = window.event; - } - if (event) { - event.returnValue = message; - } - return message; - } -}; -</script> -<script type="text/x-red" data-help-name="dgstart"> - <p>This node starts a flow. This node is required on every flow.</p> - <p>This node has a button to its left, when clicked generates the XML for the flow</p> - <img src="images/dgstart.png"></img> -</script> -<style> -.textview{ - font-size:20px; -} -</style> - -<div id="screenInfoId"></div> -<script type="text/javascript"> -function getAttributeValue(xmlStr,attribute){ - var attrVal=null; - try{ - var myRe = new RegExp(attribute + "[\s+]?=[\s+]?['\"]([^'\"]+)['\"]","m"); - var myArray = myRe.exec(xmlStr); - if(myArray != null && myArray[1] != null){ - attrVal=myArray[1]; - } - }catch(err){ - console.log(err); - } - return attrVal; - -} - - -function showDgStartGenerateXmlStatus(){ - var htmlStr="<div id='dgstart-generate-xml-div' style='width:375;height:225'><p>Generating XML. Please wait... </p><img src='images/page-loading.gif'></div>" - $("#dgstart-generate-xml-dialog").dialog({ - modal:true, - title: "DGBuilder XML Generation Status", - width: 400, - height: 250, - minWidth : 400, - minHeight :200, - }).html(htmlStr); -} - - RED.nodes.registerType('dgstart',{ - color:"#fdd0a2", - category: 'DGEmain', - defaults: { - name: {value:"DGSTART"}, - outputs: {value:1} - }, - inputs:0, - outputs:1, - icon: "inject.png", - label: function() { - return this.name; - }, - onpaletteadd: function() { - //console.log("DGSTART Added to the palette."); - }, - button: { - onclick: function() { - //$('#processingStatusId').text('working...'); - //$('#processingStatusId').html("<span><p> Processing Please Wait...</span><img src='images/page-loading.gif'>"); - $('#processingStatusId').html("<span style='font-size:0.2em;color:green'> Processing...</span>"); - var timerObj = window.setTimeout(function() { - //document.getElementById("processingStatusId").innerHTML ="<img src='images/page-loading.gif'>"; - - /* - var target = $(event.target); - //target.text("Validating XML"); - target.css({ "background-image": "url('images/page-loading.gif')" }); - target.css({ "background-repeat": "no-repeat" }); - target.css({ "background-size": "25px 25px" }); - */ - - //deploy button - //$("#btn-deploy") - var loopDetectionEnabled = true; - console.log("loopDetectionEnabled:" +loopDetectionEnabled); - if(loopDetectionEnabled){ - var msecs1= Date.now(); - var isLoopDetected = detectLoop(); - var msecs2= Date.now(); - console.log("Time taken for loop detection:" + (msecs2 - msecs1)); - if(isLoopDetected){ - //RED.notify("<strong>Error</strong>: Loop Detected","error"); - //target.css({ "background-image": "none" }); - return false; - } - } - var nodeSetWithUpdatedDgNumbers = updateDgNumbers(); - validateEachNodeXml(); - //var nodeToXmlStr = getNodeToXml(); - var unformatted_xml_str = getNodeToXml(); - //console.log("Size of unformatted_xml_str" + unformatted_xml_str.length); - //console.log("output:" + nodeToXmlStr); - var formatted_xml = vkbeautify.xml(unformatted_xml_str); - /* - var minified_xml = vkbeautify.xmlmin(unformatted_xml_str,true); - var lengthOfMinifiedXml = minified_xml.length; - if(lengthOfMinifiedXml >0){ - var val = lengthOfMinifiedXml/(1024*1024) - var minSizeStr = val.toFixed(4) + " MB"; - console.log("minified XML size:" + minSizeStr); - } - */ - var lengthOfXml = formatted_xml.length; - var sizeStr = ""; - if(lengthOfXml >0){ - var val = lengthOfXml/(1024*1024) - sizeStr = val.toFixed(4) + " MB"; - console.log("length:" + val); - } - var xmlLines = formatted_xml.split("\n"); - console.log("Number of lines " + xmlLines.length); - var numberOfLines = xmlLines.length; - //var display_formatted_xml = formatted_xml.replace("<","<"); - var currentNodeSet = getCurrentFlowNodeSet(); - //get max x and y coordinates - var x=0; - var y=0; - var maxX=0; - var maxY=0; - var moduleName = ""; - var dgVersion = ""; - var methodName = ""; - var formattedMethodName = ""; - var origModuleName = ""; - var origMethodName = ""; - for(var i=0;currentNodeSet != null && i<currentNodeSet.length;i++){ - if(currentNodeSet[i].type == "service-logic"){ - //moduleName = currentNodeSet[i].name; - moduleName = currentNodeSet[i].module; - dgVersion = currentNodeSet[i].version; - origModuleName = getAttributeValue(currentNodeSet[i].xml,"module"); - } - if(currentNodeSet[i].type == "method"){ - //methodName = currentNodeSet[i].name; - origMethodName = getAttributeValue(currentNodeSet[i].xml,"rpc");; - methodName = origMethodName; - if(methodName == ""){ - methodName = "rpc_not_set"; - } - } - x = currentNodeSet[i].x; - y = currentNodeSet[i].y; - if(x>maxX){ - maxX=x; - } - if(y>maxY){ - maxY=y; - } - } - //add 5 more pixels to that - maxX= Math.ceil(maxX) + 5; - maxY= Math.ceil(maxY) + 5; - //console.log("maxX:" + maxX); - //console.log("maxY:" + maxY); - var unformatted_json_str=JSON.stringify(currentNodeSet); - var formatted_json = vkbeautify.json(unformatted_json_str); - //var displayHtmlStr="<div><textarea readonly='1' style='width:1100px;height:700px;border:none'>" + formatted_xml + "</textarea></div>"; - var displayHtmlStr="<div style='font-size:20px;'><xmp>" + formatted_xml + "</xmp></div>"; - var xmlInfoStr = "<div id='xml-info-div'><p>" + "XML size:" + sizeStr + " <br>Number of Lines:" + numberOfLines + "</p></div>"; - var htmlCode =""; - $( "#xmldialog" ).dialog({ - title: "XML Generated", - width: 1200, - height: 750, - minWidth : 800, - minHeight :450, - dialogClass : "no-close", - closeOnEscape : false, - autoOpen : false, - resize: function( event, ui ) { - /* - $( this ).dialog( "option", "title", - ui.size.height + " x " + ui.size.width ); - */ - }, - modal: true, - /*show: { - effect: "slide", - duration: 1000 - }, - */ - /*hide: { - effect: "slide", - duration: 500 - }, - */ - buttons: { - /* - "+" : function () { - var size= $("#xmldialog").find('.textview').css("font-size"); - console.log("size:" + size); - size=size.replace("px",""); - var fsize=Number(size) +1; - if(fsize<19){ - fsize+=4; - } - if(fsize >= 26){ - return; - } - $("#xmldialog").find('.textview').css("font-size",fsize); - }, - "-" : function () { - var size= $("#xmldialog").find('.textview').css("font-size"); - console.log("size:" + size); - size=size.replace(/px/,""); - var fsize=Number(size) -1; - if(fsize <= 14){ - return; - } - $("#xmldialog").find('.textview').css("font-size",fsize); - }, - */ - "Validate XML" : function (event) { - if(!event) event = window.event; - var target = $(event.target); - target.text("Validating XML"); - target.css({ "background-image": "url('images/page-loading.gif')" }); - target.css({ "background-repeat": "no-repeat" }); - target.css({ "background-size": "25px 25px" }); - - var resp= validateFinalXML(unformatted_xml_str); - console.log("errorList:" + errList); - if(!resp){ - showErrors(); - } - target.text("Validate XML"); - target.css({ "background-image": "none" }); - }, - "Email Flow" : function (event) { - if(!event) event = window.event; - var target = $(event.target); - target.text("Processing"); - target.css({ "background-image": "url('images/page-loading.gif')" }); - target.css({ "background-repeat": "no-repeat" }); - target.css({ "background-size": "25px 25px" }); - d3.xhr("style.css").get(function(err,resp){ - console.log("resp:" + resp); - //console.dir(resp); - var styleSheetText = resp.responseText; - /*var htmlCode = "<style>" + styleSheetText + "</style></head>" + - '<body><div id="chart" class="ui-droppable">' + - */ - //var svgTagInfo = '<div style="overflow:auto;border:1px solid #D76D2D;height:600px;"><svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" viewBox="0 0 1024 768" preserveAspectRatio="xMidYMid meet">'; - //var svgTagInfo = '<div style="overflow-x:auto;overflow-y:auto;border:1px solid #D76D2D;width:1200px;height:750px;"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="3500px" height="3200px" viewBox="0 0 5500 5000" >'; - var svgTagInfo = '<div style="overflow-x:auto;overflow-y:auto;border:1px solid #D76D2D;width:1200px;height:750px;"> <svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="3500px" height="3200px" viewBox="0 0 8000 7500" >'; - var svgHtmlCode = $("svg").html(); - //svgHtmlCode = svgHtmlCode.replace('<rect width="5000" height="5000"','<rect width="' + maxX + '" height="' + maxY +'"'); - var find = 'href="icons/arrow-in.png"'; - var re = new RegExp(find, 'g'); - svgHtmlCode = svgHtmlCode.replace(re, 'href=""'); - find = 'href="icons/inject.png"'; - re = new RegExp(find, 'g'); - svgHtmlCode = svgHtmlCode.replace(re, 'href=""'); - htmlCode = "\n<style>\n" + styleSheetText + "</style></head>\n<body>" + svgTagInfo + svgHtmlCode + "\n</svg></div>"; - //console.log($("svg").html()); - //console.log(htmlCode); - //html,xml,json form id - /* - //using form to submit - var form = $('<form id="hxjFormId" method="POST" action="/sendEmail"></form>'); - form.append('<input id="flowHtmlId" type="hidden" name="flowHtml" value=""/>'); - form.append('<input id="flowXmlId" type="hidden" name="flowXml" value=""/>'); - form.append('<input id="flowJsonId" type="hidden" name="flowJson" value=""/>'); - $("#screenInfoId").append(form); - //console.log($("#screenInfoId").html()); - document.getElementById("flowHtmlId").value=htmlCode; - document.getElementById("flowXmlId").value=formatted_xml; - document.getElementById("flowJsonId").value=formatted_json; - //console.log($("#screenInfoId").html()); - $("#hxjFormId").submit(); - console.log("Submitted."); - */ - var reqData = { - "flowHtml" : htmlCode, - "flowXml" : formatted_xml, - "flowJson" : formatted_json - }; - - $.post( "/sendEmail",reqData ) - .done(function( data ) { - //console.log( "Data Loaded: " + data ); - if(data != null && data.envelope != undefined && data.envelope != null){ - var toAddress = data.envelope.to; - RED.notify("Email sent successfully to " + toAddress); - }else{ - RED.notify("Email sent successfully."); - } - }) - .fail(function(err) { - console.log( "error" + err ); - RED.notify("Email send Failed."); - }) - .always(function() { - console.log( "finished" ); - target.text("Email Flow"); - target.css({ "background-image": "none" }); - }); - - /* - d3.xhr("/sendEmail").post(reqData,function(err,resp){ - console.log("Error:" + JSON.stringify(err)); - console.log("resp:" + JSON.stringify(resp)); - console.dir(resp); - }); - */ - }); - }, - /* - Deploy : function () { - $("#btn-deploy").click(); - }, - */ - "Upload XML" : function (event) { - if(!event) event = window.event; - //Save the flows.json - //RED.view.dirty(true); - //$('#btn-deploy').click(); - console.log("Deployed.."); - var target = $(event.target); - target.text("Processing"); - target.css({ "background-image": "url('images/page-loading.gif')" }); - target.css({ "background-repeat": "no-repeat" }); - target.css({ "background-size": "25px 25px" }); - var date = new Date(); - - var fileName = date.getTime() + ".xml"; - var reqData = { - "flowXml" : unformatted_xml_str, - "module" : origModuleName, - "rpc" : origMethodName - }; - $.post("/uploadxml", reqData ) - .done(function( data ) { - console.log("calling uploadxml. sending to server"); - //var successHtmlStr = "<object width='600' height='450' type='text/html' data='" + data.url + "' />"; - - if( data != undefined && data != null && (data.stdout.indexOf('Saving SvcLogicGraph to database') != -1 || data.stderr.indexOf('Saving SvcLogicGraph to database') != -1)){ - //RED.notify("<strong>Uploaded Successfully</strong>"); - //console.dir(data); - var _moduleName = data.module; - var _rpc = data.rpc; - var msg = ""; - var actualMsg = ""; - var msg_lines = ""; - msg_lines += data.stderr; - msg_lines += data.stdout; - - msgHtmlStr="<div><p><b>Uploaded the XML.<br>Additional Details<br><textarea style='width:90%;height:100%' readonly='1' rows='10' cols='90' >" + msg_lines + "</textarea></div>"; - $("#upload-xml-status-dialog").dialog({ - modal:true, - title: "Upload XML ", - width: 900, - height: 750, - minWidth : 600, - minHeight :450, - buttons: [ - { - text: "ViewDGList", - class:"alertDialogButton", - click: function() { - $(this).dialog("close"); - displayCurrentDGs(_moduleName,_rpc,function(htmlStr,dbHost){ - $("#svclogicPageDiv").dialog({ - modal:true, - title:"Service Logic Administration Module=" + _moduleName + " and RPC=" + _rpc, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }); - } - }, - { - text: "Close", - class:"alertDialogButton", - click: function() { - $(this).dialog("close"); - } - } - ] - }).html(msgHtmlStr); - }else{ - console.log("Could not upload."); - var emsg =JSON.parse( data.responseText); - var msg = ""; - var actualMsg = ""; - var msg_lines = ""; - if( emsg.stderr != "COMPILE_ERROR"){ - msg = JSON.stringify(emsg.stderr); - actualMsg = msg; - msg = msg.replace('\\t',""); - msg1 = msg.split('\\n'); - for(var k=0;k<=msg1.length && k<=10;k++){ - /* - if(k == 0){ - //msg_lines += "<span style='color:blue'>" + msg1[k] + "</span><br>"; - //msg_lines += msg1[k] +"\n"; - }else{ - if(msg1[k].indexOf("Caused by:") != -1){ - //msg_lines += "<span style='color:red'> " + msg1[k] + "</span><br>"; - msg_lines += msg1[k] ; - break; - } - } - */ - if(msg1[k] != null && msg1[k].indexOf("Caused by:") != -1){ - msg_lines += msg1[k] ; - if((k+1)<=msg1.length){ - msg_lines += "\n" + msg1[k+1] ; - } - if((k+2)<=msg1.length){ - msg_lines += "\n" + msg1[k+2] ; - } - break; - } - } - } - htmlStr="<div><p><b>Could not upload the XML. Status:" + data.status + " Message:" + data.statusText + "</b><br></p><br>Additional Details<br><textarea style='width:90%;height:100%' readonly='1' rows='10' cols='90' >" + msg_lines + "</textarea></div>"; - $("#svclogicPageDiv").dialog({ - modal:true, - title: "Upload XML ", - width: 900, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - } - }) - .fail(function(err) { - //console.log( "error" + JSON.stringify(err) ); - //console.log( JSON.stringify(err.responseText)); - var emsg =JSON.parse( err.responseText); - //console.log( emsg.stderr); - var msg = ""; - var actualMsg = ""; - var msg_lines = ""; - if( emsg != null && emsg.stderr != 'COMPILE_ERROR'){ - msg = JSON.stringify(emsg.stderr); - actualMsg = msg; - //msg = msg.replace("Caused by:","<span style='color:red'>Caused by:</span>"); - msg = msg.replace(/\\t/g,""); - msg1 = msg.split('\\n'); - for(var k=0;k<=msg1.length && k<=msg1.length;k++){ - /* - if(k == 0){ - //msg_lines += "<span style='color:blue'>" + msg1[k] + "</span><br>"; - //msg_lines += msg1[k] + "\n" ; - }else{ - if(msg1[k].indexOf("Caused by:") != -1){ - //msg_lines += "<span style='color:red'> " + msg1[k] + "</span><br>"; - msg_lines += msg1[k] ; - break; - } - } - */ - if(msg1[k] != null && msg1[k].indexOf("Caused by:") != -1){ - msg_lines += msg1[k] ; - if((k+1)<=msg1.length){ - msg_lines += "\n" + msg1[k+1] ; - } - if((k+2)<=msg1.length){ - msg_lines += "\n" + msg1[k+2] ; - } - break; - } - } - }else{ - msg = JSON.stringify(emsg.stdout); - actualMsg = msg; - msg = msg.replace('\\t',""); - msg1 = msg.split('\\n'); - msg_lines=msg1; - } - var htmlStr="<div><p><b>Could not upload the XML. Status:" + err.status + " Message:" + err.statusText + "</b><br></p><br><b>Additional Details</b><br><textarea style='width:90%;height:100%' readonly='1' rows='15' cols='90'>" + msg_lines + "</textarea></div>"; - $("#svclogicPageDiv").dialog({ - modal:true, - title: "Upload XML ", - width: 900, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - //RED.notify("<strong>ERROR:</strong>:" + err,"error"); - }) - .always(function() { - console.log( "finished" ); - target.text("Upload XML"); - target.css({ "background-image": "none" }); - }); - /* - d3.xhr("/uploadxml?fileName=" + fileName).post(function(err,resp) { - if ( resp != null && resp.status == 200) { - RED.notify("<strong>Uploaded Successfully</strong>"); - }else{ - RED.notify("<strong>ERROR:</strong>:" + err,"error"); - console.log(err); - //console.dir(resp); - } - }); - */ - }, - "View DG List": function () { - - displayCurrentDGs(origModuleName,origMethodName,function(htmlStr,dbHost){ - //console.log("htmlStr:" + htmlStr); - $("#svclogicPageDiv").dialog({ - modal:true, - title: "Service Logic Administration for Module=" + origModuleName + " and RPC=" + origMethodName, - width: 1200, - height: 750, - minWidth : 600, - minHeight :450, - }).html(htmlStr); - }); - }, - "Download XML": function () { - $(document).ready(function(){ - errList=[]; - if(moduleName != undefined && moduleName != null && moduleName != ""){ - moduleName=moduleName.replace(/\s/g, "_"); - }else{ - errList.push("Module name is required in the service-logic node."); - } - - if(dgVersion == undefined || dgVersion == null || dgVersion == ""){ - errList.push("Module version is required in the service-logic node."); - } - - if(methodName != undefined && methodName != null && methodName != ""){ - methodName=methodName.replace(/\s/g, "_"); - //formattedMethodName=methodName + "_" + dgVersion; - formattedMethodName=methodName ; - }else{ - errList.push("rpc name is required in the method node."); - } - console.log("Download Xml moduleName:" + moduleName); - console.log("Download Xml methodName:" + formattedMethodName); - - if(errList != null && errList.length > 0 ){ - showErrors(); - return; - } - - $("#dwnldXmlFormId").empty().remove(); - //using form to submit - var form = $('<form id="dwnldXmlFormId" method="POST" action="/downloadXml"></form>'); - form.append('<input id="flowXmlId" type="hidden" name="flowXml"/>'); - form.append('<input type="hidden" name="moduleName" value="' + moduleName + '"/>'); - form.append('<input type="hidden" name="methodName" value="' + formattedMethodName + '"/>'); - form.appendTo('body'); - //$("#flowXmlId").val(formatted_xml); - $("#flowXmlId").val(unformatted_xml_str); - $("#dwnldXmlFormId").submit(); - //console.log("Form submitted."); - }); - }, - "Download JSON": function () { - $(document).ready(function(){ - errList=[]; - if(moduleName != undefined && moduleName != null && moduleName != ""){ - moduleName=moduleName.replace(/\s/g, "_"); - }else{ - errList.push("Module name is required in the service-logic node."); - } - - if(dgVersion == undefined || dgVersion == null || dgVersion == ""){ - errList.push("Module version is required in the service-logic node."); - } - - if(methodName != undefined && methodName != null && methodName != ""){ - methodName=methodName.replace(/\s/g, "_"); - //formattedMethodName=methodName + "_" + dgVersion; - formattedMethodName=methodName ; - }else{ - errList.push("rpc name is required in the method node."); - } - console.log("Download Xml moduleName:" + moduleName); - console.log("Download Xml methodName:" + formattedMethodName); - - if(errList != null && errList.length > 0 ){ - showErrors(); - return; - } - //console.log("formatted_json:" + formatted_json); - $("#dwnldJsonFormId").empty().remove(); - //using form to submit - var form = $('<form id="dwnldJsonFormId" method="POST" action="/downloadJson"></form>'); - form.append('<input id="flowJsonId" type="hidden" name="flowJson" value=""/>'); - form.append('<input type="hidden" name="moduleName" value="' + moduleName + '"/>'); - form.append('<input type="hidden" name="methodName" value="' + formattedMethodName + '"/>'); - form.appendTo('body'); - //$("#flowJsonId").val(formatted_json); - $("#flowJsonId").val(unformatted_json_str); - $("#dwnldJsonFormId").submit(); - //console.log("Form submitted."); - }); - }, - Close: function () { - /* - console.log("clearing the variables."); - htmlCode =""; - formatted_json =""; - formatted_xml =""; - xmlLines =[]; - unformatted_xml_str=""; - unformatted_json_str=""; - */ - $('.ui-dialog:has(#xmldialog)').empty().remove(); - RED.view.redraw(); - - //console.log($("#xmldialog").attr('id')); - //$('.ui-dialog:has(# + $("#xmldialog").attr('id') + ')').empty().remove(); - //$("#xmldialog").hide(); - //$("#xmldialog").dialog("destroy").remove(); - } - }, - open:function (){ - $(function(){ - $("#xmldialog").dialog("widget").find(".ui-dialog-buttonpane").append(xmlInfoStr); - console.log("opened."); - }); - } - }).html(displayHtmlStr).dialog("open"); - - //}).html(displayHtmlStr).dialog("widget").find(".ui-dialog-buttonpane").append(xmlInfoStr); - - //display size and number of lines in XML - //$("#xmldialog").dialog("widget").find(".ui-dialog-buttonpane").append(xmlInfoStr); - - //$("#processingStatusId").html(""); - //This logic is commented as formatting and displaying orion is taking time - //START - /* - var msecs1= Date.now(); - var that = this; - require(["orion/editor/edit"], function(edit) { - that.editor = edit({ - parent:document.getElementById('xmldialog'), - lang:"html", - readonly:true, - //showLinesRuler: false, - contents: formatted_xml - }); - 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'] - }); - }); - var msecs2= Date.now(); - //console.log("Time taken for displaying XML:" + (msecs2 - msecs1)); - */ - //END - //var success = customValidation(currentNodeSet); - var success = customValidation(nodeSetWithUpdatedDgNumbers); - if(!success){ - showFlowDesignErrorBox(); - } - $('#processingStatusId').html(""); - }, 0); - } - } - - }); -</script> diff --git a/dgbuilder/nodes/dge/dgemain/dgstart.js b/dgbuilder/nodes/dge/dgemain/dgstart.js deleted file mode 100644 index f2b4815e..00000000 --- a/dgbuilder/nodes/dge/dgemain/dgstart.js +++ /dev/null @@ -1,594 +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"); - //var dgxml=require("/home/users/schinthakayala/nodered/sheshi/dgxml/dgxml2"); - var _=require('lodash'); - var fs=require('fs'); - var path = require('path'); - var appDir = path.dirname(require.main.filename); - var userDir = appDir + "/" + RED.settings.userDir; - var dbHost = RED.settings.dbHost; - var request = require('request'); - var sharedDir = appDir + "/" + RED.settings.sharedDir; - var xmlDir = appDir + "/" + RED.settings.xmlPath; - - //console.log("appDir:" + appDir); - //var dgeraw=fs.readFileSync(appDir + "/dge.json").toString(); - //var dgejson=JSON.parse(dgeraw); - //var uploadUrl=dgejson.slaHost + dgejson.uploadUrl; - //var slaUrl=dgejson.slaHost + dgejson.slaUrl; - //var uploadUrl=RED.settings.slaHost + RED.settings.uploadUrl; - //var slaUrl=RED.settings.slaHost + RED.settings.slaUrl; - var uploadUrl=""; - var slaUrl=""; - //console.log("Upload url: " + uploadUrl); - - function dgstart(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.topic = n.topic; - } - - function writeHtmlToFile(fileName,str){ - var localfile = appDir + "/" + RED.settings.htmlPath + fileName; - try{ - fs.writeFileSync(localfile,str); - }catch(e){ - console.log("Error:" + e); - } - } - - function writeXmlToFile(fileName,str){ - var localfile = appDir + "/" + RED.settings.xmlPath + fileName; - try{ - fs.writeFileSync(localfile,str); - }catch(e){ - console.log("Error:" + e); - } - } - - function sendXml(fileName,res) { - var needle, localfile, data; - needle = require('needle') - localfile = appDir + "/" + RED.settings.xmlPath + fileName; - console.log("localfile:" + localfile); - data={ - uploadedfile: { file: localfile, content_type: 'text/xml' } - } - needle.post(uploadUrl, data, { multipart: true }, function(err, resp, body) { - //console.log(body) - if(resp != undefined && resp != null){ - console.log("resp Code for sendXml:" + resp.statusCode); - } - fs.unlink(localfile, function (error) { - if (error) { - console.log("Error deleting file "+localfile); - }else{ - //console.log("deleted file:" + localfile); - } - }); - - if(err){ - console.log("Error posting to slaUrl:" + slaUrl); - console.log("Error:" +err); - res.json({"error":err}); - }else{ - //console.dir(resp); - //console.log("slaUrl:" + slaUrl); - res.json({"url":slaUrl}); - } - - }); - } - - function oldsendXml(fileName) { - console.log("In sendXML for file: " + fileName); - var fileStream, formdata, localfile; - localfile = appDir + "/" + RED.settings.xmlPath + fileName; - - formdata = { - MAX_FILE_SIZE: "100000", - uploadedfile: { - options: { - contentType: 'audio/mpeg' - } - } - - }; - - console.log("Attempting to upload file: " + localfile); - console.log("Sending to: " + uploadUrl); - formdata.uploadedfile.value = fs.createReadStream(localfile); - fileStream = formdata.uploadedfile.value; - -//console.log("Formdata:"); -//console.dir(formdata); - - request.post({ - url: uploadUrl, - proxy: false, - formData: formdata - }, function(err, resp, body) { - fileStream.close(); - console.log("err: " + err); - return console.log("body: " + body); - }); - - }; - - RED.nodes.registerType("dgstart",dgstart); -/* - RED.httpAdmin.post("/uploadxml", function(req,res) { - console.dir(req); - console.log("USER:" + req.user); - console.log("Got request to upload xml to SDN-C."); - console.log("Requested filename to upload: " + req.params.fileName); - console.log("Requested xml to upload: " + req.params.xmlStr); - writeToFile( req.params.fileName,req.params.xmlStr); - - sendXml(req.params.fileName,res); - // res.send("Attempt complete."); - // res.redirect(slaUrl); - }); -*/ - - RED.httpAdmin.post("/OldUploadxml", function(req,res) { - //console.dir(req); - //console.log("USER:" + req.user); - var qs = require('querystring'); - var body = ''; - req.on('data', function (data) { - body += data; - // Too much POST data, kill the connection! - /*if (body.length > 1e6) - request.connection.destroy(); - */ - }); - req.on('end', function () { - //console.log("BODY:" + body); - var d = new Date().getTime(); - var user = req.user; - var fileName= user + "_" + d +".xml"; - var post = qs.parse(body); - //console.log(JSON.stringify(post)); - // use post['blah'], etc. - var localfile = appDir + "/" + RED.settings.xmlPath + fileName; - //console.log("localfile:" + localfile); - var xmlStr = post['flowXml']; - writeXmlToFile(fileName,xmlStr); - sendXml(fileName,res); - - }); - - }); - - RED.httpAdmin.post("/uploadxml", function(req,res) { - //console.dir(req); - //console.log("USER:" + req.user); - var qs = require('querystring'); - var body = ''; - req.on('data', function (data) { - body += data; - // Too much POST data, kill the connection! - /*if (body.length > 1e6) - request.connection.destroy(); - */ - }); - req.on('end', function () { - //console.log("BODY:" + body); - var d = new Date().getTime(); - var user = req.user; - var fileName= user + "_" + d +".xml"; - var post = qs.parse(body); - //console.log(JSON.stringify(post)); - // use post['blah'], etc. - var localfile = appDir + "/" + RED.settings.xmlPath + fileName; - //console.log("localfile:" + localfile); - var xmlStr = post['flowXml']; - var moduleName = post['module']; - var rpc = post['rpc']; - writeXmlToFile(fileName,xmlStr); - uploadDG(localfile,moduleName,rpc,res); - }); - - }); - - -function uploadDG(filePath,moduleName,rpc,res){ - console.log("called uploadDG..."); - var exec = require('child_process').exec; - var commandToExec = appDir + "/svclogic/svclogic.sh load " + filePath + " " + userDir + "/conf/svclogic.properties"; - console.log("commandToExec:" + commandToExec); - var child = exec(commandToExec ,function (error,stdout,stderr){ - //console.log(error); - console.log("stdout:" + stdout); - console.log("stderr:" + stderr); - if(error){ - console.log("Error occured:" + error); - if(stderr){ - //console.log("stderr:" + stderr); - res.send(500,{'error':error,'stderr':stderr}); - }else{ - res.send(500,{'error':error}); - } - //console.log("stdout :" + stdout); - }else{ - if(stdout ){ - //console.log("output:" + stdout); - if(stdout.indexOf('Compiler error') != -1){ - //console.log("compileError occured."); - - var resp = { - 'stdout':stdout, - 'stderr':"COMPILE_ERROR", - 'url':dbHost, - 'module':moduleName, - 'rpc':rpc - } - res.send(500,resp); - }else{ - res.send(200,{'stdout':stdout,'stderr':stderr,"url":dbHost,"module" : moduleName,"rpc" : rpc}); - } - } - if(stderr && !stdout){ - //console.log("stderr:" + stderr); - if(stderr.indexOf("Saving SvcLogicGraph to database") != -1){ - res.send(200,{'error':error,'stdout' :'','stderr':stderr,"url":dbHost,"module" : moduleName,"rpc" : rpc}); - }else{ - res.send(500,{'error':error,'stdout' :'','stderr':stderr}); - } - } - } - }); -} - - RED.httpAdmin.get("/displayXml", function(req,res) { - var _module = req.query._module; - var rpc = req.query.rpc; - var version = req.query.version; - var mode = req.query.mode; - var d = new Date().getTime(); - displayXml(_module,rpc,version,mode,res); - }); - -function displayXml(_module,rpc,version,mode,res){ - var exec = require('child_process').exec; - var msg = { - '_module' : _module, - 'rpc' : rpc, - 'version' : version, - 'mode' : mode - } - var commandToExec = appDir + "/svclogic/svclogic.sh get-source " + _module + " " - + rpc + " " + mode + " " + version + " " + userDir + "/conf/svclogic.properties"; - console.log("commandToExec:" + commandToExec); - var child = exec(commandToExec ,{'maxBuffer':16*1024*1024},function (error,stdout,stderr){ - if(error){ - console.log("Error occured:" + error); - if(stderr){ - //console.log("stderr:" + stderr); - res.send(500,{'error':error,'stderr':stderr,'msg':msg}); - }else{ - res.send(500,{'error':error,'msg':msg}); - } - }else{ - if(stderr){ - console.log("stderr:" + stderr); - } - if(stdout){ - res.send({'xmldata' : "<xmp>" + stdout + "</xmp>"}); - } - } - }); -} - - - RED.httpAdmin.post("/downloadDGXml", function(req,res) { - //console.dir(req); - var qs = require('querystring'); - var body = ''; - req.on('data', function (data) { - body += data; - }); - - req.on('end', function () { - var post = qs.parse(body); - var _module = post._module; - var rpc = post.rpc; - var version = post.version; - var mode = post.mode; - var d = new Date().getTime(); - downloadDGXml(_module,rpc,version,mode,res); - }); - }); - -function downloadDGXml(_module,rpc,version,mode,res){ - var exec = require('child_process').exec; - var msg = { - '_module' : _module, - 'rpc' : rpc, - 'version' : version, - 'mode' : mode - } - var commandToExec = appDir + "/svclogic/svclogic.sh get-source " + _module + " " - + rpc + " " + mode + " " + version + " " + userDir + "/conf/svclogic.properties"; - console.log("commandToExec:" + commandToExec); - var child = exec(commandToExec ,function (error,stdout,stderr){ - if(error){ - console.log("Error occured:" + error); - if(stderr){ - //console.log("stderr:" + stderr); - res.send(500,{'error':error,'stderr':stderr,'msg':msg}); - }else{ - res.send(500,{'error':error,'msg':msg}); - } - }else{ - if(stderr){ - console.log("stderr:" + stderr); - } - if(stdout){ - //console.log("output:" + stdout); - //var newOutput = "<pre>" + stdout.replace(/\n/g,'<br>') + "</pre>"; - //res.json({'stdout': stdout ,'stderr':stderr,"msg":msg}); - //res.set('Content-Type', 'text/xml'); - //res.set('Content-Type', 'application/octet-stream'); - //res.end("<code>" + stdout + "</code>" ); - //var newOutput ="<html><body>" + stdout + "</body></html>"; - //res.send(new Buffer( "<code>" + newOutput + "</code>" ) ); - //res.send(newOutput); - - /* - var xslStr = '<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">' + - '<xsl:output omit-xml-declaration="yes" indent="yes"/>' + - '<xsl:template match="node()|@*">' + - '<xsl:copy>' + - '<xsl:apply-templates select="node()|@*"/>' + - '</xsl:copy>' + - '</xsl:template>' + - '</xsl:stylesheet>'; - */ - - var formatted_date = getCurrentDate(); - var fileName= "db_" + _module + "_" +rpc+ "_" + version + "_" + formatted_date + ".html"; - var file = xmlDir + "/" + fileName; - var xmlStr = '<xmp>' + stdout + "</xmp>"; - //var xmlStr = "<![CDATA[" + stdout + "]]"; - //var xmlStr = stdout.replace(/</g,"<"); - //xmlStr = xmlStr.replace(/>/g,">"); - //xmlStr = xmlStr.replace(/\n>/g,"<br>"); - //xmlStr = xmlStr.replace(/\t>/g," "); - - writeToFile(file,"<html><body>" +xmlStr+ "</body></html>"); - //console.log("xmlStr:" + xmlStr); - res.setHeader('Content-disposition', 'attachment; filename=' + file); - //res.setHeader('Content-type', 'text/html'); - res.setHeader('Content-type', 'text/xml'); - res.download(file); - } - } - }); -} - - - RED.httpAdmin.get("/displayAsGv", function(req,res) { - var _module = req.query._module; - var rpc = req.query.rpc; - var version = req.query.version; - var mode = req.query.mode; - var d = new Date().getTime(); - displayAsGv(_module,rpc,version,mode,res); - }); - -function displayAsGv(_module,rpc,version,mode,res){ - var exec = require('child_process').exec; - var msg = { - '_module' : _module, - 'rpc' : rpc, - 'version' : version, - 'mode' : mode - } - var commandToExec = appDir + "/svclogic/svclogic.sh print " + - _module + " " + rpc + " " + mode + " " + version + " " - //+ userDir + "/conf/svclogic.properties | dot -Tpng "; - //the label="""" is giving an error so replacing it with "null" - + userDir + "/conf/svclogic.properties |sed -e 's%label=\"\"\"\"%label=\"null\"%g'| dot -Tsvg "; - console.log("commandToExec:" + commandToExec); - //+ userDir + "/conf/svclogic.properties | dot -Tsvg "; - //var child = exec(commandToExec ,function (error,stdout,stderr){ - //var child = exec(commandToExec ,{maxBuffer:16*1024*1024},function (error,stdout,stderr){ - //var child = exec(commandToExec ,{encoding:'base64',maxBuffer:20*1024*1024},function (error,stdout,stderr){ - var child = exec(commandToExec ,{maxBuffer:20*1024*1024},function (error,stdout,stderr){ - if(error){ - console.log("Error occured:" + error); - if(stderr){ - console.log("stderr:" + stderr); - res.send(500,{'error':error,'stderr':stderr,"msg":msg}); - }else{ - res.send(500,{'error':error,"msg":msg}); - } - }else{ - if(stderr){ - console.log("stderr:" + stderr); - //To convert base64 to ascii - //console.log(new Buffer(stderr, 'base64').toString('ascii')); - } - if(stdout){ - //console.log(stdout.length); - //console.log("output:" + stdout); - //var svg_html = stdout ; - //var image = "<img src='data:image/png;base64," + stdout + "'>"; - //var image = "<iframe width='1200' height='750' src='data:image/png;base64," + stdout + "'></frame>"; - //var image = "<iframe width='1200' height='750' src='data:image/svg+xml;base64," + stdout + "'></frame>"; - //var image = "<iframe width='1200' height='750' src='data:image/gif;base64," + stdout + "'></frame>"; - var image = "<iframe width='1200' height='750' src='data:image/svg+xml;UTF-8," + stdout + "'></frame>"; - //console.log(image); - res.send({'svg_html':image}); - } - } - }); -} - - RED.httpAdmin.post("/shareFlow", function(req,res) { - //console.dir(req); - //console.log("USER:" + req.user); - var qs = require('querystring'); - var body = ''; - req.on('data', function (data) { - body += data; - // Too much POST data, kill the connection! - /*if (body.length > 1e6) - request.connection.destroy(); - */ - }); - req.on('end', function () { - var post = qs.parse(body); - - var nodeSet = JSON.parse(post['flowData']); - var activeWorkspace=post['activeWorkspace']; - var methodName = ""; - var moduleName = ""; - for(var i=0;nodeSet != null && i<nodeSet.length;i++){ - var node = nodeSet[i]; - if(node.type == 'module' ){ - moduleName= node.name; - moduleName=moduleName.replace(/ /g,"-"); - } - if(node.type == 'method' ){ - methodName= node.name; - methodName=methodName.replace(/ /g,"-"); - } - } - //console.log("BODY:" + body); - var d = new Date().getTime(); - var user = req.user; - var fileName= moduleName + "_" +methodName+".json"; - var localfile = sharedDir + "/" + fileName; - //console.log("localfile:" + localfile); - - writeToFile(localfile,JSON.stringify(nodeSet)); - res.send({"fileName": fileName}); - }); - - }); - - - RED.httpAdmin.post("/sendEmail", function(req,res) { - //console.dir(req); - console.log("USER:" + req.user); - var fromAddr = RED.settings.emailAddress; - var toAddr = RED.settings.emailAddress; - var qs = require('querystring'); - var body = ''; - req.on('data', function (data) { - body += data; - // Too much POST data, kill the connection! - /*if (body.length > 1e6) - request.connection.destroy(); - */ - }); - req.on('end', function () { - //console.log("BODY:" + body); - var d = new Date().getTime(); - var user = req.user; - var fileName= user + "_" + d +".html"; - var post = qs.parse(body); - //console.log(JSON.stringify(post)); - // use post['blah'], etc. - var localfile = appDir + "/" + RED.settings.htmlPath + fileName; - //console.log("localfile:" + localfile); - var nodemailer = require("nodemailer"); - nodemailer.sendmail = true; - var transporter = nodemailer.createTransport(); - var ua = req.headers['user-agent']; - var host = req.headers.host; - var fullHtml="<!doctype html><html><head>" + post['flowHtml']; - //fullHtml+="<div style='fill:both'></div>"; - fullHtml+="<div style='margin-left:10px;'><p>XML</p><br><textarea rows='50' cols='150'>" + post['flowXml'] + "</textarea>"; - fullHtml+="<p>JSON</p><br><textarea rows='50' cols='150'>" + post['flowJson'] + "</textarea></div>"; - fullHtml+="</body></html>"; - writeHtmlToFile(fileName,fullHtml); - - transporter.sendMail({ - from: fromAddr, - to: toAddr, - html: "<p>DG Node Flow. click on the attachment to view</p>", - subject: 'Node flow from Host:<' + host + '>', - attachments : [{'filename': fileName, - 'contentType': "text/html", - /*'filePath': localfile*/ - 'content': fs.createReadStream(localfile) - }] - - }, function(err, response) { - var fullPathtoFileName = appDir + "/" + RED.settings.htmlPath + fileName; - fs.unlink(fullPathtoFileName, function (error) { - if (error) { - console.log("Error deleting file "+fullPathtoFileName); - }else{ - //console.log("deleted file:" + fullPathtoFileName); - } - }); - - if(err){ - console.log("Error:" + err); - res.json(err); - }else{ - res.json(response); - } - console.log(response); - }); - - }); - - - }); -/* - RED.httpAdmin.post("/doxml/:id", function(req,res) { - var node = RED.nodes.getNode(req.params.id); - if (node != null) { - try { - // node.receive(); - //console.log("doxml was called for node: "); - //console.dir(node); - //console.log("calling getJson"); - var nrjson=dgxml.getJson(); - console.log("calling nodered2xml"); - var results=[]; - results=dgxml.nodered2xml(nrjson,node.id); - var nrxml=results[0]; - fileName=results[1]; - console.log("Got this filename: " + fileName); - // res.send(200); - console.log("appDir: " + appDir); - fs.writeFileSync(appDir + "/public/xml/"+fileName,nrxml); - // res.send("XML generated! See help on right for link."); - res.send(fileName); - } catch(err) { - res.send(500); - node.error("doxml failed:"+err); - console.log(err.stack); - } - } else { - res.send(404); - } - }); -*/ -} diff --git a/dgbuilder/nodes/dge/dgemain/method.html b/dgbuilder/nodes/dge/dgemain/method.html deleted file mode 100644 index 134896e7..00000000 --- a/dgbuilder/nodes/dge/dgemain/method.html +++ /dev/null @@ -1,141 +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="method"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show RPCs</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> -<script type="text/x-red" data-help-name="method"> - <p>A method node.</p> - <p>Name can be anything.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> -</script> - -<script type="text/javascript"> - RED.nodes.registerType('method',{ - color:"#fdd0a2", - category: 'DGEmain', - defaults: { - name: {value:"method"}, - xml: {value:"<method rpc='' mode='sync'>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - //console.log("show Values clicked."); - showRpcsValuesBox(that.editor,rpcValues); - }); - - }); - - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgemain/method.js b/dgbuilder/nodes/dge/dgemain/method.js deleted file mode 100644 index 6a29bd83..00000000 --- a/dgbuilder/nodes/dge/dgemain/method.js +++ /dev/null @@ -1,31 +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 method(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("method",method); - // RED.library.register("method"); -} diff --git a/dgbuilder/nodes/dge/dgemain/serviceLogic.html b/dgbuilder/nodes/dge/dgemain/serviceLogic.html deleted file mode 100644 index ca8ac8c4..00000000 --- a/dgbuilder/nodes/dge/dgemain/serviceLogic.html +++ /dev/null @@ -1,125 +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="service-logic"> - <div class="form-row"> - <!--<label for="node-input-name"><i class="fa"></i> Name</label>--> - <input type="hidden" id="node-input-name" placeholder="Name"> - </div> - <div class="form-row"> - <input type="hidden" id="node-input-xml"> - <label for="node-input-module"><i class="fa"></i>Module</label> - <input type="text" id="node-input-module" autofocus="autofocus"> - <label for="node-input-version"><i class="fa"></i>Version</label> - <input type="text" id="node-input-version"> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - </div> - <!--<div class="form-tips">See the Info tab for help using this node.</div>--> -</script> - -<script type="text/x-red" data-help-name="service-logic"> - <p>A service-logic node.</p> - <p>Double click the node to configure the module name and the version</p> - -</script> - -<script type="text/javascript"> - RED.nodes.registerType('service-logic',{ - color:"#fdd0a2", - category: 'DGEmain', - defaults: { - name: {value:"service-logic"}, - module: {value:""}, - version: {value:""}, - comments:{value:""}, - xml: {value:"<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='' version=''>\n"}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - //$("#node-input-xml-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}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#dialog" ).one("dialogclose", function(ev,ui) { - var height = $( "#dialog" ).dialog('option','height'); - $( "#dialog" ).off("dialogresize",functionDialogResize); - }); - - $("#node-input-module").focus(); - - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - var module = $("#node-input-module").val(); - if(module == null){ - module=''; - } - var version = $("#node-input-version").val(); - if(version == null){ - version=''; - } - console.log("module:" + module); - console.log("version:" + version); - //xmlStr= xmlStr.replace("$MODULE",module); - //xmlStr= xmlStr.replace("$VERSION",version); - var xmlVal = "<service-logic xmlns='http://www.onap.org/sdnc/svclogic' xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='" + module + "' version='" + version + "'>" - $("#node-input-xml").val(xmlVal); - if(module == "" || version == ""){ - this.status = {fill:"red",shape:"dot",text:"Not configured"}; - }else{ - this.status = {fill:"green",shape:"dot",text:"configured"}; - $("#node-input-name").val(module + " " + version); - } - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgemain/serviceLogic.js b/dgbuilder/nodes/dge/dgemain/serviceLogic.js deleted file mode 100644 index a5e77e4e..00000000 --- a/dgbuilder/nodes/dge/dgemain/serviceLogic.js +++ /dev/null @@ -1,31 +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 serviceLogic(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("service-logic",serviceLogic); - // RED.library.register("service-logic"); -} diff --git a/dgbuilder/nodes/dge/dgeoutcome/already-active.html b/dgbuilder/nodes/dge/dgeoutcome/already-active.html deleted file mode 100644 index 914bda10..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/already-active.html +++ /dev/null @@ -1,144 +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="already-active"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="already-active"> - <p>A already-active outcome.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('already-active',{ - color: "#ffccff", - category: 'DGEoutcome', - defaults: { - name: {value:"already-active"}, - xml: {value:"<outcome value='already-active'>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgeoutcome/already-active.js b/dgbuilder/nodes/dge/dgeoutcome/already-active.js deleted file mode 100644 index f6ab4faf..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/already-active.js +++ /dev/null @@ -1,31 +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 alreadyActive(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("already-active",alreadyActive); - // RED.library.register("already-active"); -} diff --git a/dgbuilder/nodes/dge/dgeoutcome/failure.html b/dgbuilder/nodes/dge/dgeoutcome/failure.html deleted file mode 100644 index cabfab4b..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/failure.html +++ /dev/null @@ -1,142 +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="failure"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="failure"> - <p>A failure outcome.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('failure',{ - color:"#ffccff", - category: 'DGEoutcome', - defaults: { - name: {value:"failure"}, - xml: {value:"<outcome value='failure'>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgeoutcome/failure.js b/dgbuilder/nodes/dge/dgeoutcome/failure.js deleted file mode 100644 index 5abd1b74..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/failure.js +++ /dev/null @@ -1,31 +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 failure(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("failure",failure); - // RED.library.register("failure"); -} diff --git a/dgbuilder/nodes/dge/dgeoutcome/not-found.html b/dgbuilder/nodes/dge/dgeoutcome/not-found.html deleted file mode 100644 index 0b6bb8f9..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/not-found.html +++ /dev/null @@ -1,142 +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="not-found"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="not-found"> - <p>A not-found outcome.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('not-found',{ - color: "#ffccff", - category: 'DGEoutcome', - defaults: { - name: {value:"not-found"}, - xml: {value:"<outcome value='not-found'>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgeoutcome/not-found.js b/dgbuilder/nodes/dge/dgeoutcome/not-found.js deleted file mode 100644 index 80e10af4..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/not-found.js +++ /dev/null @@ -1,31 +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 notFound(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("not-found",notFound); - // RED.library.register("not-found"); -} diff --git a/dgbuilder/nodes/dge/dgeoutcome/other.html b/dgbuilder/nodes/dge/dgeoutcome/other.html deleted file mode 100644 index 7ceb2e79..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/other.html +++ /dev/null @@ -1,143 +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="other"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="other"> - <p>A other outcome.</p> - <p>Name can be anything.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('other',{ - color: "#ffccff", - category: 'DGEoutcome', - defaults: { - name: {value:"other"}, - xml: {value:"<outcome value='Other'>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgeoutcome/other.js b/dgbuilder/nodes/dge/dgeoutcome/other.js deleted file mode 100644 index 97bad48d..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/other.js +++ /dev/null @@ -1,31 +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 other(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("other",other); - // RED.library.register("other"); -} diff --git a/dgbuilder/nodes/dge/dgeoutcome/outcome.html b/dgbuilder/nodes/dge/dgeoutcome/outcome.html deleted file mode 100644 index 122f7d3d..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/outcome.html +++ /dev/null @@ -1,143 +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="outcome"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="outcome"> - <p>A generic outcome node.</p> - <p>Use this node if you do not have a outcome value node in the node panel.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('outcome',{ - color:"#ffccff", - category: 'DGEoutcome', - defaults: { - name: {value:"outcome"}, - xml: {value:"<outcome value=''>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgeoutcome/outcome.js b/dgbuilder/nodes/dge/dgeoutcome/outcome.js deleted file mode 100644 index 33513e4b..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/outcome.js +++ /dev/null @@ -1,31 +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 outcome(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("outcome",outcome); - // RED.library.register("outcome"); -} diff --git a/dgbuilder/nodes/dge/dgeoutcome/outcomeFalse.html b/dgbuilder/nodes/dge/dgeoutcome/outcomeFalse.html deleted file mode 100644 index d1044208..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/outcomeFalse.html +++ /dev/null @@ -1,143 +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="outcomeFalse"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="outcomeFalse"> - <p>A false outcome.</p> - <p>Name can be anything.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('outcomeFalse',{ - color:"#ffccff", - category: 'DGEoutcome', - defaults: { - name: {value:"false"}, - xml: {value:"<outcome value='false'>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgeoutcome/outcomeFalse.js b/dgbuilder/nodes/dge/dgeoutcome/outcomeFalse.js deleted file mode 100644 index f4a9a774..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/outcomeFalse.js +++ /dev/null @@ -1,31 +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 outcomeFalse(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("outcomeFalse",outcomeFalse); - // RED.library.register("success"); -} diff --git a/dgbuilder/nodes/dge/dgeoutcome/outcomeTrue.html b/dgbuilder/nodes/dge/dgeoutcome/outcomeTrue.html deleted file mode 100644 index a080bbf6..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/outcomeTrue.html +++ /dev/null @@ -1,142 +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="outcomeTrue"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="outcomeTrue"> - <p>A true outcome.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('outcomeTrue',{ - color:"#ffccff", - category: 'DGEoutcome', - defaults: { - name: {value:"true"}, - xml: {value:"<outcome value='true'>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgeoutcome/outcomeTrue.js b/dgbuilder/nodes/dge/dgeoutcome/outcomeTrue.js deleted file mode 100644 index f27310e0..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/outcomeTrue.js +++ /dev/null @@ -1,31 +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 outcomeTrue(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("outcomeTrue",outcomeTrue); - // RED.library.register("success"); -} diff --git a/dgbuilder/nodes/dge/dgeoutcome/success.html b/dgbuilder/nodes/dge/dgeoutcome/success.html deleted file mode 100644 index 347d7d6a..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/success.html +++ /dev/null @@ -1,141 +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="success"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="success"> - <p>A success outcome.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('success',{ - color:"#ffccff", - category: 'DGEoutcome', - defaults: { - name: {value:"success"}, - xml: {value:"<outcome value='success'>\n"}, - comments:{value:""}, - outputs: {value:1} - }, - inputs:1, - outputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - $( "#node-input-outputs" ).spinner({ - min:1 - }); - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgeoutcome/success.js b/dgbuilder/nodes/dge/dgeoutcome/success.js deleted file mode 100644 index 4dbafbf7..00000000 --- a/dgbuilder/nodes/dge/dgeoutcome/success.js +++ /dev/null @@ -1,31 +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 success(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("success",success); - // RED.library.register("success"); -} diff --git a/dgbuilder/nodes/dge/dgereturn/returnFailure.html b/dgbuilder/nodes/dge/dgereturn/returnFailure.html deleted file mode 100644 index 60ab2299..00000000 --- a/dgbuilder/nodes/dge/dgereturn/returnFailure.html +++ /dev/null @@ -1,170 +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="returnFailure"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="returnFailure"> - <p>A returnFailure node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Return_node"></a>Return node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>return</b> node is used to return a status to the invoking MD-SAL application</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>status</b></td> -<td align="left">Status value to return (<i>failure</i>)</td></tr></table></div> -<div class="section"> -<h5><a name="Parameters"></a>Parameters</h5> -<p>The following optional parameters may be passed to convey more detailed status information.</p> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>error-code</b></td> -<td align="left">A brief, usually numeric, code indicating the error condition</td></tr> -<tr class="b"> -<td align="center"><b>error-message</b></td> -<td align="left">A more detailed error message</td></tr></table></div> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<p>Not applicable. The <b>status</b> node has no outcomes.</p></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><return status="failure"> - <parameter name="error-code" value="1542" /> - <parameter name="error-message" value="Activation failure" /> -</return></pre></div></div></div> - -</script> - - -<script type="text/javascript"> - RED.nodes.registerType('returnFailure',{ - color:"#ED0819", - category: 'DGEreturn', - defaults: { - name: {value:"return failure"}, - xml: {value:"<return status='failure'>\n<parameter name='error-code' value='' />\n<parameter name='error-message' value='' />\n"}, - comments:{value:""} - }, - inputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgereturn/returnFailure.js b/dgbuilder/nodes/dge/dgereturn/returnFailure.js deleted file mode 100644 index da9fc742..00000000 --- a/dgbuilder/nodes/dge/dgereturn/returnFailure.js +++ /dev/null @@ -1,31 +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 returnFailure(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - RED.nodes.registerType("returnFailure",returnFailure); - // RED.library.register("returnFailure"); -} diff --git a/dgbuilder/nodes/dge/dgereturn/returnSuccess.html b/dgbuilder/nodes/dge/dgereturn/returnSuccess.html deleted file mode 100644 index e2d50f3a..00000000 --- a/dgbuilder/nodes/dge/dgereturn/returnSuccess.html +++ /dev/null @@ -1,174 +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="returnSuccess"> - <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-xml"><i class="fa fa-wrench"></i> Node XML</label> - <input type="hidden" id="node-input-xml" autofocus="autofocus"> - <div style="height: 450px;" class="node-text-editor" id="node-input-xml-editor" onkeyup="resetStatus()" ></div> - </div> - <div class="form-row"> - <a href="#" class="btn btn-mini" id="node-input-validate" style="margin-top: 4px;"><b>Validate XML</b></a> - <a href="#" class="btn btn-mini" id="node-input-show-sli-values" style="margin-top: 4px;"><b>Show Values</b></a> - <input type="hidden" id="node-input-comments"> - <a href="#" class="btn btn-mini" id="node-input-btnComments" style="margin-top: 4px;"><b>Add Comments</b></a> - <div id="node-validate-result" class="form-tips" style="float:right;font-size:10px"></div> - </div> - <div class="form-tips">See the Info tab for help using this node.</div> -</script> - -<script type="text/x-red" data-help-name="returnSuccess"> - <p>A returnSuccess node.</p> - <p>First line of XML must contain opening tag.</p> - <p>Do not include closing tag - it will be automatically generated.</p> - -<div class="section"> -<h4><a name="Return_node"></a>Return node</h4> -<div class="section"> -<h5><a name="Description"></a>Description</h5> -<p>A <b>return</b> node is used to return a status to the invoking MD-SAL application</p></div> -<div class="section"> -<h5><a name="Attributes"></a>Attributes</h5> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>status</b></td> -<td align="left">Status value to return (<i>success</i>)</td></tr></table></div> -<div class="section"> -<!-- -<h5><a name="Parameters"></a>Parameters</h5> -<p>The following optional parameters may be passed to convey more detailed status information.</p> -<table border="1" class="table table-striped"> -<tr class="a"> -<td align="center"><b>error-code</b></td> -<td align="left">A brief, usually numeric, code indicating the error condition</td></tr> -<tr class="b"> -<td align="center"><b>error-message</b></td> -<td align="left">A more detailed error message</td></tr></table></div> ---> -<div class="section"> -<h5><a name="Outcomes"></a>Outcomes</h5> -<p>Not applicable. The <b>status</b> node has no outcomes.</p></div> -<div class="section"> -<h5><a name="Example"></a>Example</h5> -<div class="source"> -<pre><return status="success"> - <parameter name="uni-circuit-id" value="$asePort.uni_circuit_id" /> -</return></pre></div></div></div> - -</script> - - -<script type="text/javascript"> - - RED.nodes.registerType('returnSuccess',{ - color:"#9AE767", - category: 'DGEreturn', - defaults: { - name: {value:"return success"}, - xml: {value:"<return status='success'>\n<parameter name='' value='' />\n",required:true}, - comments:{value:""} - }, - inputs:1, - icon: "arrow-in.png", - label: function() { - return this.name; - }, - oneditprepare: function() { - - - var comments = $( "#node-input-comments").val(); - if(comments != null){ - comments = comments.trim(); - if(comments != ''){ - $("#node-input-btnComments").html("<span style='color:blue;'><b>View Comments</b></span>"); - } - } - - function functionDialogResize(ev,ui) { - $("#node-input-xml-editor").css("height",(ui.size.height-275)+"px"); - }; - - $( "#dialog" ).dialog( "option", "width", 1200 ); - $( "#dialog" ).dialog( "option", "height", 750 ); - $( "#dialog" ).on("dialogresize", functionDialogResize); - $( "#dialog" ).one("dialogopen", function(ev) { - var size = $( "#dialog" ).dialog('option','sizeCache-function'); - if (size) { - functionDialogResize(null,{size:size}); - } - }); - - /* close dialog when ESC is pressed and released */ - $( "#dialog" ).keyup(function(event){ - if(event.which == 27 ) { - $("#node-dialog-cancel").click(); - } - }); - - - $( "#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-xml-editor'), - lang:"html", - contents: $("#node-input-xml").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(); - $("#node-input-validate").click(function(){ - console.log("validate clicked."); - //console.dir(that.editor); - //console.log("getText:" + that.editor.getText()); - var val = that.editor.getText(); - validateXML(val); - }); - $("#node-input-show-sli-values").click(function(){ - console.log("SLIValues clicked."); - showValuesBox(that.editor,sliValuesObj); - }); - }); - //for click of add comments button - $("#node-input-btnComments").click(function(e){ - showCommentsBox(); - }); - - }, - oneditsave: function() { - $("#node-input-xml").val(this.editor.getText()); - var resp=validateXML(this.editor.getText()); - if(resp){ - this.status = {fill:"green",shape:"dot",text:"OK"}; - }else{ - this.status = {fill:"red",shape:"dot",text:"ERROR"}; - } - delete this.editor; - } - }); -</script> diff --git a/dgbuilder/nodes/dge/dgereturn/returnSuccess.js b/dgbuilder/nodes/dge/dgereturn/returnSuccess.js deleted file mode 100644 index d6c41c9a..00000000 --- a/dgbuilder/nodes/dge/dgereturn/returnSuccess.js +++ /dev/null @@ -1,32 +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 returnSuccess(n) { - RED.nodes.createNode(this,n); - this.name = n.name; - this.xml = n.xml; - this.topic = n.topic; - } - - - RED.nodes.registerType("returnSuccess",returnSuccess); - // RED.library.register("ret-success"); -} |