mirror of
https://github.com/node-red/node-red-nodes.git
synced 2025-03-01 10:37:43 +00:00
Add i18n content for moved core nodes
This commit is contained in:
@@ -16,26 +16,26 @@
|
||||
|
||||
<script type="text/x-red" data-template-name="mongodb">
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-hostname"><i class="fa fa-bookmark"></i> Host</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" 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="27017" style="width:45px">
|
||||
<label for="node-config-input-port" style="margin-left: 10px; width: 35px; "> <span data-i18n="mongodb.label.port"></span></label>
|
||||
<input type="text" id="node-config-input-port" style="width:45px">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-db"><i class="fa fa-database"></i> Database</label>
|
||||
<input type="text" id="node-config-input-db" placeholder="test">
|
||||
<label for="node-config-input-db"><i class="fa fa-database"></i> <span data-i18n="mongodb.label.database"></span></label>
|
||||
<input type="text" id="node-config-input-db">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-user"><i class="fa fa-user"></i> Username</label>
|
||||
<label for="node-config-input-user"><i class="fa fa-user"></i> <span data-i18n="mongodb.label.username"></span></label>
|
||||
<input type="text" id="node-config-input-user">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-password"><i class="fa fa-lock"></i> Password</label>
|
||||
<label for="node-config-input-password"><i class="fa fa-lock"></i> <span data-i18n="mongodb.label.password"></span></label>
|
||||
<input type="password" id="node-config-input-password">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-config-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-config-input-name" placeholder="Name">
|
||||
<label for="node-config-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
<input type="text" id="node-config-input-name" data-i18n="[placeholder]common.label.name">
|
||||
</div>
|
||||
</script>
|
||||
|
||||
@@ -62,43 +62,42 @@
|
||||
|
||||
<script type="text/x-red" data-template-name="mongodb out">
|
||||
<div class="form-row">
|
||||
<label for="node-input-mongodb"><i class="fa fa-bookmark"></i> Server</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">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-collection"><i class="fa fa-briefcase"></i> Collection</label>
|
||||
<input type="text" id="node-input-collection" placeholder="collection">
|
||||
<label for="node-input-collection"><i class="fa fa-briefcase"></i> <span data-i18n="mongodb.label.collection"></span></label>
|
||||
<input type="text" id="node-input-collection">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-operation"><i class="fa fa-wrench"></i> Operation</label>
|
||||
<label for="node-input-operation"><i class="fa fa-wrench"></i> <span data-i18n="mongodb.label.operation"></span></label>
|
||||
<select type="text" id="node-input-operation" style="display: inline-block; vertical-align: top;">
|
||||
<option value="store">save</option>
|
||||
<option value="insert">insert</option>
|
||||
<option value="update">update</option>
|
||||
<option value="delete">remove</option>
|
||||
<option value="store" data-i18n="mongodb.operation.save"></option>
|
||||
<option value="insert" data-i18n="mongodb.operation.insert"></option>
|
||||
<option value="update" data-i18n="mongodb.operation.update"></option>
|
||||
<option value="delete" data-i18n="mongodb.operation.remove"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row node-input-payonly">
|
||||
<label> </label>
|
||||
<input type="checkbox" id="node-input-payonly" placeholder="Only" style="display: inline-block; width: auto; vertical-align: top;">
|
||||
<label for="node-input-payonly" style="width: 70%;">Only store msg.payload object</label>
|
||||
<input type="checkbox" id="node-input-payonly" style="display: inline-block; width: auto; vertical-align: top;">
|
||||
<label for="node-input-payonly" style="width: 70%;"><span data-i18n="mongodb.label.onlystore"></span></label>
|
||||
</div>
|
||||
<div class="form-row node-input-upsert">
|
||||
<label> </label>
|
||||
<input type="checkbox" id="node-input-upsert" placeholder="Only" style="display: inline-block; width: auto; vertical-align: top;">
|
||||
<label for="node-input-upsert" style="width: 70%;">Create a new document if no match found</label>
|
||||
<input type="checkbox" id="node-input-upsert" style="display: inline-block; width: auto; vertical-align: top;">
|
||||
<label for="node-input-upsert" style="width: 70%;"><span data-i18n="mongodb.label.createnew"></span></label>
|
||||
</div>
|
||||
<div class="form-row node-input-multi">
|
||||
<label> </label>
|
||||
<input type="checkbox" id="node-input-multi" placeholder="Only" style="display: inline-block; width: auto; vertical-align: top;;">
|
||||
<label for="node-input-multi" style="width: 70%;">Update all matching documents</label>
|
||||
<input type="checkbox" id="node-input-multi" style="display: inline-block; width: auto; vertical-align: top;;">
|
||||
<label for="node-input-multi" style="width: 70%;"><span data-i18n="mongodb.label.updateall"></span></label>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-tips" id="node-warning" style="display: none"><b> Tip:</b> If no collection is set, ensure <b>msg.collection</b> will contain the collection name
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
||||
</div>
|
||||
<div class="form-tips" id="node-warning" style="display: none"><span data-i18n="[html]mongodb.tip"></span></div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="mongodb out">
|
||||
@@ -172,27 +171,26 @@
|
||||
|
||||
<script type="text/x-red" data-template-name="mongodb in">
|
||||
<div class="form-row">
|
||||
<label for="node-input-mongodb"><i class="fa fa-bookmark"></i> Server</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">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-collection"><i class="fa fa-briefcase"></i> Collection</label>
|
||||
<input type="text" id="node-input-collection" placeholder="collection">
|
||||
<label for="node-input-collection"><i class="fa fa-briefcase"></i> <span data-i18n="mongodb.label.collection"></span></label>
|
||||
<input type="text" id="node-input-collection">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-operation"><i class="fa fa-wrench"></i> Operation</label>
|
||||
<label for="node-input-operation"><i class="fa fa-wrench"></i> <span data-i18n="mongodb.label.operation"></span></label>
|
||||
<select type="text" id="node-input-operation" style="display: inline-block; vertical-align: top;">
|
||||
<option value="find">find</option>
|
||||
<option value="count">count</option>
|
||||
<option value="aggregate">aggregate</option>
|
||||
<option value="find" data-i18n="mongodb.operation.find"></option>
|
||||
<option value="count" data-i18n="mongodb.operation.count"></option>
|
||||
<option value="aggregate" data-i18n="mongodb.operation.aggregate"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-tips" id="node-warning" style="display: none"><b> Tip:</b> If no collection is set, ensure <b>msg.collection</b> will contain the collection name
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
||||
</div>
|
||||
<div class="form-tips" id="node-warning" style="display: none"><span data-i18n="[html]mongodb.tip"></span></div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="mongodb in">
|
||||
|
@@ -1,5 +1,5 @@
|
||||
/**
|
||||
* Copyright 2013,2015 IBM Corp.
|
||||
* Copyright 2013,2014 IBM Corp.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -76,7 +76,7 @@ module.exports = function(RED) {
|
||||
if (msg.collection) {
|
||||
coll = db.collection(msg.collection);
|
||||
} else {
|
||||
node.error("No collection defined",msg);
|
||||
node.error(RED._("mongodb.errors.nocollection"),msg);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -87,9 +87,6 @@ module.exports = function(RED) {
|
||||
if (typeof msg.payload !== "object") {
|
||||
msg.payload = {"payload": msg.payload};
|
||||
}
|
||||
if (msg.hasOwnProperty("_id") && !msg.payload.hasOwnProperty("_id")) {
|
||||
msg.payload._id = msg._id;
|
||||
}
|
||||
coll.save(msg.payload,function(err, item) {
|
||||
if (err) {
|
||||
node.error(err,msg);
|
||||
@@ -107,9 +104,6 @@ module.exports = function(RED) {
|
||||
if (typeof msg.payload !== "object") {
|
||||
msg.payload = {"payload": msg.payload};
|
||||
}
|
||||
if (msg.hasOwnProperty("_id") && !msg.payload.hasOwnProperty("_id")) {
|
||||
msg.payload._id = msg._id;
|
||||
}
|
||||
coll.insert(msg.payload, function(err, item) {
|
||||
if (err) {
|
||||
node.error(err,msg);
|
||||
@@ -149,7 +143,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.error("missing mongodb configuration");
|
||||
this.error(RED._("mongodb.errors.missingconfig"));
|
||||
}
|
||||
|
||||
this.on("close", function() {
|
||||
@@ -169,6 +163,7 @@ module.exports = function(RED) {
|
||||
|
||||
if (this.mongoConfig) {
|
||||
var node = this;
|
||||
var selector;
|
||||
MongoClient.connect(this.mongoConfig.url, function(err,db) {
|
||||
if (err) {
|
||||
node.error(err);
|
||||
@@ -183,11 +178,10 @@ module.exports = function(RED) {
|
||||
if (msg.collection) {
|
||||
coll = db.collection(msg.collection);
|
||||
} else {
|
||||
node.error("No collection defined");
|
||||
node.error(RED._("mongodb.errors.nocollection"));
|
||||
return;
|
||||
}
|
||||
}
|
||||
var selector;
|
||||
if (node.operation === "find") {
|
||||
msg.projection = msg.projection || {};
|
||||
selector = ensureValidSelectorObject(msg.payload);
|
||||
@@ -237,7 +231,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
});
|
||||
} else {
|
||||
this.error("missing mongodb configuration");
|
||||
this.error(RED._("mongodb.errors.missingconfig"));
|
||||
}
|
||||
|
||||
this.on("close", function() {
|
||||
|
31
storage/mongodb/locales/en-US/66-mongodb.json
Normal file
31
storage/mongodb/locales/en-US/66-mongodb.json
Normal file
@@ -0,0 +1,31 @@
|
||||
{
|
||||
"mongodb": {
|
||||
"label": {
|
||||
"host": "Host",
|
||||
"port": "Port",
|
||||
"database": "Database",
|
||||
"username": "Username",
|
||||
"password": "Password",
|
||||
"server": "Server",
|
||||
"collection": "Collection",
|
||||
"operation": "Operation",
|
||||
"onlystore": "Only store msg.payload object",
|
||||
"createnew": "Create a new document if no match found",
|
||||
"updateall": "Update all matching documents"
|
||||
},
|
||||
"operation": {
|
||||
"save": "save",
|
||||
"insert": "insert",
|
||||
"update": "update",
|
||||
"remove": "remove",
|
||||
"find": "find",
|
||||
"count": "count",
|
||||
"aggregate": "aggregate"
|
||||
},
|
||||
"tip": "<b> Tip:</b> If no collection is set, ensure <b>msg.collection</b> will contain the collection name",
|
||||
"errors": {
|
||||
"nocollection": "No collection defined",
|
||||
"missingconfig": "missing mongodb configuration"
|
||||
}
|
||||
}
|
||||
}
|
@@ -16,32 +16,29 @@
|
||||
|
||||
<script type="text/x-red" data-template-name="redis out">
|
||||
<div class="form-row node-input-hostname">
|
||||
<label for="node-input-hostname"><i class="fa fa-bookmark"></i> Host</label>
|
||||
<label for="node-input-hostname"><i class="fa fa-bookmark"></i> <span data-i18n="redisout.label.host"></span></label>
|
||||
<input class="input-append-left" type="text" id="node-input-hostname" placeholder="127.0.0.1" style="width: 40%;" ><button id="node-input-hostname-lookup" class="btn input-append-right"><span class="caret"></span></button>
|
||||
<label for="node-input-port" style="margin-left: 10px; width: 35px; "> Port</label>
|
||||
<label for="node-input-port" style="margin-left: 10px; width: 35px; "> <span data-i18n="redisout.label.port"></span></label>
|
||||
<input type="text" id="node-input-port" placeholder="6379" style="width:45px">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-key"><i class="fa fa-key"></i> Key</label>
|
||||
<input type="text" id="node-input-key" placeholder="Redis Key">
|
||||
<label for="node-input-key"><i class="fa fa-key"></i> <span data-i18n="redisout.label.key"></span></label>
|
||||
<input type="text" id="node-input-key">
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-type"><i class="fa fa-th"></i> Type</label>
|
||||
<label for="node-input-type"><i class="fa fa-th"></i> <span data-i18n="redisout.label.type"></span></label>
|
||||
<select type="text" id="node-input-structtype" style="width: 150px;">
|
||||
<option value="string">String</option>
|
||||
<option value="hash">Hash</option>
|
||||
<option value="set">Set</option>
|
||||
<option value="list">List</option>
|
||||
<option value="string" data-i18n="redisout.type.string"></option>
|
||||
<option value="hash" data-i18n="redisout.type.hash"></option>
|
||||
<option value="set" data-i18n="redisout.type.set"></option>
|
||||
<option value="list" data-i18n="redisout.type.list"></option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> Name</label>
|
||||
<input type="text" id="node-input-name" placeholder="Name">
|
||||
</div>
|
||||
<div class="form-tips">
|
||||
If key is blank, the topic will be used as the key.<br>
|
||||
If type is hash, payload should be an object or field=value string.
|
||||
<label for="node-input-name"><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
|
||||
<input type="text" id="node-input-name" data-i18n="[placeholder]common.label.name">
|
||||
</div>
|
||||
<div class="form-tips"><span data-i18n="[html]redisout.tip"></span></div>
|
||||
</script>
|
||||
|
||||
<script type="text/x-red" data-help-name="redis out">
|
||||
|
@@ -20,7 +20,7 @@ module.exports = function(RED) {
|
||||
|
||||
var hashFieldRE = /^([^=]+)=(.*)$/;
|
||||
|
||||
var redisConnectionPool = (function() {
|
||||
var redisConnectionPool = function() {
|
||||
var connections = {};
|
||||
var obj = {
|
||||
get: function(host,port) {
|
||||
@@ -30,9 +30,6 @@ module.exports = function(RED) {
|
||||
connections[id].on("error",function(err) {
|
||||
RED.log.error(err);
|
||||
});
|
||||
connections[id].on("connect",function() {
|
||||
if (RED.settings.verbose) { RED.log.info("connected to "+host+":"+port); }
|
||||
});
|
||||
connections[id]._id = id;
|
||||
connections[id]._nodeCount = 0;
|
||||
}
|
||||
@@ -51,7 +48,7 @@ module.exports = function(RED) {
|
||||
}
|
||||
};
|
||||
return obj;
|
||||
}());
|
||||
}();
|
||||
|
||||
|
||||
function RedisOutNode(n) {
|
||||
@@ -64,17 +61,17 @@ module.exports = function(RED) {
|
||||
this.client = redisConnectionPool.get(this.hostname,this.port);
|
||||
|
||||
if (this.client.connected) {
|
||||
this.status({fill:"green",shape:"dot",text:"connected"});
|
||||
this.status({fill:"green",shape:"dot",text:RED._("common.status.connected")});
|
||||
} else {
|
||||
this.status({fill:"red",shape:"ring",text:"disconnected"},true);
|
||||
this.status({fill:"red",shape:"ring",text:RED._("common.status.disconnected")},true);
|
||||
}
|
||||
|
||||
var node = this;
|
||||
this.client.on("end", function() {
|
||||
node.status({fill:"red",shape:"ring",text:"disconnected"});
|
||||
node.status({fill:"red",shape:"ring",text:RED._("common.status.disconnected")});
|
||||
});
|
||||
this.client.on("connect", function() {
|
||||
node.status({fill:"green",shape:"dot",text:"connected"});
|
||||
node.status({fill:"green",shape:"dot",text:RED._("common.status.connected")});
|
||||
});
|
||||
|
||||
this.on("input", function(msg) {
|
||||
@@ -90,7 +87,7 @@ module.exports = function(RED) {
|
||||
if (r) {
|
||||
this.client.hset(k,r[1],r[2]);
|
||||
} else {
|
||||
this.warn("Invalid payload for redis hash");
|
||||
this.warn(RED._("redisout.errors.invalidpayload"));
|
||||
}
|
||||
}
|
||||
} else if (this.structtype == "set") {
|
||||
@@ -99,7 +96,7 @@ module.exports = function(RED) {
|
||||
this.client.rpush(k,msg.payload);
|
||||
}
|
||||
} else {
|
||||
this.warn("No key or topic set");
|
||||
this.warn(RED._("redisout.errors.nokey"));
|
||||
}
|
||||
});
|
||||
this.on("close", function() {
|
||||
|
21
storage/redis/locales/en-US/65-redisout.json
Normal file
21
storage/redis/locales/en-US/65-redisout.json
Normal file
@@ -0,0 +1,21 @@
|
||||
{
|
||||
"redisout": {
|
||||
"label": {
|
||||
"host": "Host",
|
||||
"port": "Port",
|
||||
"key": "Key",
|
||||
"type": "Type"
|
||||
},
|
||||
"type": {
|
||||
"string": "String",
|
||||
"hash": "Hash",
|
||||
"set": "Set",
|
||||
"list": "List"
|
||||
},
|
||||
"tip": "If key is blank, the topic will be used as the key.<br>If type is hash, payload should be an object or field=value string.",
|
||||
"errors": {
|
||||
"invalidpayload": "Invalid payload for redis hash",
|
||||
"nokey": "No key or topic set"
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user