node-red-contrib-thinkp-sofia2
Version:
A Node-RED node to interact with Indra's Sofia2 IoT platform.
93 lines (88 loc) • 3.68 kB
HTML
<html>
<script type="text/javascript">
RED.nodes.registerType('sofia2-delete',{
category: 'sofia2',
color: '#C0DEED',
defaults: {
name: {value:""},
ontology: {value:""},
server: {value:"", type:"sofia2-config"},
check: {value:false},
query: {value:""},
queryType: {value:""}
},
inputs: 1,
outputs:1,
icon: "sofia2.png",
label: function() {
return this.name||"sofia2-delete";
},
oneditprepare: function() {
if($("#node-input-check").is(':checked')){
$("#node-input-ontology").removeProp('disabled');
$("#node-input-query").removeProp('disabled');
$("#node-input-queryType").removeProp('disabled');
}else{
$("#node-input-ontology").prop('disabled',true);
$("#node-input-query").prop('disabled',true);
$("#node-input-queryType").prop('disabled',true);
$("#node-input-ontology").val('');
$("#node-input-query").val('');
$("#node-input-queryType").val('');
}
$("#node-input-check").click(function() {
var check = $("#node-input-check").is(':checked');
var ontologia = $("#node-input-ontology").val();
if(check){
$("#node-input-ontology").removeProp('disabled');
$("#node-input-query").removeProp('disabled');
$("#node-input-queryType").removeProp('disabled');
} else{
$("#node-input-ontology").prop('disabled',true);
$("#node-input-query").prop('disabled',true);
$("#node-input-queryType").prop('disabled',true);
$("#node-input-ontology").val('');
$("#node-input-query").val('');
$("#node-input-queryType").val('');
}
});
}
});
</script>
<script type="text/x-red" data-template-name="sofia2-delete">
<div class="form-row">
<label for="node-input-name"><i class="icon-tag"></i> Name</label>
<input type="text" id="node-input-name" placeholder="Name">
</div>
<div class="form-row">
<label> </label>
<input type="checkbox" id="node-input-check" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-input-check" style="width: 70%;"> Insert the data manually</label>
<label id="label-ontology" for="node-input-ontology" ><i class="icon-file"></i> Ontology</label>
<input type="text" id="node-input-ontology" placeholder="Ontología" disabled />
</div>
<div class="form-row">
<label for="node-input-query"><i class="icon-file"></i> Query</label>
<input type="text" id="node-input-query" placeholder="Query" disabled />
</div>
<div class="form-row">
<label for="node-input-queryType"><i class="icon-file"></i> Query Type</label>
<select id="node-input-queryType" placeholder="Query type" disabled>
<option value="SQLLIKE"> SQLLIKE</option>
<option value="NATIVE"> NATIVE</option>
</select>
</div>
<div class="form-row">
<label for="node-input-server"><i class="icon-file"></i> Server</label>
<input type="text" id="node-input-server" placeholder="Server">
</div>
<script
</script>
<script type="text/x-red" data-help-name="sofia2-delete">
<span><img style="margin-left: 5px;" src="icons/sofia2.png"/><h2 style="display:inline"> Sofia2</h2>
<p>Node deleting data in an ontology</p>
<p><code>Ontology</code> Name of the ontology if the checkbox is selected, else the name of the ontology have to go in the <code>msg.ontology</code></p>
<p><code>Query</code> Query to delete if the checkbox is selected, else the query have to go in the <code>msg.query</code></p>
<p><code>Query Type</code> Query Type of the query if the checkbox is selected, else the query type have to go in the <code>msg.queryType</code></p>
</script>
</html>