mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Tweak emoncms logo to closer match other styles
This commit is contained in:
parent
4a53c20792
commit
3a6ffdf52b
@ -32,20 +32,20 @@
|
|||||||
<input type="text" id="node-input-name" placeholder="Emoncms">
|
<input type="text" id="node-input-name" placeholder="Emoncms">
|
||||||
</div>
|
</div>
|
||||||
<div class="form-tips">Topic is not mandatory, if Topic is left blank <b>msg.topic</b> will used. Topic overrides <b>msg.topic</b></br>
|
<div class="form-tips">Topic is not mandatory, if Topic is left blank <b>msg.topic</b> will used. Topic overrides <b>msg.topic</b></br>
|
||||||
Node Group (numeric) is not mandatory, if Node Group is left blank <b>msg.nodegrpup</b> will used. Node Group overrides <b>msg.nodegroup</b></div>
|
Node Group (numeric) is not mandatory, if Node Group is left blank <b>msg.nodegrpup</b> will used. Node Group overrides <b>msg.nodegroup</b></div>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/x-red" data-help-name="emoncms">
|
<script type="text/x-red" data-help-name="emoncms">
|
||||||
<p>Performs post to Emoncms.</p>
|
<p>Performs post to Emoncms.</p>
|
||||||
<p>Topic is not mandatory, if Topic is left blank <b>msg.topic</b> will used. Topic overrides <b>msg.topic</b></p>
|
<p>Topic is not mandatory, if Topic is left blank <b>msg.topic</b> will used. Topic overrides <b>msg.topic</b></p>
|
||||||
<p>Node Group (numeric) is not mandatory, if Node Group is left blank <b>msg.nodegrpup</b> will used. Node overrides <b>msg.nodegrpup</b></p>
|
<p>Node Group (numeric) is not mandatory, if Node Group is left blank <b>msg.nodegrpup</b> will used. Node overrides <b>msg.nodegrpup</b></p>
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
RED.nodes.registerType('emoncms',{
|
RED.nodes.registerType('emoncms',{
|
||||||
category: 'output',
|
category: 'output',
|
||||||
color:"rgb(91, 192, 222)",
|
color:"rgb(91, 192, 222)",
|
||||||
defaults: {
|
defaults: {
|
||||||
name: {value:"Emoncms"},
|
name: {value:"Emoncms"},
|
||||||
emonServer: {type:"emoncms-server", required:true},
|
emonServer: {type:"emoncms-server", required:true},
|
||||||
topic: {value:""},
|
topic: {value:""},
|
||||||
@ -53,7 +53,7 @@
|
|||||||
},
|
},
|
||||||
inputs:1,
|
inputs:1,
|
||||||
outputs:0,
|
outputs:0,
|
||||||
icon: "emoncms-logo.png",
|
icon: "emoncms.png",
|
||||||
align: "right",
|
align: "right",
|
||||||
label: function() {
|
label: function() {
|
||||||
return this.name||this.baseurl;
|
return this.name||this.baseurl;
|
||||||
@ -98,7 +98,7 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
oneditsave: function() {
|
oneditsave: function() {
|
||||||
var newApikey = $('#node-config-input-apikey').val();
|
var newApikey = $('#node-config-input-apikey').val();
|
||||||
var credentials = {};
|
var credentials = {};
|
||||||
credentials.apikey = newApikey;
|
credentials.apikey = newApikey;
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
/**
|
/**
|
||||||
* Copyright 2013 Henrik Olsson henols@gmail.com
|
* Copyright 2013 Henrik Olsson henols@gmail.com
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
|
* 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
|
* use this file except in compliance with the License. You may obtain a copy of
|
||||||
* the License at
|
* the License at
|
||||||
*
|
*
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
*
|
*
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
||||||
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
||||||
@ -22,8 +22,8 @@ function EmoncmsServerNode(n) {
|
|||||||
this.name = n.name;
|
this.name = n.name;
|
||||||
var credentials = RED.nodes.getCredentials(n.id);
|
var credentials = RED.nodes.getCredentials(n.id);
|
||||||
if (credentials) {
|
if (credentials) {
|
||||||
this.apikey = credentials.apikey;
|
this.apikey = credentials.apikey;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
RED.nodes.registerType("emoncms-server",EmoncmsServerNode);
|
RED.nodes.registerType("emoncms-server",EmoncmsServerNode);
|
||||||
@ -64,48 +64,48 @@ RED.app.post('/emoncms-server/:id',function(req,res) {
|
|||||||
});
|
});
|
||||||
|
|
||||||
function Emoncms(n) {
|
function Emoncms(n) {
|
||||||
RED.nodes.createNode(this,n);
|
RED.nodes.createNode(this,n);
|
||||||
this.emonServer = n.emonServer;
|
this.emonServer = n.emonServer;
|
||||||
var sc = RED.nodes.getNode(this.emonServer);
|
var sc = RED.nodes.getNode(this.emonServer);
|
||||||
|
|
||||||
this.baseurl = sc.server;
|
this.baseurl = sc.server;
|
||||||
this.apikey = sc.apikey;
|
this.apikey = sc.apikey;
|
||||||
|
|
||||||
this.topic = n.topic ||"";
|
this.topic = n.topic ||"";
|
||||||
this.nodegroup = n.nodegroup || "";
|
this.nodegroup = n.nodegroup || "";
|
||||||
var node = this;
|
var node = this;
|
||||||
if (this.baseurl.substring(0,5) === "https") { var http = require("https"); }
|
if (this.baseurl.substring(0,5) === "https") { var http = require("https"); }
|
||||||
else { var http = require("http"); }
|
else { var http = require("http"); }
|
||||||
this.on("input", function(msg) {
|
this.on("input", function(msg) {
|
||||||
|
|
||||||
var topic = this.topic || msg.topic;
|
var topic = this.topic || msg.topic;
|
||||||
var nodegroup = this.nodegroup || msg.nodegroup;
|
var nodegroup = this.nodegroup || msg.nodegroup;
|
||||||
this.url = this.baseurl + '/input/post.json?json={' + topic + ':' + msg.payload+'}&apikey='+this.apikey;
|
this.url = this.baseurl + '/input/post.json?json={' + topic + ':' + msg.payload+'}&apikey='+this.apikey;
|
||||||
if(nodegroup != ""){
|
if(nodegroup != ""){
|
||||||
this.url += '&node='+nodegroup;
|
this.url += '&node='+nodegroup;
|
||||||
}
|
}
|
||||||
node.log("[emoncms] "+this.url);
|
node.log("[emoncms] "+this.url);
|
||||||
http.get(this.url, function(res) {
|
http.get(this.url, function(res) {
|
||||||
node.log("Http response: " + res.statusCode);
|
node.log("Http response: " + res.statusCode);
|
||||||
msg.rc = res.statusCode;
|
msg.rc = res.statusCode;
|
||||||
msg.payload = "";
|
msg.payload = "";
|
||||||
if ((msg.rc != 200) && (msg.rc != 404)) {
|
if ((msg.rc != 200) && (msg.rc != 404)) {
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
}
|
}
|
||||||
res.setEncoding('utf8');
|
res.setEncoding('utf8');
|
||||||
res.on('data', function(chunk) {
|
res.on('data', function(chunk) {
|
||||||
msg.payload += chunk;
|
msg.payload += chunk;
|
||||||
});
|
});
|
||||||
res.on('end', function() {
|
res.on('end', function() {
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
}).on('error', function(e) {
|
}).on('error', function(e) {
|
||||||
// node.error(e);
|
// node.error(e);
|
||||||
msg.rc = 503;
|
msg.rc = 503;
|
||||||
msg.payload = e;
|
msg.payload = e;
|
||||||
node.send(msg);
|
node.send(msg);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
RED.nodes.registerType("emoncms",Emoncms);
|
RED.nodes.registerType("emoncms",Emoncms);
|
||||||
|
BIN
io/emoncms/icons/emoncms.png
Normal file
BIN
io/emoncms/icons/emoncms.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 933 B |
Loading…
x
Reference in New Issue
Block a user