mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02: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">
|
||||
</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>
|
||||
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 type="text/x-red" data-help-name="emoncms">
|
||||
<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>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>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>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 type="text/javascript">
|
||||
RED.nodes.registerType('emoncms',{
|
||||
category: 'output',
|
||||
color:"rgb(91, 192, 222)",
|
||||
defaults: {
|
||||
defaults: {
|
||||
name: {value:"Emoncms"},
|
||||
emonServer: {type:"emoncms-server", required:true},
|
||||
topic: {value:""},
|
||||
@ -53,7 +53,7 @@
|
||||
},
|
||||
inputs:1,
|
||||
outputs:0,
|
||||
icon: "emoncms-logo.png",
|
||||
icon: "emoncms.png",
|
||||
align: "right",
|
||||
label: function() {
|
||||
return this.name||this.baseurl;
|
||||
@ -98,7 +98,7 @@
|
||||
}
|
||||
});
|
||||
},
|
||||
oneditsave: function() {
|
||||
oneditsave: function() {
|
||||
var newApikey = $('#node-config-input-apikey').val();
|
||||
var credentials = {};
|
||||
credentials.apikey = newApikey;
|
||||
|
@ -1,12 +1,12 @@
|
||||
/**
|
||||
* Copyright 2013 Henrik Olsson henols@gmail.com
|
||||
*
|
||||
*
|
||||
* 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
|
||||
@ -22,8 +22,8 @@ function EmoncmsServerNode(n) {
|
||||
this.name = n.name;
|
||||
var credentials = RED.nodes.getCredentials(n.id);
|
||||
if (credentials) {
|
||||
this.apikey = credentials.apikey;
|
||||
}
|
||||
this.apikey = credentials.apikey;
|
||||
}
|
||||
|
||||
}
|
||||
RED.nodes.registerType("emoncms-server",EmoncmsServerNode);
|
||||
@ -64,48 +64,48 @@ RED.app.post('/emoncms-server/:id',function(req,res) {
|
||||
});
|
||||
|
||||
function Emoncms(n) {
|
||||
RED.nodes.createNode(this,n);
|
||||
RED.nodes.createNode(this,n);
|
||||
this.emonServer = n.emonServer;
|
||||
var sc = RED.nodes.getNode(this.emonServer);
|
||||
|
||||
this.baseurl = sc.server;
|
||||
this.apikey = sc.apikey;
|
||||
this.baseurl = sc.server;
|
||||
this.apikey = sc.apikey;
|
||||
|
||||
this.topic = n.topic ||"";
|
||||
this.nodegroup = n.nodegroup || "";
|
||||
var node = this;
|
||||
if (this.baseurl.substring(0,5) === "https") { var http = require("https"); }
|
||||
else { var http = require("http"); }
|
||||
this.on("input", function(msg) {
|
||||
|
||||
var topic = this.topic || msg.topic;
|
||||
var nodegroup = this.nodegroup || msg.nodegroup;
|
||||
this.url = this.baseurl + '/input/post.json?json={' + topic + ':' + msg.payload+'}&apikey='+this.apikey;
|
||||
if(nodegroup != ""){
|
||||
this.url += '&node='+nodegroup;
|
||||
}
|
||||
node.log("[emoncms] "+this.url);
|
||||
http.get(this.url, function(res) {
|
||||
node.log("Http response: " + res.statusCode);
|
||||
msg.rc = res.statusCode;
|
||||
msg.payload = "";
|
||||
if ((msg.rc != 200) && (msg.rc != 404)) {
|
||||
node.send(msg);
|
||||
}
|
||||
res.setEncoding('utf8');
|
||||
res.on('data', function(chunk) {
|
||||
msg.payload += chunk;
|
||||
});
|
||||
res.on('end', function() {
|
||||
node.send(msg);
|
||||
});
|
||||
}).on('error', function(e) {
|
||||
// node.error(e);
|
||||
msg.rc = 503;
|
||||
msg.payload = e;
|
||||
node.send(msg);
|
||||
});
|
||||
});
|
||||
this.topic = n.topic ||"";
|
||||
this.nodegroup = n.nodegroup || "";
|
||||
var node = this;
|
||||
if (this.baseurl.substring(0,5) === "https") { var http = require("https"); }
|
||||
else { var http = require("http"); }
|
||||
this.on("input", function(msg) {
|
||||
|
||||
var topic = this.topic || msg.topic;
|
||||
var nodegroup = this.nodegroup || msg.nodegroup;
|
||||
this.url = this.baseurl + '/input/post.json?json={' + topic + ':' + msg.payload+'}&apikey='+this.apikey;
|
||||
if(nodegroup != ""){
|
||||
this.url += '&node='+nodegroup;
|
||||
}
|
||||
node.log("[emoncms] "+this.url);
|
||||
http.get(this.url, function(res) {
|
||||
node.log("Http response: " + res.statusCode);
|
||||
msg.rc = res.statusCode;
|
||||
msg.payload = "";
|
||||
if ((msg.rc != 200) && (msg.rc != 404)) {
|
||||
node.send(msg);
|
||||
}
|
||||
res.setEncoding('utf8');
|
||||
res.on('data', function(chunk) {
|
||||
msg.payload += chunk;
|
||||
});
|
||||
res.on('end', function() {
|
||||
node.send(msg);
|
||||
});
|
||||
}).on('error', function(e) {
|
||||
// node.error(e);
|
||||
msg.rc = 503;
|
||||
msg.payload = e;
|
||||
node.send(msg);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
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