dependency to node-red-contrib-postgres

development
Vincent Schoonenburg 2018-12-04 12:57:54 +01:00
parent 19d3c5927d
commit 96cf58b9a6
4 changed files with 11 additions and 75 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="WEB_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="true">
<exclude-output />
<content url="file://$MODULE_DIR$" />
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
</component>
</module>

View File

@ -3,7 +3,8 @@
"version": "0.1.0",
"description": "A Node-RED node to listen to pg_notify",
"dependencies": {
"pg": "6.1.5"
"pg": "~7.4.1",
"node-red-contrib-postgres": "~0.6.1"
},
"repository": {
"type": "git",

View File

@ -14,59 +14,6 @@
limitations under the License.
-->
<script type="text/x-red" data-template-name="postgresdb">
<p>Connection can be set up by either defining a full or partial connection string, or specific connection parameters</p>
<div class="form-row">
<label for="node-config-input-connectionstring"><i class="fa fa-bookmark"></i> Connection String</label>
<input class="input-append-left" type="text" id="node-config-input-connectionstring" >
</div>
<div class="form-row">
<label for="node-config-input-hostname"><i class="fa fa-bookmark"></i> Host</label>
<input class="input-append-left" type="text" id="node-config-input-hostname" placeholder="localhost" style="width: 40%;" >
<label for="node-config-input-port" style="margin-left: 10px; width: 35px; "> Port</label>
<input type="text" id="node-config-input-port" placeholder="5432" style="width:45px">
</div>
<div class="form-row">
<label for="node-config-input-db"><i class="fa fa-briefcase"></i> Database</label>
<input type="text" id="node-config-input-db" placeholder="test">
</div>
<div class="form-row">
<label for="node-config-input-user"><i class="fa fa-user"></i> Username</label>
<input type="text" id="node-config-input-user" placeholder="postgres">
</div>
<div class="form-row">
<label for="node-config-input-password"><i class="fa fa-lock"></i> Password</label>
<input type="password" id="node-config-input-password" placeholder="postgres">
</div>
<div class="form-row">
<label>&nbsp;</label>
<input type="checkbox" id="node-config-input-ssl" style="display: inline-block; width: auto; vertical-align: top;">
<label for="node-config-input-ssl" style="width: 70%;">Use SSL</label>
</div>
</script>
<script type="text/javascript">
(function() {
RED.nodes.registerType('postgresdb',{
category: 'config',
color:"rgb(218, 196, 180)",
defaults: {
connectionstring : {value:""},
hostname: { value:"localhost"},
port: { value: 5432},
db: { value:"postgres"},
ssl: { value:false }
},
credentials: {
user: {type: "text"},
password: {type: "password"}
},
label: function() {
return this.name|| this.connectionstring || this.hostname+":"+this.port+"/"+this.db;
}
});
})();
</script>
<script type="text/x-red" data-template-name="PG Listen">
<div class="form-row">

View File

@ -82,21 +82,6 @@ module.exports = function(RED) {
}
function PostgresDatabaseNode(n) {
RED.nodes.createNode(this,n);
this.hostname = n.hostname;
this.port = n.port;
this.db = n.db;
this.ssl = n.ssl;
this.connectionString = n.connectionstring;
var credentials = this.credentials;
if (credentials) {
this.user = credentials.user;
this.password = credentials.password;
}
}
function PostgresArrayNode(n) {
RED.nodes.createNode(this,n);
@ -108,12 +93,6 @@ module.exports = function(RED) {
}
}
try {
RED.nodes.registerType("postgresdb",PostgresDatabaseNode,{
credentials: {
user: {type:"text"},
password: {type: "password"}
}
});
RED.nodes.registerType("postgresarray",PostgresArrayNode);
} catch (e) {