1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Linting and bump package for new clustered PR.

This commit is contained in:
Dave Conway-Jones 2020-09-17 09:21:50 +01:00
parent cde422f34a
commit c21fb22918
No known key found for this signature in database
GPG Key ID: 302A6725C594817F
3 changed files with 17 additions and 20 deletions

View File

@ -1,6 +1,5 @@
<script type="text/html" data-template-name="mongodb">
<script type="text/x-red" data-template-name="mongodb">
<div class="form-row"> <div class="form-row">
<label for="node-config-input-hostname"><i class="fa fa-bookmark"></i><span data-i18n="mongodb.label.host"></span></label> <label for="node-config-input-hostname"><i class="fa fa-bookmark"></i><span data-i18n="mongodb.label.host"></span></label>
<input class="input-append-left" type="text" id="node-config-input-hostname" placeholder="localhost"> <input class="input-append-left" type="text" id="node-config-input-hostname" placeholder="localhost">
@ -75,7 +74,7 @@
}); });
</script> </script>
<script type="text/x-red" data-help-name="mongodb"> <script type="text/html" data-help-name="mongodb">
<p>Define a connection method to your MongoDB server instance.</p> <p>Define a connection method to your MongoDB server instance.</p>
<p>There are 3 supported options: <p>There are 3 supported options:
<details><summary>Standard/direct</summary> <details><summary>Standard/direct</summary>
@ -113,7 +112,7 @@
to the <strong>Connect options</strong>. to the <strong>Connect options</strong>.
</script> </script>
<script type="text/x-red" data-template-name="mongodb out"> <script type="text/html" data-template-name="mongodb out">
<div class="form-row"> <div class="form-row">
<label for="node-input-mongodb"><i class="fa fa-bookmark"></i> <span data-i18n="mongodb.label.server"></span></label> <label for="node-input-mongodb"><i class="fa fa-bookmark"></i> <span data-i18n="mongodb.label.server"></span></label>
<input type="text" id="node-input-mongodb"> <input type="text" id="node-input-mongodb">
@ -153,7 +152,7 @@
<div class="form-tips" id="node-warning" style="display: none"><span data-i18n="[html]mongodb.tip"></span></div> <div class="form-tips" id="node-warning" style="display: none"><span data-i18n="[html]mongodb.tip"></span></div>
</script> </script>
<script type="text/x-red" data-help-name="mongodb out"> <script type="text/html" data-help-name="mongodb out">
<p>A simple MongoDB output node. Can save, insert, update and remove objects from a chosen collection.</p> <p>A simple MongoDB output node. Can save, insert, update and remove objects from a chosen collection.</p>
<p>Save will update an existing object or insert a new object if one does not already exist.</p> <p>Save will update an existing object or insert a new object if one does not already exist.</p>
<p>Insert will insert a new object.</p> <p>Insert will insert a new object.</p>
@ -175,7 +174,6 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
function oneditprepare() { function oneditprepare() {
$("#node-input-operation").change(function () { $("#node-input-operation").change(function () {
var id = $("#node-input-operation option:selected").val(); var id = $("#node-input-operation option:selected").val();
@ -228,7 +226,7 @@
</script> </script>
<script type="text/x-red" data-template-name="mongodb in"> <script type="text/html" data-template-name="mongodb in">
<div class="form-row"> <div class="form-row">
<label for="node-input-mongodb"><i class="fa fa-bookmark"></i> <span data-i18n="mongodb.label.server"></span></label> <label for="node-input-mongodb"><i class="fa fa-bookmark"></i> <span data-i18n="mongodb.label.server"></span></label>
<input type="text" id="node-input-mongodb"> <input type="text" id="node-input-mongodb">
@ -252,7 +250,7 @@
<div class="form-tips" id="node-warning" style="display: none"><span data-i18n="[html]mongodb.tip"></span></div> <div class="form-tips" id="node-warning" style="display: none"><span data-i18n="[html]mongodb.tip"></span></div>
</script> </script>
<script type="text/x-red" data-help-name="mongodb in"> <script type="text/html" data-help-name="mongodb in">
<p>Calls a MongoDB collection method based on the selected operator.</p> <p>Calls a MongoDB collection method based on the selected operator.</p>
<p>Find queries a collection using the <code>msg.payload</code> as the query statement as per the .find() function. <p>Find queries a collection using the <code>msg.payload</code> as the query statement as per the .find() function.
Optionally, you may also (via a function) set a <code>msg.projection</code> object to constrain the returned Optionally, you may also (via a function) set a <code>msg.projection</code> object to constrain the returned
@ -268,7 +266,6 @@
</script> </script>
<script type="text/javascript"> <script type="text/javascript">
RED.nodes.registerType('mongodb in', { RED.nodes.registerType('mongodb in', {
category: 'storage-input', category: 'storage-input',
color: "rgb(218, 196, 180)", color: "rgb(218, 196, 180)",

View File

@ -21,25 +21,25 @@ module.exports = function(RED) {
var url = "mongodb://"; var url = "mongodb://";
if (this.topology === "dnscluster") { if (this.topology === "dnscluster") {
url = "mongodb+srv://"; url = "mongodb+srv://";
} }
if (this.credentials && this.credentials.user && this.credentials.password) { if (this.credentials && this.credentials.user && this.credentials.password) {
this.user = this.credentials.user; this.user = this.credentials.user;
this.password = this.credentials.password; this.password = this.credentials.password;
} else { } else {
this.user = n.user; this.user = n.user;
this.password = n.password; this.password = n.password;
} }
if (this.user) { if (this.user) {
url += this.user+":"+this.password+"@"; url += this.user+":"+this.password+"@";
} }
if (clustered) { if (clustered) {
url += this.hostname + "/" + this.db url += this.hostname + "/" + this.db
} else { } else {
url += this.hostname + ":" + this.port + "/" + this.db; url += this.hostname + ":" + this.port + "/" + this.db;
} }
if (this.connectOptions){ if (this.connectOptions){
url += "?" + this.connectOptions; url += "?" + this.connectOptions;
} }
console.log("MongoDB URL: " + url); console.log("MongoDB URL: " + url);

View File

@ -1,9 +1,9 @@
{ {
"name" : "node-red-node-mongodb", "name" : "node-red-node-mongodb",
"version" : "0.1.0", "version" : "0.2.0",
"description" : "Node-RED nodes to talk to an Mongo database", "description" : "Node-RED nodes to talk to an Mongo database",
"dependencies" : { "dependencies" : {
"mongodb" : "^3.6.1" "mongodb" : "^3.6.2"
}, },
"repository" : { "repository" : {
"type":"git", "type":"git",