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

Tidy up of editor i18n messages

This commit is contained in:
Nick O'Leary 2015-06-30 23:42:03 +01:00
parent bc76499957
commit c47da013ff
17 changed files with 530 additions and 515 deletions

View File

@ -13,16 +13,16 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
**/ **/
RED.comms = (function() { RED.comms = (function() {
var errornotification = null; var errornotification = null;
var clearErrorTimer = null; var clearErrorTimer = null;
var subscriptions = {}; var subscriptions = {};
var ws; var ws;
var pendingAuth = false; var pendingAuth = false;
function connectWS() { function connectWS() {
var path = location.hostname; var path = location.hostname;
var port = location.port; var port = location.port;
@ -32,10 +32,10 @@ RED.comms = (function() {
path = path+document.location.pathname; path = path+document.location.pathname;
path = path+(path.slice(-1) == "/"?"":"/")+"comms"; path = path+(path.slice(-1) == "/"?"":"/")+"comms";
path = "ws"+(document.location.protocol=="https:"?"s":"")+"://"+path; path = "ws"+(document.location.protocol=="https:"?"s":"")+"://"+path;
var auth_tokens = RED.settings.get("auth-tokens"); var auth_tokens = RED.settings.get("auth-tokens");
pendingAuth = (auth_tokens!=null); pendingAuth = (auth_tokens!=null);
function completeConnection() { function completeConnection() {
for (var t in subscriptions) { for (var t in subscriptions) {
if (subscriptions.hasOwnProperty(t)) { if (subscriptions.hasOwnProperty(t)) {
@ -43,7 +43,7 @@ RED.comms = (function() {
} }
} }
} }
ws = new WebSocket(path); ws = new WebSocket(path);
ws.onopen = function() { ws.onopen = function() {
if (errornotification) { if (errornotification) {
@ -81,7 +81,7 @@ RED.comms = (function() {
}; };
ws.onclose = function() { ws.onclose = function() {
if (errornotification == null) { if (errornotification == null) {
errornotification = RED.notify(RED._("notification.lostConnectionError"),"error",true); errornotification = RED.notify(RED._("notification.error",{message:RED._("notification.errors.lostConnection")}),"error",true);
} else if (clearErrorTimer) { } else if (clearErrorTimer) {
clearTimeout(clearErrorTimer); clearTimeout(clearErrorTimer);
clearErrorTimer = null; clearErrorTimer = null;
@ -89,7 +89,7 @@ RED.comms = (function() {
setTimeout(connectWS,1000); setTimeout(connectWS,1000);
} }
} }
function subscribe(topic,callback) { function subscribe(topic,callback) {
if (subscriptions[topic] == null) { if (subscriptions[topic] == null) {
subscriptions[topic] = []; subscriptions[topic] = [];
@ -99,7 +99,7 @@ RED.comms = (function() {
ws.send(JSON.stringify({subscribe:topic})); ws.send(JSON.stringify({subscribe:topic}));
} }
} }
function unsubscribe(topic,callback) { function unsubscribe(topic,callback) {
if (subscriptions[topic]) { if (subscriptions[topic]) {
for (var i=0;i<subscriptions[topic].length;i++) { for (var i=0;i<subscriptions[topic].length;i++) {
@ -113,7 +113,7 @@ RED.comms = (function() {
} }
} }
} }
return { return {
connect: connectWS, connect: connectWS,
subscribe: subscribe, subscribe: subscribe,

View File

@ -19,7 +19,7 @@ var RED = (function() {
function loadLocales() { function loadLocales() {
RED.i18n.init(loadEditor); RED.i18n.init(loadEditor);
} }
function loadNodeList() { function loadNodeList() {
$.ajax({ $.ajax({
headers: { headers: {
@ -29,7 +29,7 @@ var RED = (function() {
url: 'nodes', url: 'nodes',
success: function(data) { success: function(data) {
RED.nodes.setNodeList(data); RED.nodes.setNodeList(data);
var nsCount = 0; var nsCount = 0;
for(var i=0;i<data.length;i++) { for(var i=0;i<data.length;i++) {
var ns = data[i]; var ns = data[i];
@ -60,8 +60,8 @@ var RED = (function() {
success: function(data) { success: function(data) {
$("body").append(data); $("body").append(data);
$("body").i18n(); $("body").i18n();
$(".palette-spinner").hide(); $(".palette-spinner").hide();
$(".palette-scroll").show(); $(".palette-scroll").show();
$("#palette-search").show(); $("#palette-search").show();
@ -110,7 +110,7 @@ var RED = (function() {
} }
if (addedTypes.length) { if (addedTypes.length) {
typeList = "<ul><li>"+addedTypes.join("</li><li>")+"</li></ul>"; typeList = "<ul><li>"+addedTypes.join("</li><li>")+"</li></ul>";
RED.notify(RED._("notification.nodeAdded", {count:addedTypes.length})+typeList,"success"); RED.notify(RED._("palette.event.nodeAdded", {count:addedTypes.length})+typeList,"success");
} }
} else if (topic == "node/removed") { } else if (topic == "node/removed") {
for (i=0;i<msg.length;i++) { for (i=0;i<msg.length;i++) {
@ -118,7 +118,7 @@ var RED = (function() {
info = RED.nodes.removeNodeSet(m.id); info = RED.nodes.removeNodeSet(m.id);
if (info.added) { if (info.added) {
typeList = "<ul><li>"+m.types.join("</li><li>")+"</li></ul>"; typeList = "<ul><li>"+m.types.join("</li><li>")+"</li></ul>";
RED.notify(RED._("notification.nodeRemoved", {count:m.types.length})+typeList,"success"); RED.notify(RED._("palette.event.nodeRemoved", {count:m.types.length})+typeList,"success");
} }
} }
} else if (topic == "node/enabled") { } else if (topic == "node/enabled") {
@ -127,12 +127,12 @@ var RED = (function() {
if (info.added) { if (info.added) {
RED.nodes.enableNodeSet(msg.id); RED.nodes.enableNodeSet(msg.id);
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>"; typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
RED.notify(RED._("notification.nodeEnabled", {count:msg.types.length})+typeList,"success"); RED.notify(RED._("palette.event.nodeEnabled", {count:msg.types.length})+typeList,"success");
} else { } else {
$.get('nodes/'+msg.id, function(data) { $.get('nodes/'+msg.id, function(data) {
$("body").append(data); $("body").append(data);
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>"; typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
RED.notify(RED._("notification.nodeAdded", {count:msg.types.length})+typeList,"success"); RED.notify(RED._("palette.event.nodeAdded", {count:msg.types.length})+typeList,"success");
}); });
} }
} }
@ -140,7 +140,7 @@ var RED = (function() {
if (msg.types) { if (msg.types) {
RED.nodes.disableNodeSet(msg.id); RED.nodes.disableNodeSet(msg.id);
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>"; typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
RED.notify(RED._("notfication.nodeDisabled", {count:msg.types.length})+typeList,"success"); RED.notify(RED._("palette.event.nodeDisabled", {count:msg.types.length})+typeList,"success");
} }
} }
}); });
@ -153,7 +153,7 @@ var RED = (function() {
statusEnabled = state; statusEnabled = state;
RED.view.status(statusEnabled); RED.view.status(statusEnabled);
} }
function loadEditor() { function loadEditor() {
RED.menu.init({id:"btn-sidemenu", RED.menu.init({id:"btn-sidemenu",
options: [ options: [
@ -190,9 +190,9 @@ var RED = (function() {
} }
] ]
}); });
RED.user.init(); RED.user.init();
RED.library.init(); RED.library.init();
RED.palette.init(); RED.palette.init();
RED.sidebar.init(); RED.sidebar.init();
@ -201,9 +201,9 @@ var RED = (function() {
RED.clipboard.init(); RED.clipboard.init();
RED.view.init(); RED.view.init();
RED.editor.init(); RED.editor.init();
RED.deploy.init(RED.settings.theme("deployButton",null)); RED.deploy.init(RED.settings.theme("deployButton",null));
RED.keyboard.add(/* ? */ 191,{shift:true},function(){RED.keyboard.showHelp();d3.event.preventDefault();}); RED.keyboard.add(/* ? */ 191,{shift:true},function(){RED.keyboard.showHelp();d3.event.preventDefault();});
RED.comms.connect(); RED.comms.connect();
@ -214,11 +214,11 @@ var RED = (function() {
} }
$(function() { $(function() {
if ((window.location.hostname !== "localhost") && (window.location.hostname !== "127.0.0.1")) { if ((window.location.hostname !== "localhost") && (window.location.hostname !== "127.0.0.1")) {
document.title = document.title+" : "+window.location.hostname; document.title = document.title+" : "+window.location.hostname;
} }
ace.require("ace/ext/language_tools"); ace.require("ace/ext/language_tools");
RED.settings.init(loadLocales); RED.settings.init(loadLocales);

View File

@ -133,7 +133,8 @@ RED.nodes = (function() {
}, },
removeNodeType: function(nt) { removeNodeType: function(nt) {
if (nt.substring(0,8) != "subflow:") { if (nt.substring(0,8) != "subflow:") {
throw new Error(RED._("error.apiSubflowOnly"),nt); // NON-NLS - internal debug message
throw new Error("this api is subflow only. called with:",nt);
} }
delete nodeDefinitions[nt]; delete nodeDefinitions[nt];
RED.palette.remove(nt); RED.palette.remove(nt);
@ -549,7 +550,7 @@ RED.nodes = (function() {
try { try {
newNodes = JSON.parse(newNodesObj); newNodes = JSON.parse(newNodesObj);
} catch(err) { } catch(err) {
var e = new Error(RED._("error.invalidFlow")+err.message); var e = new Error(RED._("clipboard.invalidFlow",{message:err.message}));
e.code = "NODE_RED"; e.code = "NODE_RED";
throw e; throw e;
} }
@ -576,8 +577,7 @@ RED.nodes = (function() {
if (unknownTypes.length > 0) { if (unknownTypes.length > 0) {
var typeList = "<ul><li>"+unknownTypes.join("</li><li>")+"</li></ul>"; var typeList = "<ul><li>"+unknownTypes.join("</li><li>")+"</li></ul>";
var type = "type"+(unknownTypes.length > 1?"s":""); var type = "type"+(unknownTypes.length > 1?"s":"");
RED.notify("<strong>"+RED._("notification.importUnrecognised")+type+":</strong>"+typeList,"error",false,10000); RED.notify("<strong>"+RED._("clipboard.importUnrecognised",{count:unknownTypes.length})+"</strong>"+typeList,"error",false,10000);
//"DO NOT DEPLOY while in this state.<br/>Either, add missing types to Node-RED, restart and then reload page,<br/>or delete unknown "+n.name+", rewire as required, and then deploy.","error");
} }
var activeWorkspace = RED.workspaces.active(); var activeWorkspace = RED.workspaces.active();
@ -589,17 +589,16 @@ RED.nodes = (function() {
var subflowId = m[1]; var subflowId = m[1];
var err; var err;
if (subflowId === activeSubflow.id) { if (subflowId === activeSubflow.id) {
err = new Error(RED._("error.cannotAddSubflowToItself")); err = new Error(RED._("notification.errors.cannotAddSubflowToItself"));
} }
if (subflowContains(m[1],activeSubflow.id)) { if (subflowContains(m[1],activeSubflow.id)) {
err = new Error(RED._("error.cannotAddCircularReference")); err = new Error(RED._("notification.errors.cannotAddCircularReference"));
} }
if (err) { if (err) {
// TODO: standardise error codes // TODO: standardise error codes
err.code = "NODE_RED"; err.code = "NODE_RED";
throw err; throw err;
} }
} }
} }
} }

View File

@ -21,7 +21,7 @@ RED.clipboard = (function() {
var dialogContainer; var dialogContainer;
var exportNodesDialog; var exportNodesDialog;
var importNodesDialog; var importNodesDialog;
function setupDialogs(){ function setupDialogs(){
dialog = $('<div id="clipboard-dialog" class="hide"><form class="dialog-form form-horizontal"></form></div>') dialog = $('<div id="clipboard-dialog" class="hide"><form class="dialog-form form-horizontal"></form></div>')
.appendTo("body") .appendTo("body")
@ -33,7 +33,7 @@ RED.clipboard = (function() {
buttons: [ buttons: [
{ {
id: "clipboard-dialog-ok", id: "clipboard-dialog-ok",
text: RED._("dialog.ok"), text: RED._("common.label.ok"),
click: function() { click: function() {
if (/Import/.test(dialog.dialog("option","title"))) { if (/Import/.test(dialog.dialog("option","title"))) {
RED.view.importNodes($("#clipboard-import").val()); RED.view.importNodes($("#clipboard-import").val());
@ -43,14 +43,14 @@ RED.clipboard = (function() {
}, },
{ {
id: "clipboard-dialog-cancel", id: "clipboard-dialog-cancel",
text: RED._("dialog.cancel"), text: RED._("common.label.cancel"),
click: function() { click: function() {
$( this ).dialog( "close" ); $( this ).dialog( "close" );
} }
}, },
{ {
id: "clipboard-dialog-close", id: "clipboard-dialog-close",
text: RED._("dialog.close"), text: RED._("common.label.close"),
click: function() { click: function() {
$( this ).dialog( "close" ); $( this ).dialog( "close" );
} }
@ -66,20 +66,22 @@ RED.clipboard = (function() {
}); });
dialogContainer = dialog.children(".dialog-form"); dialogContainer = dialog.children(".dialog-form");
exportNodesDialog = '<div class="form-row">'+ exportNodesDialog = '<div class="form-row">'+
'<label for="node-input-export" style="display: block; width:100%;"><i class="fa fa-clipboard"></i>'+RED._("dialog.nodes")+'</label>'+ '<label for="node-input-export" style="display: block; width:100%;"><i class="fa fa-clipboard"></i> '+RED._("clipboard.nodes")+'</label>'+
'<textarea readonly style="resize: none; width: 100%; border-radius: 0px;font-family: monospace; font-size: 12px; background:#eee; padding-left: 0.5em; box-sizing:border-box;" id="clipboard-export" rows="5"></textarea>'+ '<textarea readonly style="resize: none; width: 100%; border-radius: 0px;font-family: monospace; font-size: 12px; background:#eee; padding-left: 0.5em; box-sizing:border-box;" id="clipboard-export" rows="5"></textarea>'+
'</div>'+ '</div>'+
'<div class="form-tips">'+ '<div class="form-tips">'+
RED._("dialog.selectToCopy")+ RED._("clipboard.selectNodes")+
'</div>'; '</div>';
importNodesDialog = '<div class="form-row">'+ importNodesDialog = '<div class="form-row">'+
'<textarea style="resize: none; width: 100%; border-radius: 0px;font-family: monospace; font-size: 12px; background:#eee; padding-left: 0.5em; box-sizing:border-box;" id="clipboard-import" rows="5" placeholder="'+RED._("dialog.pasteNodesHere")+'"></textarea>'+ '<textarea style="resize: none; width: 100%; border-radius: 0px;font-family: monospace; font-size: 12px; background:#eee; padding-left: 0.5em; box-sizing:border-box;" id="clipboard-import" rows="5" placeholder="'+
RED._("clipboard.pasteNodes")+
'"></textarea>'+
'</div>'; '</div>';
} }
function validateImport() { function validateImport() {
var importInput = $("#clipboard-import"); var importInput = $("#clipboard-import");
var v = importInput.val(); var v = importInput.val();
@ -104,8 +106,8 @@ RED.clipboard = (function() {
$("#clipboard-dialog-ok").button("disable"); $("#clipboard-dialog-ok").button("disable");
$("#clipboard-import").keyup(validateImport); $("#clipboard-import").keyup(validateImport);
$("#clipboard-import").on('paste',function() { setTimeout(validateImport,10)}); $("#clipboard-import").on('paste',function() { setTimeout(validateImport,10)});
dialog.dialog("option","title",RED._("dialog.importNodes")).dialog("open"); dialog.dialog("option","title",RED._("clipboard.importNodes")).dialog("open");
} }
function exportNodes() { function exportNodes() {
@ -127,15 +129,15 @@ RED.clipboard = (function() {
return false; return false;
}) })
}); });
dialog.dialog("option","title",RED._("dialog.exportNodesClipboard")).dialog( "open" ); dialog.dialog("option","title",RED._("clipboard.exportNodes")).dialog( "open" );
} }
} }
function hideDropTarget() { function hideDropTarget() {
$("#dropTarget").hide(); $("#dropTarget").hide();
RED.keyboard.remove(/* ESCAPE */ 27); RED.keyboard.remove(/* ESCAPE */ 27);
} }
return { return {
init: function() { init: function() {
setupDialogs(); setupDialogs();
@ -152,16 +154,16 @@ RED.clipboard = (function() {
}); });
RED.keyboard.add(/* e */ 69,{ctrl:true},function(){exportNodes();d3.event.preventDefault();}); RED.keyboard.add(/* e */ 69,{ctrl:true},function(){exportNodes();d3.event.preventDefault();});
RED.keyboard.add(/* i */ 73,{ctrl:true},function(){importNodes();d3.event.preventDefault();}); RED.keyboard.add(/* i */ 73,{ctrl:true},function(){importNodes();d3.event.preventDefault();});
$('#chart').on("dragenter",function(event) { $('#chart').on("dragenter",function(event) {
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) { if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) {
$("#dropTarget").css({display:'table'}); $("#dropTarget").css({display:'table'});
RED.keyboard.add(/* ESCAPE */ 27,hideDropTarget); RED.keyboard.add(/* ESCAPE */ 27,hideDropTarget);
} }
}); });
$('#dropTarget').on("dragover",function(event) { $('#dropTarget').on("dragover",function(event) {
if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) { if ($.inArray("text/plain",event.originalEvent.dataTransfer.types) != -1) {
event.preventDefault(); event.preventDefault();
@ -176,15 +178,15 @@ RED.clipboard = (function() {
RED.view.importNodes(data); RED.view.importNodes(data);
event.preventDefault(); event.preventDefault();
}); });
}, },
import: importNodes, import: importNodes,
export: exportNodes export: exportNodes
} }
})(); })();

View File

@ -13,29 +13,29 @@
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
**/ **/
RED.deploy = (function() { RED.deploy = (function() {
var deploymentTypes = { var deploymentTypes = {
"full":{img:"red/images/deploy-full-o.png"}, "full":{img:"red/images/deploy-full-o.png"},
"nodes":{img:"red/images/deploy-nodes-o.png"}, "nodes":{img:"red/images/deploy-nodes-o.png"},
"flows":{img:"red/images/deploy-flows-o.png"} "flows":{img:"red/images/deploy-flows-o.png"}
} }
var ignoreDeployWarnings = { var ignoreDeployWarnings = {
unknown: false, unknown: false,
unusedConfig: false, unusedConfig: false,
invalid: false invalid: false
} }
var deploymentType = "full"; var deploymentType = "full";
function changeDeploymentType(type) { function changeDeploymentType(type) {
deploymentType = type; deploymentType = type;
$("#btn-deploy img").attr("src",deploymentTypes[type].img); $("#btn-deploy img").attr("src",deploymentTypes[type].img);
} }
/** /**
* options: * options:
* type: "default" - Button with drop-down options - no further customisation available * type: "default" - Button with drop-down options - no further customisation available
@ -46,7 +46,7 @@ RED.deploy = (function() {
function init(options) { function init(options) {
options = options || {}; options = options || {};
var type = options.type || "default"; var type = options.type || "default";
if (type == "default") { if (type == "default") {
$('<li><span class="deploy-button-group button-group">'+ $('<li><span class="deploy-button-group button-group">'+
'<a id="btn-deploy" class="deploy-button disabled" href="#"><img id="btn-deploy-icon" src="red/images/deploy-full-o.png"> <span>'+RED._("deploy.deploy")+'</span></a>'+ '<a id="btn-deploy" class="deploy-button disabled" href="#"><img id="btn-deploy-icon" src="red/images/deploy-full-o.png"> <span>'+RED._("deploy.deploy")+'</span></a>'+
@ -65,16 +65,16 @@ RED.deploy = (function() {
if (options.hasOwnProperty('icon')) { if (options.hasOwnProperty('icon')) {
icon = options.icon; icon = options.icon;
} }
$('<li><span class="deploy-button-group button-group">'+ $('<li><span class="deploy-button-group button-group">'+
'<a id="btn-deploy" class="deploy-button disabled" href="#">'+ '<a id="btn-deploy" class="deploy-button disabled" href="#">'+
(icon?'<img id="btn-deploy-icon" src="'+icon+'"> ':'')+ (icon?'<img id="btn-deploy-icon" src="'+icon+'"> ':'')+
'<span>'+label+'</span></a>'+ '<span>'+label+'</span></a>'+
'</span></li>').prependTo(".header-toolbar"); '</span></li>').prependTo(".header-toolbar");
} }
$('#btn-deploy').click(function() { save(); }); $('#btn-deploy').click(function() { save(); });
$( "#node-dialog-confirm-deploy" ).dialog({ $( "#node-dialog-confirm-deploy" ).dialog({
title: "Confirm deploy", title: "Confirm deploy",
modal: true, modal: true,
@ -83,9 +83,9 @@ RED.deploy = (function() {
height: "auto", height: "auto",
buttons: [ buttons: [
{ {
text: RED._("deploy.confirmDeploy"), text: RED._("deploy.confirm.button.confirm"),
click: function() { click: function() {
var ignoreChecked = $( "#node-dialog-confirm-deploy-hide" ).prop("checked"); var ignoreChecked = $( "#node-dialog-confirm-deploy-hide" ).prop("checked");
if (ignoreChecked) { if (ignoreChecked) {
ignoreDeployWarnings[$( "#node-dialog-confirm-deploy-type" ).val()] = true; ignoreDeployWarnings[$( "#node-dialog-confirm-deploy-type" ).val()] = true;
@ -95,7 +95,7 @@ RED.deploy = (function() {
} }
}, },
{ {
text: RED._("deploy.cancelDeploy"), text: RED._("deploy.confirm.button.cancel"),
click: function() { click: function() {
$( this ).dialog( "close" ); $( this ).dialog( "close" );
} }
@ -114,7 +114,7 @@ RED.deploy = (function() {
RED.nodes.on('change',function(state) { RED.nodes.on('change',function(state) {
if (state.dirty) { if (state.dirty) {
window.onbeforeunload = function() { window.onbeforeunload = function() {
return RED._("deploy.undeployedChanges"); return RED._("deploy.confirm.undeployedChanges");
} }
$("#btn-deploy").removeClass("disabled"); $("#btn-deploy").removeClass("disabled");
} else { } else {
@ -132,7 +132,7 @@ RED.deploy = (function() {
var hasUnknown = false; var hasUnknown = false;
var hasInvalid = false; var hasInvalid = false;
var hasUnusedConfig = false; var hasUnusedConfig = false;
var unknownNodes = []; var unknownNodes = [];
RED.nodes.eachNode(function(node) { RED.nodes.eachNode(function(node) {
hasInvalid = hasInvalid || !node.valid; hasInvalid = hasInvalid || !node.valid;
@ -143,7 +143,7 @@ RED.deploy = (function() {
} }
}); });
hasUnknown = unknownNodes.length > 0; hasUnknown = unknownNodes.length > 0;
var unusedConfigNodes = {}; var unusedConfigNodes = {};
RED.nodes.eachConfig(function(node) { RED.nodes.eachConfig(function(node) {
if (node.users.length === 0) { if (node.users.length === 0) {
@ -159,13 +159,13 @@ RED.deploy = (function() {
hasUnusedConfig = true; hasUnusedConfig = true;
} }
}); });
$( "#node-dialog-confirm-deploy-config" ).hide(); $( "#node-dialog-confirm-deploy-config" ).hide();
$( "#node-dialog-confirm-deploy-unknown" ).hide(); $( "#node-dialog-confirm-deploy-unknown" ).hide();
$( "#node-dialog-confirm-deploy-unused" ).hide(); $( "#node-dialog-confirm-deploy-unused" ).hide();
var showWarning = false; var showWarning = false;
if (hasUnknown && !ignoreDeployWarnings.unknown) { if (hasUnknown && !ignoreDeployWarnings.unknown) {
showWarning = true; showWarning = true;
$( "#node-dialog-confirm-deploy-type" ).val("unknown"); $( "#node-dialog-confirm-deploy-type" ).val("unknown");
@ -186,7 +186,7 @@ RED.deploy = (function() {
unusedConfigNodes[type].forEach(function(label) { unusedConfigNodes[type].forEach(function(label) {
unusedNodeLabels.push(type+": "+label); unusedNodeLabels.push(type+": "+label);
}); });
}); });
$( "#node-dialog-confirm-deploy-unused-list" ) $( "#node-dialog-confirm-deploy-unused-list" )
.html("<li>"+unusedNodeLabels.join("</li><li>")+"</li>"); .html("<li>"+unusedNodeLabels.join("</li><li>")+"</li>");
} }
@ -196,10 +196,10 @@ RED.deploy = (function() {
return; return;
} }
} }
var nns = RED.nodes.createCompleteNodeSet(); var nns = RED.nodes.createCompleteNodeSet();
$("#btn-deploy-icon").removeClass('fa-download'); $("#btn-deploy-icon").removeClass('fa-download');
@ -236,9 +236,9 @@ RED.deploy = (function() {
}).fail(function(xhr,textStatus,err) { }).fail(function(xhr,textStatus,err) {
RED.nodes.dirty(true); RED.nodes.dirty(true);
if (xhr.responseText) { if (xhr.responseText) {
RED.notify(RED._("deploy.error")+xhr.responseJSON.message,"error"); RED.notify(RED._("notification.error",{message:xhr.responseJSON.message}),"error");
} else { } else {
RED.notify(RED._("deploy.error")+RED._("deploy.noResponseError"),"error"); RED.notify(RED._("notification.error",{message:RED._("deploy.errors.noResponse")}),"error");
} }
}).always(function() { }).always(function() {
$("#btn-deploy-icon").removeClass('spinner'); $("#btn-deploy-icon").removeClass('spinner');

View File

@ -179,7 +179,7 @@ RED.editor = (function() {
buttons: [ buttons: [
{ {
id: "node-dialog-ok", id: "node-dialog-ok",
text: RED._("dialog.ok"), text: RED._("common.label.ok"),
click: function() { click: function() {
if (editing_node) { if (editing_node) {
var changes = {}; var changes = {};
@ -286,7 +286,7 @@ RED.editor = (function() {
contentType: "application/json; charset=utf-8" contentType: "application/json; charset=utf-8"
}).done(function() { }).done(function() {
RED.library.loadFlowLibrary(); RED.library.loadFlowLibrary();
RED.notify(RED._("editor.savedNodes"),"success"); RED.notify(RED._("library.savedNodes"),"success");
}); });
} }
} }
@ -295,7 +295,7 @@ RED.editor = (function() {
}, },
{ {
id: "node-dialog-cancel", id: "node-dialog-cancel",
text: RED._("dialog.cancel"), text: RED._("common.label.cancel"),
click: function() { click: function() {
if (editing_node && editing_node._def) { if (editing_node && editing_node._def) {
if (editing_node._def.oneditcancel) { if (editing_node._def.oneditcancel) {
@ -567,7 +567,7 @@ RED.editor = (function() {
var buttons = $( "#dialog" ).dialog("option","buttons"); var buttons = $( "#dialog" ).dialog("option","buttons");
buttons.unshift({ buttons.unshift({
class: 'leftButton', class: 'leftButton',
text: RED._("editor.editFlow"), text: RED._("subflow.edit"),
click: function() { click: function() {
RED.workspaces.show(id); RED.workspaces.show(id);
$("#node-dialog-ok").click(); $("#node-dialog-ok").click();
@ -745,7 +745,7 @@ RED.editor = (function() {
buttons: [ buttons: [
{ {
id: "node-config-dialog-ok", id: "node-config-dialog-ok",
text: RED._("dialog.ok"), text: RED._("common.label.ok"),
click: function() { click: function() {
var configProperty = $(this).dialog('option','node-property'); var configProperty = $(this).dialog('option','node-property');
var configId = $(this).dialog('option','node-id'); var configId = $(this).dialog('option','node-id');
@ -805,7 +805,7 @@ RED.editor = (function() {
}, },
{ {
id: "node-config-dialog-cancel", id: "node-config-dialog-cancel",
text: RED._("dialog.cancel"), text: RED._("common.label.cancel"),
click: function() { click: function() {
var configType = $(this).dialog('option','node-type'); var configType = $(this).dialog('option','node-type');
var configId = $(this).dialog('option','node-id'); var configId = $(this).dialog('option','node-id');
@ -861,7 +861,7 @@ RED.editor = (function() {
buttons: [ buttons: [
{ {
id: "subflow-dialog-ok", id: "subflow-dialog-ok",
text: RED._("dialog.ok"), text: RED._("common.label.ok"),
click: function() { click: function() {
if (editing_node) { if (editing_node) {
var i; var i;
@ -875,7 +875,7 @@ RED.editor = (function() {
changes['name'] = editing_node.name; changes['name'] = editing_node.name;
editing_node.name = newName; editing_node.name = newName;
changed = true; changed = true;
$("#menu-item-workspace-menu-"+editing_node.id.replace(".","-")).text(RED._("editor.subflow")+newName); $("#menu-item-workspace-menu-"+editing_node.id.replace(".","-")).text(RED._("subflow.tabLabel",{name:newName}));
} }
RED.palette.refresh(); RED.palette.refresh();
@ -908,7 +908,7 @@ RED.editor = (function() {
}, },
{ {
id: "subflow-dialog-cancel", id: "subflow-dialog-cancel",
text: RED._("dialog.cancel"), text: RED._("common.label.cancel"),
click: function() { click: function() {
$( this ).dialog( "close" ); $( this ).dialog( "close" );
editing_node = null; editing_node = null;
@ -949,8 +949,8 @@ RED.editor = (function() {
} }
}); });
$("#subflow-dialog-user-count").html(RED._("editor.subflowInstances", {count:userCount})).show(); $("#subflow-dialog-user-count").html(RED._("subflow.subflowInstances", {count:userCount})).show();
$("#subflow-dialog").dialog("option","title",RED._("editor.editFlow")+subflow.name).dialog( "open" ); $("#subflow-dialog").dialog("option","title",RED._("subflow.editSubflow",{name:subflow.name})).dialog( "open" );
} }

View File

@ -239,7 +239,7 @@ RED.library = (function() {
height: 450, height: 450,
buttons: [ buttons: [
{ {
text: RED._("dialog.ok"), text: RED._("common.label.ok"),
click: function() { click: function() {
if (selectedLibraryItem) { if (selectedLibraryItem) {
for (var i=0;i<options.fields.length;i++) { for (var i=0;i<options.fields.length;i++) {
@ -252,7 +252,7 @@ RED.library = (function() {
} }
}, },
{ {
text: RED._("dialog.cancel"), text: RED._("common.label.cancel"),
click: function() { click: function() {
$( this ).dialog( "close" ); $( this ).dialog( "close" );
} }
@ -279,7 +279,7 @@ RED.library = (function() {
var filename = $("#node-dialog-library-save-filename").val().replace(/(^\s*)|(\s*$)/g,""); var filename = $("#node-dialog-library-save-filename").val().replace(/(^\s*)|(\s*$)/g,"");
var pathname = $("#node-dialog-library-save-folder").val().replace(/(^\s*)|(\s*$)/g,""); var pathname = $("#node-dialog-library-save-folder").val().replace(/(^\s*)|(\s*$)/g,"");
if (filename === "" || !/.+\.js$/.test(filename)) { if (filename === "" || !/.+\.js$/.test(filename)) {
RED.notify(RED._("notification.invalidFilename"),"warning"); RED.notify(RED._("library.invalidFilename"),"warning");
return; return;
} }
var fullpath = pathname+(pathname===""?"":"/")+filename; var fullpath = pathname+(pathname===""?"":"/")+filename;
@ -327,9 +327,9 @@ RED.library = (function() {
data: JSON.stringify(data), data: JSON.stringify(data),
contentType: "application/json; charset=utf-8" contentType: "application/json; charset=utf-8"
}).done(function(data,textStatus,xhr) { }).done(function(data,textStatus,xhr) {
RED.notify(RED._("notification.savedType", {type:options.type}),"success"); RED.notify(RED._("library.savedType", {type:options.type}),"success");
}).fail(function(xhr,textStatus,err) { }).fail(function(xhr,textStatus,err) {
RED.notify(RED._("notification.saveFailed")+xhr.responseJSON.message,"error"); RED.notify(RED._("library.saveFailed",{message:xhr.responseJSON.message}),"error");
}); });
} }
$( "#node-dialog-library-save-confirm" ).dialog({ $( "#node-dialog-library-save-confirm" ).dialog({
@ -340,14 +340,14 @@ RED.library = (function() {
height: 230, height: 230,
buttons: [ buttons: [
{ {
text: RED._("dialog.ok"), text: RED._("common.label.ok"),
click: function() { click: function() {
saveToLibrary(true); saveToLibrary(true);
$( this ).dialog( "close" ); $( this ).dialog( "close" );
} }
}, },
{ {
text: RED._("dialog.cancel"), text: RED._("common.label.cancel"),
click: function() { click: function() {
$( this ).dialog( "close" ); $( this ).dialog( "close" );
} }
@ -362,14 +362,14 @@ RED.library = (function() {
height: 230, height: 230,
buttons: [ buttons: [
{ {
text: RED._("dialog.ok"), text: RED._("common.label.ok"),
click: function() { click: function() {
saveToLibrary(false); saveToLibrary(false);
$( this ).dialog( "close" ); $( this ).dialog( "close" );
} }
}, },
{ {
text: RED._("dialog.cancel"), text: RED._("common.label.cancel"),
click: function() { click: function() {
$( this ).dialog( "close" ); $( this ).dialog( "close" );
} }

View File

@ -77,14 +77,15 @@ RED.palette = (function() {
if (label != type) { if (label != type) {
l = "<p><b>"+label+"</b><br/><i>"+type+"</i></p>"; l = "<p><b>"+label+"</b><br/><i>"+type+"</i></p>";
} }
popOverContent = $(l+($("script[data-help-name|='"+type+"']").html()||"<p>"+RED._("palette.noInfo")+"</p>").trim()) popOverContent = $(l+($("script[data-help-name|='"+type+"']").html()||"<p>"+RED._("palette.noInfo")+"</p>").trim())
.filter(function(n) { .filter(function(n) {
return this.nodeType == 1 || (this.nodeType == 3 && this.textContent.trim().length > 0) return this.nodeType == 1 || (this.nodeType == 3 && this.textContent.trim().length > 0)
}).slice(0,2); }).slice(0,2);
} catch(err) { } catch(err) {
// Malformed HTML may cause errors. TODO: need to understand what can break // Malformed HTML may cause errors. TODO: need to understand what can break
console.log(RED._("palette.popOverError",{type:type})); // NON-NLS: internal debug
console.log("Error generating pop-over label for ",type);
console.log(err.toString()); console.log(err.toString());
popOverContent = "<p><b>"+label+"</b></p><p>"+RED._("palette.noInfo")+"</p>"; popOverContent = "<p><b>"+label+"</b></p><p>"+RED._("palette.noInfo")+"</p>";
} }
@ -120,12 +121,12 @@ RED.palette = (function() {
label = (typeof def.paletteLabel === "function" ? def.paletteLabel.call(def) : def.paletteLabel)||""; label = (typeof def.paletteLabel === "function" ? def.paletteLabel.call(def) : def.paletteLabel)||"";
} }
$('<div/>',{class:"palette_label"+(def.align=="right"?" palette_label_right":"")}).appendTo(d); $('<div/>',{class:"palette_label"+(def.align=="right"?" palette_label_right":"")}).appendTo(d);
d.className="palette_node"; d.className="palette_node";
if (def.icon) { if (def.icon) {
var icon_url = (typeof def.icon === "function" ? def.icon.call({}) : def.icon); var icon_url = (typeof def.icon === "function" ? def.icon.call({}) : def.icon);
var iconContainer = $('<div/>',{class:"palette_icon_container"+(def.align=="right"?" palette_icon_container_right":"")}).appendTo(d); var iconContainer = $('<div/>',{class:"palette_icon_container"+(def.align=="right"?" palette_icon_container_right":"")}).appendTo(d);
@ -183,7 +184,7 @@ RED.palette = (function() {
revertDuration: 50, revertDuration: 50,
start: function() {RED.view.focus();} start: function() {RED.view.focus();}
}); });
if (def.category == "subflows") { if (def.category == "subflows") {
$(d).dblclick(function(e) { $(d).dblclick(function(e) {
RED.workspaces.show(nt.substring(8)); RED.workspaces.show(nt.substring(8));
@ -192,7 +193,7 @@ RED.palette = (function() {
} }
setLabel(nt,$(d),label); setLabel(nt,$(d),label);
var categoryNode = $("#palette-container-"+category); var categoryNode = $("#palette-container-"+category);
if (categoryNode.find(".palette_node").length === 1) { if (categoryNode.find(".palette_node").length === 1) {
if (!categoryNode.find("i").hasClass("expanded")) { if (!categoryNode.find("i").hasClass("expanded")) {
@ -200,7 +201,7 @@ RED.palette = (function() {
categoryNode.find("i").toggleClass("expanded"); categoryNode.find("i").toggleClass("expanded");
} }
} }
} }
} }
@ -281,26 +282,26 @@ RED.palette = (function() {
createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category})); createCategoryContainer(category, RED._("palette.label."+category,{defaultValue:category}));
}); });
} }
$("#palette-search-input").focus(function(e) { $("#palette-search-input").focus(function(e) {
RED.keyboard.disable(); RED.keyboard.disable();
}); });
$("#palette-search-input").blur(function(e) { $("#palette-search-input").blur(function(e) {
RED.keyboard.enable(); RED.keyboard.enable();
}); });
$("#palette-search-clear").on("click",function(e) { $("#palette-search-clear").on("click",function(e) {
e.preventDefault(); e.preventDefault();
$("#palette-search-input").val(""); $("#palette-search-input").val("");
filterChange(); filterChange();
$("#palette-search-input").focus(); $("#palette-search-input").focus();
}); });
$("#palette-search-input").val(""); $("#palette-search-input").val("");
$("#palette-search-input").on("keyup",function() { $("#palette-search-input").on("keyup",function() {
filterChange(); filterChange();
}); });
$("#palette-search-input").on("focus",function() { $("#palette-search-input").on("focus",function() {
$("body").one("mousedown",function() { $("body").one("mousedown",function() {
$("#palette-search-input").blur(); $("#palette-search-input").blur();

View File

@ -15,12 +15,12 @@
**/ **/
RED.subflow = (function() { RED.subflow = (function() {
function getSubflow() { function getSubflow() {
return RED.nodes.subflow(RED.workspaces.active()); return RED.nodes.subflow(RED.workspaces.active());
} }
function findAvailableSubflowIOPosition(subflow) { function findAvailableSubflowIOPosition(subflow) {
var pos = {x:70,y:70}; var pos = {x:70,y:70};
for (var i=0;i<subflow.out.length+subflow.in.length;i++) { for (var i=0;i<subflow.out.length+subflow.in.length;i++) {
@ -37,7 +37,7 @@ RED.subflow = (function() {
} }
return pos; return pos;
} }
function addSubflowInput() { function addSubflowInput() {
var subflow = RED.nodes.subflow(RED.workspaces.active()); var subflow = RED.nodes.subflow(RED.workspaces.active());
var position = findAvailableSubflowIOPosition(subflow); var position = findAvailableSubflowIOPosition(subflow);
@ -56,7 +56,7 @@ RED.subflow = (function() {
var wasDirty = RED.nodes.dirty(); var wasDirty = RED.nodes.dirty();
var wasChanged = subflow.changed; var wasChanged = subflow.changed;
subflow.changed = true; subflow.changed = true;
RED.nodes.eachNode(function(n) { RED.nodes.eachNode(function(n) {
if (n.type == "subflow:"+subflow.id) { if (n.type == "subflow:"+subflow.id) {
n.changed = true; n.changed = true;
@ -77,11 +77,11 @@ RED.subflow = (function() {
$("#workspace-subflow-add-input").toggleClass("disabled",true); $("#workspace-subflow-add-input").toggleClass("disabled",true);
RED.view.select(); RED.view.select();
} }
function addSubflowOutput(id) { function addSubflowOutput(id) {
var subflow = RED.nodes.subflow(RED.workspaces.active()); var subflow = RED.nodes.subflow(RED.workspaces.active());
var position = findAvailableSubflowIOPosition(subflow); var position = findAvailableSubflowIOPosition(subflow);
var newOutput = { var newOutput = {
type:"subflow", type:"subflow",
direction:"out", direction:"out",
@ -97,7 +97,7 @@ RED.subflow = (function() {
var wasDirty = RED.nodes.dirty(); var wasDirty = RED.nodes.dirty();
var wasChanged = subflow.changed; var wasChanged = subflow.changed;
subflow.changed = true; subflow.changed = true;
RED.nodes.eachNode(function(n) { RED.nodes.eachNode(function(n) {
if (n.type == "subflow:"+subflow.id) { if (n.type == "subflow:"+subflow.id) {
n.changed = true; n.changed = true;
@ -117,7 +117,7 @@ RED.subflow = (function() {
RED.history.push(historyEvent); RED.history.push(historyEvent);
RED.view.select(); RED.view.select();
} }
function init() { function init() {
$("#workspace-subflow-edit").click(function(event) { $("#workspace-subflow-edit").click(function(event) {
RED.editor.editSubflow(RED.nodes.subflow(RED.workspaces.active())); RED.editor.editSubflow(RED.nodes.subflow(RED.workspaces.active()));
@ -137,13 +137,13 @@ RED.subflow = (function() {
} }
addSubflowOutput(); addSubflowOutput();
}); });
$("#workspace-subflow-delete").click(function(event) { $("#workspace-subflow-delete").click(function(event) {
event.preventDefault(); event.preventDefault();
var removedNodes = []; var removedNodes = [];
var removedLinks = []; var removedLinks = [];
var startDirty = RED.nodes.dirty(); var startDirty = RED.nodes.dirty();
RED.nodes.eachNode(function(n) { RED.nodes.eachNode(function(n) {
if (n.type == "subflow:"+getSubflow().id) { if (n.type == "subflow:"+getSubflow().id) {
removedNodes.push(n); removedNodes.push(n);
@ -152,16 +152,16 @@ RED.subflow = (function() {
removedNodes.push(n); removedNodes.push(n);
} }
}); });
for (var i=0;i<removedNodes.length;i++) { for (var i=0;i<removedNodes.length;i++) {
var rmlinks = RED.nodes.remove(removedNodes[i].id); var rmlinks = RED.nodes.remove(removedNodes[i].id);
removedLinks = removedLinks.concat(rmlinks); removedLinks = removedLinks.concat(rmlinks);
} }
var activeSubflow = getSubflow(); var activeSubflow = getSubflow();
RED.nodes.removeSubflow(activeSubflow); RED.nodes.removeSubflow(activeSubflow);
RED.history.push({ RED.history.push({
t:'delete', t:'delete',
nodes:removedNodes, nodes:removedNodes,
@ -169,12 +169,12 @@ RED.subflow = (function() {
subflow: activeSubflow, subflow: activeSubflow,
dirty:startDirty dirty:startDirty
}); });
RED.workspaces.remove(activeSubflow); RED.workspaces.remove(activeSubflow);
RED.nodes.dirty(true); RED.nodes.dirty(true);
RED.view.redraw(); RED.view.redraw();
}); });
RED.view.on("selection-changed",function(selection) { RED.view.on("selection-changed",function(selection) {
if (!selection.nodes) { if (!selection.nodes) {
RED.menu.setDisabled("menu-item-subflow-convert",true); RED.menu.setDisabled("menu-item-subflow-convert",true);
@ -182,9 +182,9 @@ RED.subflow = (function() {
RED.menu.setDisabled("menu-item-subflow-convert",false); RED.menu.setDisabled("menu-item-subflow-convert",false);
} }
}); });
} }
function createSubflow() { function createSubflow() {
var lastIndex = 0; var lastIndex = 0;
RED.nodes.eachSubflow(function(sf) { RED.nodes.eachSubflow(function(sf) {
@ -193,9 +193,9 @@ RED.subflow = (function() {
lastIndex = Math.max(lastIndex,m[1]); lastIndex = Math.max(lastIndex,m[1]);
} }
}); });
var name = "Subflow "+(lastIndex+1); var name = "Subflow "+(lastIndex+1);
var subflowId = RED.nodes.id(); var subflowId = RED.nodes.id();
var subflow = { var subflow = {
type:"subflow", type:"subflow",
@ -212,26 +212,26 @@ RED.subflow = (function() {
}); });
RED.workspaces.show(subflowId); RED.workspaces.show(subflowId);
} }
function convertToSubflow() { function convertToSubflow() {
var selection = RED.view.selection(); var selection = RED.view.selection();
if (!selection.nodes) { if (!selection.nodes) {
RED.notify(RED._("notification.noNodesSelected"),"error"); RED.notify(RED._("subflow.errors.noNodesSelected"),"error");
return; return;
} }
var i; var i;
var nodes = {}; var nodes = {};
var new_links = []; var new_links = [];
var removedLinks = []; var removedLinks = [];
var candidateInputs = []; var candidateInputs = [];
var candidateOutputs = []; var candidateOutputs = [];
var boundingBox = [selection.nodes[0].x, var boundingBox = [selection.nodes[0].x,
selection.nodes[0].y, selection.nodes[0].y,
selection.nodes[0].x, selection.nodes[0].x,
selection.nodes[0].y]; selection.nodes[0].y];
for (i=0;i<selection.nodes.length;i++) { for (i=0;i<selection.nodes.length;i++) {
var n = selection.nodes[i]; var n = selection.nodes[i];
nodes[n.id] = {n:n,outputs:{}}; nodes[n.id] = {n:n,outputs:{}};
@ -242,14 +242,14 @@ RED.subflow = (function() {
Math.max(boundingBox[3],n.y) Math.max(boundingBox[3],n.y)
] ]
} }
var center = [(boundingBox[2]+boundingBox[0]) / 2,(boundingBox[3]+boundingBox[1]) / 2]; var center = [(boundingBox[2]+boundingBox[0]) / 2,(boundingBox[3]+boundingBox[1]) / 2];
RED.nodes.eachLink(function(link) { RED.nodes.eachLink(function(link) {
if (nodes[link.source.id] && nodes[link.target.id]) { if (nodes[link.source.id] && nodes[link.target.id]) {
// A link wholely within the selection // A link wholely within the selection
} }
if (nodes[link.source.id] && !nodes[link.target.id]) { if (nodes[link.source.id] && !nodes[link.target.id]) {
// An outbound link from the selection // An outbound link from the selection
candidateOutputs.push(link); candidateOutputs.push(link);
@ -261,7 +261,7 @@ RED.subflow = (function() {
removedLinks.push(link); removedLinks.push(link);
} }
}); });
var outputs = {}; var outputs = {};
candidateOutputs = candidateOutputs.filter(function(v) { candidateOutputs = candidateOutputs.filter(function(v) {
if (outputs[v.source.id+":"+v.sourcePort]) { if (outputs[v.source.id+":"+v.sourcePort]) {
@ -274,17 +274,17 @@ RED.subflow = (function() {
return true; return true;
}); });
candidateOutputs.sort(function(a,b) { return a.source.y-b.source.y}); candidateOutputs.sort(function(a,b) { return a.source.y-b.source.y});
if (candidateInputs.length > 1) { if (candidateInputs.length > 1) {
RED.notify(RED._("notification.multipleInputsToSelection"),"error"); RED.notify(RED._("subflow.errors.multipleInputsToSelection"),"error");
return; return;
} }
//if (candidateInputs.length == 0) { //if (candidateInputs.length == 0) {
// RED.notify("<strong>Cannot create subflow</strong>: no input to selection","error"); // RED.notify("<strong>Cannot create subflow</strong>: no input to selection","error");
// return; // return;
//} //}
var lastIndex = 0; var lastIndex = 0;
RED.nodes.eachSubflow(function(sf) { RED.nodes.eachSubflow(function(sf) {
var m = (new RegExp("^Subflow (\\d+)$")).exec(sf.name); var m = (new RegExp("^Subflow (\\d+)$")).exec(sf.name);
@ -292,9 +292,9 @@ RED.subflow = (function() {
lastIndex = Math.max(lastIndex,m[1]); lastIndex = Math.max(lastIndex,m[1]);
} }
}); });
var name = "Subflow "+(lastIndex+1); var name = "Subflow "+(lastIndex+1);
var subflowId = RED.nodes.id(); var subflowId = RED.nodes.id();
var subflow = { var subflow = {
type:"subflow", type:"subflow",
@ -322,7 +322,7 @@ RED.subflow = (function() {
}}) }})
}; };
RED.nodes.addSubflow(subflow); RED.nodes.addSubflow(subflow);
var subflowInstance = { var subflowInstance = {
id:RED.nodes.id(), id:RED.nodes.id(),
type:"subflow:"+subflow.id, type:"subflow:"+subflow.id,
@ -337,13 +337,13 @@ RED.subflow = (function() {
subflowInstance._def = RED.nodes.getType(subflowInstance.type); subflowInstance._def = RED.nodes.getType(subflowInstance.type);
RED.editor.validateNode(subflowInstance); RED.editor.validateNode(subflowInstance);
RED.nodes.add(subflowInstance); RED.nodes.add(subflowInstance);
candidateInputs.forEach(function(l) { candidateInputs.forEach(function(l) {
var link = {source:l.source, sourcePort:l.sourcePort, target: subflowInstance}; var link = {source:l.source, sourcePort:l.sourcePort, target: subflowInstance};
new_links.push(link); new_links.push(link);
RED.nodes.addLink(link); RED.nodes.addLink(link);
}); });
candidateOutputs.forEach(function(output,i) { candidateOutputs.forEach(function(output,i) {
output.targets.forEach(function(target) { output.targets.forEach(function(target) {
var link = {source:subflowInstance, sourcePort:i, target: target}; var link = {source:subflowInstance, sourcePort:i, target: target};
@ -351,7 +351,7 @@ RED.subflow = (function() {
RED.nodes.addLink(link); RED.nodes.addLink(link);
}); });
}); });
subflow.in.forEach(function(input) { subflow.in.forEach(function(input) {
input.wires.forEach(function(wire) { input.wires.forEach(function(wire) {
var link = {source: input, sourcePort: 0, target: RED.nodes.node(wire.id) } var link = {source: input, sourcePort: 0, target: RED.nodes.node(wire.id) }
@ -366,34 +366,34 @@ RED.subflow = (function() {
RED.nodes.addLink(link); RED.nodes.addLink(link);
}); });
}); });
for (i=0;i<removedLinks.length;i++) { for (i=0;i<removedLinks.length;i++) {
RED.nodes.removeLink(removedLinks[i]); RED.nodes.removeLink(removedLinks[i]);
} }
for (i=0;i<selection.nodes.length;i++) { for (i=0;i<selection.nodes.length;i++) {
selection.nodes[i].z = subflow.id; selection.nodes[i].z = subflow.id;
} }
RED.history.push({ RED.history.push({
t:'createSubflow', t:'createSubflow',
nodes:[subflowInstance.id], nodes:[subflowInstance.id],
links:new_links, links:new_links,
subflow: subflow, subflow: subflow,
activeWorkspace: RED.workspaces.active(), activeWorkspace: RED.workspaces.active(),
removedLinks: removedLinks, removedLinks: removedLinks,
dirty:RED.nodes.dirty() dirty:RED.nodes.dirty()
}); });
RED.editor.validateNode(subflow); RED.editor.validateNode(subflow);
RED.nodes.dirty(true); RED.nodes.dirty(true);
RED.view.redraw(true); RED.view.redraw(true);
} }
return { return {
init: init, init: init,
createSubflow: createSubflow, createSubflow: createSubflow,

View File

@ -14,23 +14,23 @@
* limitations under the License. * limitations under the License.
**/ **/
RED.sidebar.config = (function() { RED.sidebar.config = (function() {
var content = document.createElement("div"); var content = document.createElement("div");
content.id = "tab-config"; content.id = "tab-config";
content.style.paddingTop = "4px"; content.style.paddingTop = "4px";
content.style.paddingLeft = "4px"; content.style.paddingLeft = "4px";
content.style.paddingRight = "4px"; content.style.paddingRight = "4px";
var list = $("<ul>",{class:"tab-config-list"}).appendTo(content); var list = $("<ul>",{class:"tab-config-list"}).appendTo(content);
function show() { function show() {
if (!RED.sidebar.containsTab("config")) { if (!RED.sidebar.containsTab("config")) {
RED.sidebar.addTab(RED._("sidebar.config"),content,true); RED.sidebar.addTab(RED._("sidebar.config.title"),content,true);
} }
refresh(); refresh();
RED.sidebar.show("config"); RED.sidebar.show("config");
} }
function refresh() { function refresh() {
list.empty(); list.empty();
RED.nodes.eachConfig(function(node) { RED.nodes.eachConfig(function(node) {
@ -46,12 +46,12 @@ RED.sidebar.config = (function() {
label = node._def.label; label = node._def.label;
} }
label = label || "&nbsp;"; label = label || "&nbsp;";
var entry = $('<div class="tab-config-list-entry"></div>').appendTo(li); var entry = $('<div class="tab-config-list-entry"></div>').appendTo(li);
entry.on('dblclick',function(e) { entry.on('dblclick',function(e) {
RED.editor.editConfig("", node.type, node.id); RED.editor.editConfig("", node.type, node.id);
}); });
var userArray = node.users.map(function(n) { return n.id }); var userArray = node.users.map(function(n) { return n.id });
entry.on('mouseover',function(e) { entry.on('mouseover',function(e) {
RED.nodes.eachNode(function(node) { RED.nodes.eachNode(function(node) {
@ -72,7 +72,7 @@ RED.sidebar.config = (function() {
}); });
RED.view.redraw(); RED.view.redraw();
}); });
$('<div class="tab-config-list-label">'+label+'</div>').appendTo(entry); $('<div class="tab-config-list-label">'+label+'</div>').appendTo(entry);
$('<div class="tab-config-list-users">'+node.users.length+'</div>').appendTo(entry); $('<div class="tab-config-list-users">'+node.users.length+'</div>').appendTo(entry);
}); });

View File

@ -33,10 +33,10 @@ RED.sidebar.info = (function() {
content.style.paddingRight = "4px"; content.style.paddingRight = "4px";
var propertiesExpanded = false; var propertiesExpanded = false;
function show() { function show() {
if (!RED.sidebar.containsTab("info")) { if (!RED.sidebar.containsTab("info")) {
RED.sidebar.addTab(RED._("sidebar.info"),content,false); RED.sidebar.addTab(RED._("sidebar.info.title"),content,false);
} }
RED.sidebar.show("info"); RED.sidebar.show("info");
} }
@ -60,13 +60,13 @@ RED.sidebar.info = (function() {
function refresh(node) { function refresh(node) {
var table = '<table class="node-info"><tbody>'; var table = '<table class="node-info"><tbody>';
table += '<tr class="blank"><td colspan="2">'+RED._("tabInfo.node")+'</td></tr>'; table += '<tr class="blank"><td colspan="2">'+RED._("sidebar.info.node")+'</td></tr>';
if (node.type != "subflow" && node.name) { if (node.type != "subflow" && node.name) {
table += "<tr><td>Name</td><td>&nbsp;"+node.name+"</td></tr>"; table += "<tr><td>"+RED._("common.label.name")+"</td><td>&nbsp;"+node.name+"</td></tr>";
} }
table += "<tr><td>"+RED._("tabInfo.type")+"</td><td>&nbsp;"+node.type+"</td></tr>"; table += "<tr><td>"+RED._("sidebar.info.type")+"</td><td>&nbsp;"+node.type+"</td></tr>";
table += "<tr><td>"+RED._("tabInfo.id")+"</td><td>&nbsp;"+node.id+"</td></tr>"; table += "<tr><td>"+RED._("sidebar.info.id")+"</td><td>&nbsp;"+node.id+"</td></tr>";
var m = /^subflow(:(.+))?$/.exec(node.type); var m = /^subflow(:(.+))?$/.exec(node.type);
if (m) { if (m) {
var subflowNode; var subflowNode;
@ -75,9 +75,9 @@ RED.sidebar.info = (function() {
} else { } else {
subflowNode = node; subflowNode = node;
} }
table += '<tr class="blank"><td colspan="2">'+RED._("tabInfo.subflow")+'</td></tr>'; table += '<tr class="blank"><td colspan="2">'+RED._("sidebar.info.subflow")+'</td></tr>';
var userCount = 0; var userCount = 0;
var subflowType = "subflow:"+subflowNode.id; var subflowType = "subflow:"+subflowNode.id;
RED.nodes.eachNode(function(n) { RED.nodes.eachNode(function(n) {
@ -85,12 +85,12 @@ RED.sidebar.info = (function() {
userCount++; userCount++;
} }
}); });
table += "<tr><td>"+RED._("tabInfo.name")+"</td><td>"+subflowNode.name+"</td></tr>"; table += "<tr><td>"+RED._("common.label.name")+"</td><td>"+subflowNode.name+"</td></tr>";
table += "<tr><td>"+RED._("tabInfo.instances")+"</td><td>"+userCount+"</td></tr>"; table += "<tr><td>"+RED._("sidebar.info.instances")+"</td><td>"+userCount+"</td></tr>";
} }
if (!m && node.type != "subflow" && node.type != "comment") { if (!m && node.type != "subflow" && node.type != "comment") {
table += '<tr class="blank"><td colspan="2"><a href="#" class="node-info-property-header"><i style="width: 10px; text-align: center;" class="fa fa-caret-'+(propertiesExpanded?"down":"right")+'"></i> '+RED._("tabInfo.properties")+'</a></td></tr>'; table += '<tr class="blank"><td colspan="2"><a href="#" class="node-info-property-header"><i style="width: 10px; text-align: center;" class="fa fa-caret-'+(propertiesExpanded?"down":"right")+'"></i> '+RED._("sidebar.info.properties")+'</a></td></tr>';
if (node._def) { if (node._def) {
for (var n in node._def.defaults) { for (var n in node._def.defaults) {
if (n != "name" && node._def.defaults.hasOwnProperty(n)) { if (n != "name" && node._def.defaults.hasOwnProperty(n)) {
@ -98,7 +98,7 @@ RED.sidebar.info = (function() {
var type = typeof val; var type = typeof val;
if (type === "string") { if (type === "string") {
if (val.length === 0) { if (val.length === 0) {
val += '<span style="font-style: italic; color: #ccc;">'+RED._("tabInfo.blank")+'</span>'; val += '<span style="font-style: italic; color: #ccc;">'+RED._("sidebar.info.blank")+'</span>';
} else { } else {
if (val.length > 30) { if (val.length > 30) {
val = val.substring(0,30)+" ..."; val = val.substring(0,30)+" ...";
@ -114,14 +114,14 @@ RED.sidebar.info = (function() {
val += "&nbsp;"+i+": "+vv+"<br/>"; val += "&nbsp;"+i+": "+vv+"<br/>";
} }
if (node[n].length > 10) { if (node[n].length > 10) {
val += "&nbsp;... "+node[n].length+" items<br/>"; val += "&nbsp;... "+RED._("sidebar.info.arrayItems",{count:node[n].length})+"<br/>";
} }
val += "]"; val += "]";
} else { } else {
val = JSON.stringify(val,jsonFilter," "); val = JSON.stringify(val,jsonFilter," ");
val = val.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"); val = val.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;");
} }
table += '<tr class="node-info-property-row'+(propertiesExpanded?"":" hide")+'"><td>'+n+"</td><td>"+val+"</td></tr>"; table += '<tr class="node-info-property-row'+(propertiesExpanded?"":" hide")+'"><td>'+n+"</td><td>"+val+"</td></tr>";
} }
} }
@ -140,7 +140,7 @@ RED.sidebar.info = (function() {
} }
$("#tab-info").html(table); $("#tab-info").html(table);
$(".node-info-property-header").click(function(e) { $(".node-info-property-header").click(function(e) {
var icon = $(this).find("i"); var icon = $(this).find("i");
if (icon.hasClass("fa-caret-right")) { if (icon.hasClass("fa-caret-right")) {
@ -154,15 +154,15 @@ RED.sidebar.info = (function() {
$(".node-info-property-row").hide(); $(".node-info-property-row").hide();
propertiesExpanded = false; propertiesExpanded = false;
} }
e.preventDefault(); e.preventDefault();
}); });
} }
function clear() { function clear() {
$("#tab-info").html(""); $("#tab-info").html("");
} }
RED.view.on("selection-changed",function(selection) { RED.view.on("selection-changed",function(selection) {
if (selection.nodes) { if (selection.nodes) {
if (selection.nodes.length == 1) { if (selection.nodes.length == 1) {

View File

@ -35,7 +35,7 @@ RED.view = (function() {
var activeSubflow = null; var activeSubflow = null;
var activeNodes = []; var activeNodes = [];
var activeLinks = []; var activeLinks = [];
var selected_link = null, var selected_link = null,
mousedown_link = null, mousedown_link = null,
mousedown_node = null, mousedown_node = null,
@ -73,7 +73,7 @@ RED.view = (function() {
.on("mousedown", function() { .on("mousedown", function() {
$(this).focus(); $(this).focus();
}); });
var vis = outer var vis = outer
.append('svg:g') .append('svg:g')
.on("dblclick.zoom", null) .on("dblclick.zoom", null)
@ -233,9 +233,9 @@ RED.view = (function() {
function updateActiveNodes() { function updateActiveNodes() {
var activeWorkspace = RED.workspaces.active(); var activeWorkspace = RED.workspaces.active();
activeNodes = RED.nodes.filterNodes({z:activeWorkspace}); activeNodes = RED.nodes.filterNodes({z:activeWorkspace});
activeLinks = RED.nodes.filterLinks({ activeLinks = RED.nodes.filterLinks({
source:{z:activeWorkspace}, source:{z:activeWorkspace},
target:{z:activeWorkspace} target:{z:activeWorkspace}
@ -253,15 +253,15 @@ RED.view = (function() {
} }
var scrollStartLeft = chart.scrollLeft(); var scrollStartLeft = chart.scrollLeft();
var scrollStartTop = chart.scrollTop(); var scrollStartTop = chart.scrollTop();
activeSubflow = RED.nodes.subflow(event.workspace); activeSubflow = RED.nodes.subflow(event.workspace);
if (activeSubflow) { if (activeSubflow) {
$("#workspace-subflow-add-input").toggleClass("disabled",activeSubflow.in.length > 0); $("#workspace-subflow-add-input").toggleClass("disabled",activeSubflow.in.length > 0);
} }
RED.menu.setDisabled("menu-item-workspace-edit", activeSubflow); RED.menu.setDisabled("menu-item-workspace-edit", activeSubflow);
RED.menu.setDisabled("menu-item-workspace-delete",RED.workspaces.count() == 1 || activeSubflow); RED.menu.setDisabled("menu-item-workspace-delete",RED.workspaces.count() == 1 || activeSubflow);
if (workspaceScrollPositions[event.workspace]) { if (workspaceScrollPositions[event.workspace]) {
chart.scrollLeft(workspaceScrollPositions[event.workspace].left); chart.scrollLeft(workspaceScrollPositions[event.workspace].left);
chart.scrollTop(workspaceScrollPositions[event.workspace].top); chart.scrollTop(workspaceScrollPositions[event.workspace].top);
@ -283,7 +283,7 @@ RED.view = (function() {
updateActiveNodes(); updateActiveNodes();
redraw(); redraw();
}); });
$('#btn-zoom-out').click(function() {zoomOut();}); $('#btn-zoom-out').click(function() {zoomOut();});
$('#btn-zoom-zero').click(function() {zoomZero();}); $('#btn-zoom-zero').click(function() {zoomZero();});
$('#btn-zoom-in').click(function() {zoomIn();}); $('#btn-zoom-in').click(function() {zoomIn();});
@ -296,50 +296,50 @@ RED.view = (function() {
else { zoomIn(); } else { zoomIn(); }
} }
}); });
// Handle nodes dragged from the palette // Handle nodes dragged from the palette
$("#chart").droppable({ $("#chart").droppable({
accept:".palette_node", accept:".palette_node",
drop: function( event, ui ) { drop: function( event, ui ) {
d3.event = event; d3.event = event;
var selected_tool = ui.draggable[0].type; var selected_tool = ui.draggable[0].type;
var m = /^subflow:(.+)$/.exec(selected_tool); var m = /^subflow:(.+)$/.exec(selected_tool);
if (activeSubflow && m) { if (activeSubflow && m) {
var subflowId = m[1]; var subflowId = m[1];
if (subflowId === activeSubflow.id) { if (subflowId === activeSubflow.id) {
RED.notify(RED._("notification.cannotAddSubflowToItself"),"error"); RED.notify(RED._("notification.error",{message: RED._("notification.errors.cannotAddSubflowToItself")}),"error");
return; return;
} }
if (RED.nodes.subflowContains(m[1],activeSubflow.id)) { if (RED.nodes.subflowContains(m[1],activeSubflow.id)) {
RED.notify(RED._("notification.cannotAddCircularReference"),"error"); RED.notify(RED._("notification.error",{message: RED._("notification.errors.cannotAddCircularReference")}),"error");
return; return;
} }
} }
var mousePos = d3.touches(this)[0]||d3.mouse(this); var mousePos = d3.touches(this)[0]||d3.mouse(this);
mousePos[1] += this.scrollTop; mousePos[1] += this.scrollTop;
mousePos[0] += this.scrollLeft; mousePos[0] += this.scrollLeft;
mousePos[1] /= scaleFactor; mousePos[1] /= scaleFactor;
mousePos[0] /= scaleFactor; mousePos[0] /= scaleFactor;
var nn = { id:(1+Math.random()*4294967295).toString(16),x: mousePos[0],y:mousePos[1],w:node_width,z:RED.workspaces.active()}; var nn = { id:(1+Math.random()*4294967295).toString(16),x: mousePos[0],y:mousePos[1],w:node_width,z:RED.workspaces.active()};
nn.type = selected_tool; nn.type = selected_tool;
nn._def = RED.nodes.getType(nn.type); nn._def = RED.nodes.getType(nn.type);
if (!m) { if (!m) {
nn.inputs = nn._def.inputs || 0; nn.inputs = nn._def.inputs || 0;
nn.outputs = nn._def.outputs; nn.outputs = nn._def.outputs;
for (var d in nn._def.defaults) { for (var d in nn._def.defaults) {
if (nn._def.defaults.hasOwnProperty(d)) { if (nn._def.defaults.hasOwnProperty(d)) {
nn[d] = nn._def.defaults[d].value; nn[d] = nn._def.defaults[d].value;
} }
} }
if (nn._def.onadd) { if (nn._def.onadd) {
nn._def.onadd.call(nn); nn._def.onadd.call(nn);
} }
@ -348,7 +348,7 @@ RED.view = (function() {
nn.inputs = subflow.in.length; nn.inputs = subflow.in.length;
nn.outputs = subflow.out.length; nn.outputs = subflow.out.length;
} }
nn.changed = true; nn.changed = true;
nn.h = Math.max(node_height,(nn.outputs||0) * 15); nn.h = Math.max(node_height,(nn.outputs||0) * 15);
RED.history.push({t:'add',nodes:[nn.id],dirty:RED.nodes.dirty()}); RED.history.push({t:'add',nodes:[nn.id],dirty:RED.nodes.dirty()});
@ -362,13 +362,13 @@ RED.view = (function() {
updateActiveNodes(); updateActiveNodes();
updateSelection(); updateSelection();
redraw(); redraw();
if (nn._def.autoedit) { if (nn._def.autoedit) {
RED.editor.edit(nn); RED.editor.edit(nn);
} }
} }
}); });
RED.keyboard.add(/* z */ 90,{ctrl:true},function(){RED.history.pop();}); RED.keyboard.add(/* z */ 90,{ctrl:true},function(){RED.history.pop();});
RED.keyboard.add(/* a */ 65,{ctrl:true},function(){selectAll();d3.event.preventDefault();}); RED.keyboard.add(/* a */ 65,{ctrl:true},function(){selectAll();d3.event.preventDefault();});
RED.keyboard.add(/* = */ 187,{ctrl:true},function(){zoomIn();d3.event.preventDefault();}); RED.keyboard.add(/* = */ 187,{ctrl:true},function(){zoomIn();d3.event.preventDefault();});
@ -652,7 +652,7 @@ RED.view = (function() {
} }
}); });
} }
selected_link = null; selected_link = null;
updateSelection(); updateSelection();
redraw(); redraw();
@ -693,17 +693,17 @@ RED.view = (function() {
} }
var selection = {}; var selection = {};
if (moving_set.length > 0) { if (moving_set.length > 0) {
selection.nodes = moving_set.map(function(n) { return n.n;}); selection.nodes = moving_set.map(function(n) { return n.n;});
} }
if (selected_link != null) { if (selected_link != null) {
selection.link = selected_link; selection.link = selected_link;
} }
eventHandler.emit("selection-changed",selection); eventHandler.emit("selection-changed",selection);
} }
function endKeyboardMove() { function endKeyboardMove() {
var ns = []; var ns = [];
for (var i=0;i<moving_set.length;i++) { for (var i=0;i<moving_set.length;i++) {
@ -746,7 +746,7 @@ RED.view = (function() {
var removedLinks = []; var removedLinks = [];
var removedSubflowOutputs = []; var removedSubflowOutputs = [];
var removedSubflowInputs = []; var removedSubflowInputs = [];
var startDirty = RED.nodes.dirty(); var startDirty = RED.nodes.dirty();
if (moving_set.length > 0) { if (moving_set.length > 0) {
for (var i=0;i<moving_set.length;i++) { for (var i=0;i<moving_set.length;i++) {
@ -789,7 +789,7 @@ RED.view = (function() {
}); });
subflowRemovedLinks.forEach(function(l) { RED.nodes.removeLink(l)}); subflowRemovedLinks.forEach(function(l) { RED.nodes.removeLink(l)});
subflowMovedLinks.forEach(function(l) { l.sourcePort--; }); subflowMovedLinks.forEach(function(l) { l.sourcePort--; });
removedLinks = removedLinks.concat(subflowRemovedLinks); removedLinks = removedLinks.concat(subflowRemovedLinks);
for (var j=output.i;j<activeSubflow.out.length;j++) { for (var j=output.i;j<activeSubflow.out.length;j++) {
activeSubflow.out[j].i--; activeSubflow.out[j].i--;
@ -813,7 +813,7 @@ RED.view = (function() {
activeSubflow.in = []; activeSubflow.in = [];
$("#workspace-subflow-add-input").toggleClass("disabled",false); $("#workspace-subflow-add-input").toggleClass("disabled",false);
} }
if (activeSubflow) { if (activeSubflow) {
RED.nodes.filterNodes({type:"subflow:"+activeSubflow.id}).forEach(function(n) { RED.nodes.filterNodes({type:"subflow:"+activeSubflow.id}).forEach(function(n) {
n.changed = true; n.changed = true;
@ -827,7 +827,7 @@ RED.view = (function() {
}); });
RED.editor.validateNode(activeSubflow); RED.editor.validateNode(activeSubflow);
} }
moving_set = []; moving_set = [];
if (removedNodes.length > 0 || removedSubflowOutputs.length > 0 || removedSubflowInputs.length > 0) { if (removedNodes.length > 0 || removedSubflowOutputs.length > 0 || removedSubflowInputs.length > 0) {
RED.nodes.dirty(true); RED.nodes.dirty(true);
@ -856,7 +856,7 @@ RED.view = (function() {
} }
} }
clipboard = JSON.stringify(nns); clipboard = JSON.stringify(nns);
RED.notify(RED._("notification.nodeCopied",{count:nns.length})); RED.notify(RED._("clipboard.nodeCopied",{count:nns.length}));
} }
} }
@ -1043,9 +1043,9 @@ RED.view = (function() {
redraw(); redraw();
} }
} else if (d.changed) { } else if (d.changed) {
RED.notify(RED._("notification.undeployedChanges"),"warning"); RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.undeployedChanges")}),"warning");
} else { } else {
RED.notify(RED._("notification.nodeActionDisabled"),"warning"); RED.notify(RED._("notification.warning", {message:RED._("notification.warnings.nodeActionDisabled")}),"warning");
} }
d3.event.preventDefault(); d3.event.preventDefault();
} }
@ -1070,9 +1070,9 @@ RED.view = (function() {
// Don't bother redrawing nodes if we're drawing links // Don't bother redrawing nodes if we're drawing links
if (mouse_mode != RED.state.JOINING) { if (mouse_mode != RED.state.JOINING) {
var dirtyNodes = {}; var dirtyNodes = {};
if (activeSubflow) { if (activeSubflow) {
var subflowOutputs = vis.selectAll(".subflowoutput").data(activeSubflow.out,function(d,i){ return d.id;}); var subflowOutputs = vis.selectAll(".subflowoutput").data(activeSubflow.out,function(d,i){ return d.id;});
subflowOutputs.exit().remove(); subflowOutputs.exit().remove();
@ -1082,7 +1082,7 @@ RED.view = (function() {
d.h=40; d.h=40;
}); });
outGroup.append("rect").attr("class","subflowport").attr("rx",8).attr("ry",8).attr("width",40).attr("height",40) outGroup.append("rect").attr("class","subflowport").attr("rx",8).attr("ry",8).attr("width",40).attr("height",40)
// TODO: This is exactly the same set of handlers used for regular nodes - DRY // TODO: This is exactly the same set of handlers used for regular nodes - DRY
.on("mouseup",nodeMouseUp) .on("mouseup",nodeMouseUp)
.on("mousedown",nodeMouseDown) .on("mousedown",nodeMouseDown)
.on("touchstart",function(d) { .on("touchstart",function(d) {
@ -1094,7 +1094,7 @@ RED.view = (function() {
touchStartTime = setTimeout(function() { touchStartTime = setTimeout(function() {
showTouchMenu(obj,pos); showTouchMenu(obj,pos);
},touchLongPressTimeout); },touchLongPressTimeout);
nodeMouseDown.call(this,d) nodeMouseDown.call(this,d)
}) })
.on("touchend", function(d) { .on("touchend", function(d) {
clearTimeout(touchStartTime); clearTimeout(touchStartTime);
@ -1105,7 +1105,7 @@ RED.view = (function() {
} }
nodeMouseUp.call(this,d); nodeMouseUp.call(this,d);
}); });
outGroup.append("rect").attr("class","port").attr("rx",3).attr("ry",3).attr("width",10).attr("height",10).attr("x",-5).attr("y",15) outGroup.append("rect").attr("class","port").attr("rx",3).attr("ry",3).attr("width",10).attr("height",10).attr("x",-5).attr("y",15)
.on("mousedown", function(d,i){portMouseDown(d,1,0);} ) .on("mousedown", function(d,i){portMouseDown(d,1,0);} )
.on("touchstart", function(d,i){portMouseDown(d,1,0);} ) .on("touchstart", function(d,i){portMouseDown(d,1,0);} )
@ -1125,7 +1125,7 @@ RED.view = (function() {
d.h=40; d.h=40;
}); });
inGroup.append("rect").attr("class","subflowport").attr("rx",8).attr("ry",8).attr("width",40).attr("height",40) inGroup.append("rect").attr("class","subflowport").attr("rx",8).attr("ry",8).attr("width",40).attr("height",40)
// TODO: This is exactly the same set of handlers used for regular nodes - DRY // TODO: This is exactly the same set of handlers used for regular nodes - DRY
.on("mouseup",nodeMouseUp) .on("mouseup",nodeMouseUp)
.on("mousedown",nodeMouseDown) .on("mousedown",nodeMouseDown)
.on("touchstart",function(d) { .on("touchstart",function(d) {
@ -1137,7 +1137,7 @@ RED.view = (function() {
touchStartTime = setTimeout(function() { touchStartTime = setTimeout(function() {
showTouchMenu(obj,pos); showTouchMenu(obj,pos);
},touchLongPressTimeout); },touchLongPressTimeout);
nodeMouseDown.call(this,d) nodeMouseDown.call(this,d)
}) })
.on("touchend", function(d) { .on("touchend", function(d) {
clearTimeout(touchStartTime); clearTimeout(touchStartTime);
@ -1148,7 +1148,7 @@ RED.view = (function() {
} }
nodeMouseUp.call(this,d); nodeMouseUp.call(this,d);
}); });
inGroup.append("rect").attr("class","port").attr("rx",3).attr("ry",3).attr("width",10).attr("height",10).attr("x",35).attr("y",15) inGroup.append("rect").attr("class","port").attr("rx",3).attr("ry",3).attr("width",10).attr("height",10).attr("x",35).attr("y",15)
.on("mousedown", function(d,i){portMouseDown(d,0,i);} ) .on("mousedown", function(d,i){portMouseDown(d,0,i);} )
.on("touchstart", function(d,i){portMouseDown(d,0,i);} ) .on("touchstart", function(d,i){portMouseDown(d,0,i);} )
@ -1157,9 +1157,9 @@ RED.view = (function() {
.on("mouseover",function(d,i) { var port = d3.select(this); port.classed("port_hovered",(mouse_mode!=RED.state.JOINING || mousedown_port_type !== 0 ));}) .on("mouseover",function(d,i) { var port = d3.select(this); port.classed("port_hovered",(mouse_mode!=RED.state.JOINING || mousedown_port_type !== 0 ));})
.on("mouseout",function(d,i) { var port = d3.select(this); port.classed("port_hovered",false);}); .on("mouseout",function(d,i) { var port = d3.select(this); port.classed("port_hovered",false);});
inGroup.append("svg:text").attr('class','port_label').attr('x',18).attr('y',20).style("font-size","10px").text("input"); inGroup.append("svg:text").attr('class','port_label').attr('x',18).attr('y',20).style("font-size","10px").text("input");
subflowOutputs.each(function(d,i) { subflowOutputs.each(function(d,i) {
if (d.dirty) { if (d.dirty) {
var output = d3.select(this); var output = d3.select(this);
@ -1183,7 +1183,7 @@ RED.view = (function() {
vis.selectAll(".subflowoutput").remove(); vis.selectAll(".subflowoutput").remove();
vis.selectAll(".subflowinput").remove(); vis.selectAll(".subflowinput").remove();
} }
var node = vis.selectAll(".nodegroup").data(activeNodes,function(d){return d.id}); var node = vis.selectAll(".nodegroup").data(activeNodes,function(d){return d.id});
node.exit().remove(); node.exit().remove();
@ -1318,7 +1318,7 @@ RED.view = (function() {
//icon.attr('class','node_icon_shade node_icon_shade_'+d._def.align); //icon.attr('class','node_icon_shade node_icon_shade_'+d._def.align);
//icon.attr('class','node_icon_shade_border node_icon_shade_border_'+d._def.align); //icon.attr('class','node_icon_shade_border node_icon_shade_border_'+d._def.align);
} }
//if (d.inputs > 0 && d._def.align == null) { //if (d.inputs > 0 && d._def.align == null) {
// icon_shade.attr("width",35); // icon_shade.attr("width",35);
// icon.attr("transform","translate(5,0)"); // icon.attr("transform","translate(5,0)");
@ -1388,7 +1388,7 @@ RED.view = (function() {
var thisNode = d3.select(this); var thisNode = d3.select(this);
//thisNode.selectAll(".centerDot").attr({"cx":function(d) { return d.w/2;},"cy":function(d){return d.h/2}}); //thisNode.selectAll(".centerDot").attr({"cx":function(d) { return d.w/2;},"cy":function(d){return d.h/2}});
thisNode.attr("transform", function(d) { return "translate(" + (d.x-d.w/2) + "," + (d.y-d.h/2) + ")"; }); thisNode.attr("transform", function(d) { return "translate(" + (d.x-d.w/2) + "," + (d.y-d.h/2) + ")"; });
if (mouse_mode != RED.state.MOVING_ACTIVE) { if (mouse_mode != RED.state.MOVING_ACTIVE) {
thisNode.selectAll(".node") thisNode.selectAll(".node")
.attr("width",function(d){return d.w}) .attr("width",function(d){return d.w})
@ -1398,13 +1398,13 @@ RED.view = (function() {
; ;
//thisNode.selectAll(".node-gradient-top").attr("width",function(d){return d.w}); //thisNode.selectAll(".node-gradient-top").attr("width",function(d){return d.w});
//thisNode.selectAll(".node-gradient-bottom").attr("width",function(d){return d.w}).attr("y",function(d){return d.h-30}); //thisNode.selectAll(".node-gradient-bottom").attr("width",function(d){return d.w}).attr("y",function(d){return d.h-30});
thisNode.selectAll(".node_icon_group_right").attr('transform', function(d){return "translate("+(d.w-30)+",0)"}); thisNode.selectAll(".node_icon_group_right").attr('transform', function(d){return "translate("+(d.w-30)+",0)"});
thisNode.selectAll(".node_label_right").attr('x', function(d){return d.w-38}); thisNode.selectAll(".node_label_right").attr('x', function(d){return d.w-38});
//thisNode.selectAll(".node_icon_right").attr("x",function(d){return d.w-d3.select(this).attr("width")-1-(d.outputs>0?5:0);}); //thisNode.selectAll(".node_icon_right").attr("x",function(d){return d.w-d3.select(this).attr("width")-1-(d.outputs>0?5:0);});
//thisNode.selectAll(".node_icon_shade_right").attr("x",function(d){return d.w-30;}); //thisNode.selectAll(".node_icon_shade_right").attr("x",function(d){return d.w-30;});
//thisNode.selectAll(".node_icon_shade_border_right").attr("d",function(d){return "M "+(d.w-30)+" 1 l 0 "+(d.h-2)}); //thisNode.selectAll(".node_icon_shade_border_right").attr("d",function(d){return "M "+(d.w-30)+" 1 l 0 "+(d.h-2)});
var inputPorts = thisNode.selectAll(".port_input"); var inputPorts = thisNode.selectAll(".port_input");
if (d.inputs === 0 && !inputPorts.empty()) { if (d.inputs === 0 && !inputPorts.empty()) {
inputPorts.remove(); inputPorts.remove();
@ -1419,13 +1419,13 @@ RED.view = (function() {
.on("mouseover",function(d) { var port = d3.select(this); port.classed("port_hovered",(mouse_mode!=RED.state.JOINING || mousedown_port_type != 1 ));}) .on("mouseover",function(d) { var port = d3.select(this); port.classed("port_hovered",(mouse_mode!=RED.state.JOINING || mousedown_port_type != 1 ));})
.on("mouseout",function(d) { var port = d3.select(this); port.classed("port_hovered",false);}) .on("mouseout",function(d) { var port = d3.select(this); port.classed("port_hovered",false);})
} }
var numOutputs = d.outputs; var numOutputs = d.outputs;
var y = (d.h/2)-((numOutputs-1)/2)*13; var y = (d.h/2)-((numOutputs-1)/2)*13;
d.ports = d.ports || d3.range(numOutputs); d.ports = d.ports || d3.range(numOutputs);
d._ports = thisNode.selectAll(".port_output").data(d.ports); d._ports = thisNode.selectAll(".port_output").data(d.ports);
var output_group = d._ports.enter().append("g").attr("class","port_output"); var output_group = d._ports.enter().append("g").attr("class","port_output");
output_group.append("rect").attr("class","port").attr("rx",3).attr("ry",3).attr("width",10).attr("height",10) output_group.append("rect").attr("class","port").attr("rx",3).attr("ry",3).attr("width",10).attr("height",10)
.on("mousedown",(function(){var node = d; return function(d,i){portMouseDown(node,0,i);}})() ) .on("mousedown",(function(){var node = d; return function(d,i){portMouseDown(node,0,i);}})() )
.on("touchstart",(function(){var node = d; return function(d,i){portMouseDown(node,0,i);}})() ) .on("touchstart",(function(){var node = d; return function(d,i){portMouseDown(node,0,i);}})() )
@ -1433,7 +1433,7 @@ RED.view = (function() {
.on("touchend",(function(){var node = d; return function(d,i){portMouseUp(node,0,i);}})() ) .on("touchend",(function(){var node = d; return function(d,i){portMouseUp(node,0,i);}})() )
.on("mouseover",function(d,i) { var port = d3.select(this); port.classed("port_hovered",(mouse_mode!=RED.state.JOINING || mousedown_port_type !== 0 ));}) .on("mouseover",function(d,i) { var port = d3.select(this); port.classed("port_hovered",(mouse_mode!=RED.state.JOINING || mousedown_port_type !== 0 ));})
.on("mouseout",function(d,i) { var port = d3.select(this); port.classed("port_hovered",false);}); .on("mouseout",function(d,i) { var port = d3.select(this); port.classed("port_hovered",false);});
d._ports.exit().remove(); d._ports.exit().remove();
if (d._ports) { if (d._ports) {
numOutputs = d.outputs || 1; numOutputs = d.outputs || 1;
@ -1461,7 +1461,7 @@ RED.view = (function() {
(d._def.align?' node_label_'+d._def.align:'')+ (d._def.align?' node_label_'+d._def.align:'')+
(d._def.labelStyle?' '+(typeof d._def.labelStyle == "function" ? d._def.labelStyle.call(d):d._def.labelStyle):'') ; (d._def.labelStyle?' '+(typeof d._def.labelStyle == "function" ? d._def.labelStyle.call(d):d._def.labelStyle):'') ;
}); });
if (d._def.icon) { if (d._def.icon) {
icon = thisNode.select(".node_icon"); icon = thisNode.select(".node_icon");
var current_url = icon.attr("xlink:href"); var current_url = icon.attr("xlink:href");
@ -1482,27 +1482,27 @@ RED.view = (function() {
} }
} }
} }
thisNode.selectAll(".node_tools").attr("x",function(d){return d.w-35;}).attr("y",function(d){return d.h-20;}); thisNode.selectAll(".node_tools").attr("x",function(d){return d.w-35;}).attr("y",function(d){return d.h-20;});
thisNode.selectAll(".node_changed") thisNode.selectAll(".node_changed")
.attr("x",function(d){return d.w-10}) .attr("x",function(d){return d.w-10})
.classed("hidden",function(d) { return !d.changed; }); .classed("hidden",function(d) { return !d.changed; });
thisNode.selectAll(".node_error") thisNode.selectAll(".node_error")
.attr("x",function(d){return d.w-10-(d.changed?13:0)}) .attr("x",function(d){return d.w-10-(d.changed?13:0)})
.classed("hidden",function(d) { return d.valid; }); .classed("hidden",function(d) { return d.valid; });
thisNode.selectAll(".port_input").each(function(d,i) { thisNode.selectAll(".port_input").each(function(d,i) {
var port = d3.select(this); var port = d3.select(this);
port.attr("transform",function(d){return "translate(-5,"+((d.h/2)-5)+")";}) port.attr("transform",function(d){return "translate(-5,"+((d.h/2)-5)+")";})
}); });
thisNode.selectAll(".node_icon").attr("y",function(d){return (d.h-d3.select(this).attr("height"))/2;}); thisNode.selectAll(".node_icon").attr("y",function(d){return (d.h-d3.select(this).attr("height"))/2;});
thisNode.selectAll(".node_icon_shade").attr("height",function(d){return d.h;}); thisNode.selectAll(".node_icon_shade").attr("height",function(d){return d.h;});
thisNode.selectAll(".node_icon_shade_border").attr("d",function(d){ return "M "+(("right" == d._def.align) ?0:30)+" 1 l 0 "+(d.h-2)}); thisNode.selectAll(".node_icon_shade_border").attr("d",function(d){ return "M "+(("right" == d._def.align) ?0:30)+" 1 l 0 "+(d.h-2)});
thisNode.selectAll('.node_button').attr("opacity",function(d) { thisNode.selectAll('.node_button').attr("opacity",function(d) {
return (activeSubflow||d.changed)?0.4:1 return (activeSubflow||d.changed)?0.4:1
}); });
@ -1522,11 +1522,11 @@ RED.view = (function() {
} }
return 1; return 1;
}); });
//thisNode.selectAll('.node_right_button').attr("transform",function(d){return "translate("+(d.w - d._def.button.width.call(d))+","+0+")";}).attr("fill",function(d) { //thisNode.selectAll('.node_right_button').attr("transform",function(d){return "translate("+(d.w - d._def.button.width.call(d))+","+0+")";}).attr("fill",function(d) {
// return typeof d._def.button.color === "function" ? d._def.button.color.call(d):(d._def.button.color != null ? d._def.button.color : d._def.color) // return typeof d._def.button.color === "function" ? d._def.button.color.call(d):(d._def.button.color != null ? d._def.button.color : d._def.color)
//}); //});
thisNode.selectAll('.node_badge_group').attr("transform",function(d){return "translate("+(d.w-40)+","+(d.h+3)+")";}); thisNode.selectAll('.node_badge_group').attr("transform",function(d){return "translate("+(d.w-40)+","+(d.h+3)+")";});
thisNode.selectAll('text.node_badge_label').text(function(d,i) { thisNode.selectAll('text.node_badge_label').text(function(d,i) {
if (d._def.badge) { if (d._def.badge) {
@ -1581,7 +1581,7 @@ RED.view = (function() {
} }
); );
var linkEnter = link.enter().insert("g",".node").attr("class","link"); var linkEnter = link.enter().insert("g",".node").attr("class","link");
linkEnter.each(function(d,i) { linkEnter.each(function(d,i) {
var l = d3.select(this); var l = d3.select(this);
d.added = true; d.added = true;
@ -1608,7 +1608,7 @@ RED.view = (function() {
l.append("svg:path").attr("class","link_line link_path") l.append("svg:path").attr("class","link_line link_path")
.classed("link_subflow", function(d) { return activeSubflow && (d.source.type === "subflow" || d.target.type === "subflow") }); .classed("link_subflow", function(d) { return activeSubflow && (d.source.type === "subflow" || d.target.type === "subflow") });
}); });
link.exit().remove(); link.exit().remove();
var links = vis.selectAll(".link_path"); var links = vis.selectAll(".link_path");
links.each(function(d) { links.each(function(d) {
@ -1618,7 +1618,7 @@ RED.view = (function() {
var numOutputs = d.source.outputs || 1; var numOutputs = d.source.outputs || 1;
var sourcePort = d.sourcePort || 0; var sourcePort = d.sourcePort || 0;
var y = -((numOutputs-1)/2)*13 +13*sourcePort; var y = -((numOutputs-1)/2)*13 +13*sourcePort;
var dy = d.target.y-(d.source.y+y); var dy = d.target.y-(d.source.y+y);
var dx = (d.target.x-d.target.w/2)-(d.source.x+d.source.w/2); var dx = (d.target.x-d.target.w/2)-(d.source.x+d.source.w/2);
var delta = Math.sqrt(dy*dy+dx*dx); var delta = Math.sqrt(dy*dy+dx*dx);
@ -1627,19 +1627,19 @@ RED.view = (function() {
if (delta < node_width) { if (delta < node_width) {
scale = 0.75-0.75*((node_width-delta)/node_width); scale = 0.75-0.75*((node_width-delta)/node_width);
} }
if (dx < 0) { if (dx < 0) {
scale += 2*(Math.min(5*node_width,Math.abs(dx))/(5*node_width)); scale += 2*(Math.min(5*node_width,Math.abs(dx))/(5*node_width));
if (Math.abs(dy) < 3*node_height) { if (Math.abs(dy) < 3*node_height) {
scaleY = ((dy>0)?0.5:-0.5)*(((3*node_height)-Math.abs(dy))/(3*node_height))*(Math.min(node_width,Math.abs(dx))/(node_width)) ; scaleY = ((dy>0)?0.5:-0.5)*(((3*node_height)-Math.abs(dy))/(3*node_height))*(Math.min(node_width,Math.abs(dx))/(node_width)) ;
} }
} }
d.x1 = d.source.x+d.source.w/2; d.x1 = d.source.x+d.source.w/2;
d.y1 = d.source.y+y; d.y1 = d.source.y+y;
d.x2 = d.target.x-d.target.w/2; d.x2 = d.target.x-d.target.w/2;
d.y2 = d.target.y; d.y2 = d.target.y;
return "M "+(d.source.x+d.source.w/2)+" "+(d.source.y+y)+ return "M "+(d.source.x+d.source.w/2)+" "+(d.source.y+y)+
" C "+(d.source.x+d.source.w/2+scale*node_width)+" "+(d.source.y+y+scaleY*node_height)+" "+ " C "+(d.source.x+d.source.w/2+scale*node_width)+" "+(d.source.y+y+scaleY*node_height)+" "+
(d.target.x-d.target.w/2-scale*node_width)+" "+(d.target.y-scaleY*node_height)+" "+ (d.target.x-d.target.w/2-scale*node_width)+" "+(d.target.y-scaleY*node_height)+" "+
@ -1647,9 +1647,9 @@ RED.view = (function() {
}); });
} }
}) })
link.classed("link_selected", function(d) { return d === selected_link || d.selected; }); link.classed("link_selected", function(d) { return d === selected_link || d.selected; });
link.classed("link_unknown",function(d) { link.classed("link_unknown",function(d) {
delete d.added; delete d.added;
return d.target.type == "unknown" || d.source.type == "unknown" return d.target.type == "unknown" || d.source.type == "unknown"
}); });
@ -1662,12 +1662,12 @@ RED.view = (function() {
} }
).classed("link_selected", false); ).classed("link_selected", false);
} }
if (d3.event) { if (d3.event) {
d3.event.preventDefault(); d3.event.preventDefault();
} }
} }
function focusView() { function focusView() {
@ -1688,7 +1688,7 @@ RED.view = (function() {
var new_links = result[1]; var new_links = result[1];
var new_workspaces = result[2]; var new_workspaces = result[2];
var new_subflows = result[3]; var new_subflows = result[3];
var new_ms = new_nodes.filter(function(n) { return n.z == RED.workspaces.active() }).map(function(n) { return {n:n};}); var new_ms = new_nodes.filter(function(n) { return n.z == RED.workspaces.active() }).map(function(n) { return {n:n};});
var new_node_ids = new_nodes.map(function(n){ return n.id; }); var new_node_ids = new_nodes.map(function(n){ return n.id; });
@ -1764,7 +1764,7 @@ RED.view = (function() {
// TODO: DRY // TODO: DRY
var eventHandler = (function() { var eventHandler = (function() {
var handlers = {}; var handlers = {};
return { return {
on: function(evt,func) { on: function(evt,func) {
handlers[evt] = handlers[evt]||[]; handlers[evt] = handlers[evt]||[];
@ -1775,12 +1775,12 @@ RED.view = (function() {
for (var i=0;i<handlers[evt].length;i++) { for (var i=0;i<handlers[evt].length;i++) {
handlers[evt][i](arg); handlers[evt][i](arg);
} }
} }
} }
} }
})(); })();
return { return {
init: init, init: init,
on: eventHandler.on, on: eventHandler.on,
@ -1791,13 +1791,13 @@ RED.view = (function() {
mouse_mode = state; mouse_mode = state;
} }
}, },
redraw: function(updateActive) { redraw: function(updateActive) {
if (updateActive) { if (updateActive) {
updateActiveNodes(); updateActiveNodes();
} }
RED.workspaces.refresh(); RED.workspaces.refresh();
redraw(); redraw();
}, },
focus: focusView, focus: focusView,
importNodes: importNodes, importNodes: importNodes,

View File

@ -16,7 +16,7 @@
RED.workspaces = (function() { RED.workspaces = (function() {
var activeWorkspace = 0; var activeWorkspace = 0;
var workspaceIndex = 0; var workspaceIndex = 0;
@ -29,7 +29,7 @@ RED.workspaces = (function() {
do { do {
workspaceIndex += 1; workspaceIndex += 1;
} while($("#workspace-tabs a[title='Sheet "+workspaceIndex+"']").size() !== 0); } while($("#workspace-tabs a[title='Sheet "+workspaceIndex+"']").size() !== 0);
ws = {type:"tab",id:tabId,label:"Sheet "+workspaceIndex}; ws = {type:"tab",id:tabId,label:"Sheet "+workspaceIndex};
RED.nodes.addWorkspace(ws); RED.nodes.addWorkspace(ws);
workspace_tabs.addTab(ws); workspace_tabs.addTab(ws);
@ -56,10 +56,10 @@ RED.workspaces = (function() {
RED.nodes.dirty(true); RED.nodes.dirty(true);
} else { } else {
$( "#node-dialog-delete-workspace" ).dialog('option','workspace',ws); $( "#node-dialog-delete-workspace" ).dialog('option','workspace',ws);
$( "#node-dialog-delete-workspace-content" ).text(RED._("workspaces.deleteDialog",{label:ws.label})); $( "#node-dialog-delete-workspace-content" ).text(RED._("workspace.delete",{label:ws.label}));
$( "#node-dialog-delete-workspace" ).dialog('open'); $( "#node-dialog-delete-workspace" ).dialog('open');
} }
} }
function showRenameWorkspaceDialog(id) { function showRenameWorkspaceDialog(id) {
var ws = RED.nodes.workspace(id); var ws = RED.nodes.workspace(id);
$( "#node-dialog-rename-workspace" ).dialog("option","workspace",ws); $( "#node-dialog-rename-workspace" ).dialog("option","workspace",ws);
@ -77,7 +77,7 @@ RED.workspaces = (function() {
$( "#node-input-workspace-name" ).val(ws.label); $( "#node-input-workspace-name" ).val(ws.label);
$( "#node-dialog-rename-workspace" ).dialog("open"); $( "#node-dialog-rename-workspace" ).dialog("open");
} }
var workspace_tabs; var workspace_tabs;
function createWorkspaceTabs(){ function createWorkspaceTabs(){
workspace_tabs = RED.tabs.create({ workspace_tabs = RED.tabs.create({
@ -93,7 +93,7 @@ RED.workspaces = (function() {
} }
activeWorkspace = tab.id; activeWorkspace = tab.id;
event.workspace = activeWorkspace; event.workspace = activeWorkspace;
eventHandler.emit("change",event); eventHandler.emit("change",event);
}, },
ondblclick: function(tab) { ondblclick: function(tab) {
@ -118,18 +118,18 @@ RED.workspaces = (function() {
RED.menu.removeItem("menu-item-workspace-menu-"+tab.id.replace(".","-")); RED.menu.removeItem("menu-item-workspace-menu-"+tab.id.replace(".","-"));
} }
}); });
$("#node-dialog-rename-workspace form" ).submit(function(e) { e.preventDefault();}); $("#node-dialog-rename-workspace form" ).submit(function(e) { e.preventDefault();});
$( "#node-dialog-rename-workspace" ).dialog({ $( "#node-dialog-rename-workspace" ).dialog({
modal: true, modal: true,
autoOpen: false, autoOpen: false,
width: 500, width: 500,
title: RED._("dialog.renameSheet"), title: RED._("workspace.renameSheet"),
buttons: [ buttons: [
{ {
class: 'leftButton', class: 'leftButton',
text: RED._("dialog.delete"), text: RED._("common.label.delete"),
click: function() { click: function() {
var workspace = $(this).dialog('option','workspace'); var workspace = $(this).dialog('option','workspace');
$( this ).dialog( "close" ); $( this ).dialog( "close" );
@ -137,7 +137,7 @@ RED.workspaces = (function() {
} }
}, },
{ {
text: RED._("dialog.ok"), text: RED._("common.label.ok"),
click: function() { click: function() {
var workspace = $(this).dialog('option','workspace'); var workspace = $(this).dialog('option','workspace');
var label = $( "#node-input-workspace-name" ).val(); var label = $( "#node-input-workspace-name" ).val();
@ -151,7 +151,7 @@ RED.workspaces = (function() {
} }
}, },
{ {
text: RED._("dialog.cancel"), text: RED._("common.label.cancel"),
click: function() { click: function() {
$( this ).dialog( "close" ); $( this ).dialog( "close" );
} }
@ -168,10 +168,10 @@ RED.workspaces = (function() {
modal: true, modal: true,
autoOpen: false, autoOpen: false,
width: 500, width: 500,
title: RED._("dialog.confirmDelete"), title: RED._("workspace.confirmDelete"),
buttons: [ buttons: [
{ {
text: RED._("dialog.ok"), text: RED._("common.label.ok"),
click: function() { click: function() {
var workspace = $(this).dialog('option','workspace'); var workspace = $(this).dialog('option','workspace');
deleteWorkspace(workspace,true); deleteWorkspace(workspace,true);
@ -179,7 +179,7 @@ RED.workspaces = (function() {
} }
}, },
{ {
text: RED._("dialog.cancel"), text: RED._("common.label.cancel"),
click: function() { click: function() {
$( this ).dialog( "close" ); $( this ).dialog( "close" );
} }
@ -194,21 +194,21 @@ RED.workspaces = (function() {
}); });
} }
function init() { function init() {
createWorkspaceTabs(); createWorkspaceTabs();
$('#btn-workspace-add-tab').on("click",function(e) {addWorkspace(); e.preventDefault()}); $('#btn-workspace-add-tab').on("click",function(e) {addWorkspace(); e.preventDefault()});
RED.sidebar.on("resize",workspace_tabs.resize); RED.sidebar.on("resize",workspace_tabs.resize);
RED.menu.setAction('menu-item-workspace-delete',function() { RED.menu.setAction('menu-item-workspace-delete',function() {
deleteWorkspace(RED.nodes.workspace(activeWorkspace)); deleteWorkspace(RED.nodes.workspace(activeWorkspace));
}); });
} }
// TODO: DRY // TODO: DRY
var eventHandler = (function() { var eventHandler = (function() {
var handlers = {}; var handlers = {};
return { return {
on: function(evt,func) { on: function(evt,func) {
handlers[evt] = handlers[evt]||[]; handlers[evt] = handlers[evt]||[];
@ -219,12 +219,12 @@ RED.workspaces = (function() {
for (var i=0;i<handlers[evt].length;i++) { for (var i=0;i<handlers[evt].length;i++) {
handlers[evt][i](arg); handlers[evt][i](arg);
} }
} }
} }
} }
})(); })();
function removeWorkspace(ws) { function removeWorkspace(ws) {
if (!ws) { if (!ws) {
deleteWorkspace(RED.nodes.workspace(activeWorkspace)); deleteWorkspace(RED.nodes.workspace(activeWorkspace));
@ -239,7 +239,7 @@ RED.workspaces = (function() {
on: eventHandler.on, on: eventHandler.on,
add: addWorkspace, add: addWorkspace,
remove: removeWorkspace, remove: removeWorkspace,
edit: function(id) { edit: function(id) {
showRenameWorkspaceDialog(id||activeWorkspace); showRenameWorkspaceDialog(id||activeWorkspace);
}, },
@ -256,15 +256,15 @@ RED.workspaces = (function() {
if (!workspace_tabs.contains(id)) { if (!workspace_tabs.contains(id)) {
var sf = RED.nodes.subflow(id); var sf = RED.nodes.subflow(id);
if (sf) { if (sf) {
addWorkspace({type:"subflow",id:id,label:RED._("workspaces.subflow")+sf.name, closeable: true}); addWorkspace({type:"subflow",id:id,label:RED._("subflow.tabLabel",{name:sf.name}), closeable: true});
} }
} }
workspace_tabs.activateTab(id); workspace_tabs.activateTab(id);
}, },
refresh: function() { refresh: function() {
RED.nodes.eachSubflow(function(sf) { RED.nodes.eachSubflow(function(sf) {
if (workspace_tabs.contains(sf.id)) { if (workspace_tabs.contains(sf.id)) {
workspace_tabs.renameTab(sf.id,RED._("workspaces.subflow")+sf.name); workspace_tabs.renameTab(sf.id,RED._("subflow.tabLabel",{name:sf.name}));
} }
}); });
}, },

View File

@ -14,13 +14,13 @@
* limitations under the License. * limitations under the License.
**/ **/
RED.user = (function() { RED.user = (function() {
function login(opts,done) { function login(opts,done) {
if (typeof opts == 'function') { if (typeof opts == 'function') {
done = opts; done = opts;
opts = {}; opts = {};
} }
var dialog = $('<div id="node-dialog-login" class="hide">'+ var dialog = $('<div id="node-dialog-login" class="hide">'+
'<div style="display: inline-block;width: 250px; vertical-align: top; margin-right: 10px; margin-bottom: 20px;"><img id="node-dialog-login-image" src=""/></div>'+ '<div style="display: inline-block;width: 250px; vertical-align: top; margin-right: 10px; margin-bottom: 20px;"><img id="node-dialog-login-image" src=""/></div>'+
'<div style="display: inline-block; width: 250px; vertical-align: bottom; margin-left: 10px; margin-bottom: 20px;">'+ '<div style="display: inline-block; width: 250px; vertical-align: bottom; margin-left: 10px; margin-bottom: 20px;">'+
@ -37,7 +37,7 @@ RED.user = (function() {
resizable: false, resizable: false,
draggable: false draggable: false
}); });
$("#node-dialog-login-fields").empty(); $("#node-dialog-login-fields").empty();
$.ajax({ $.ajax({
dataType: "json", dataType: "json",
@ -45,7 +45,7 @@ RED.user = (function() {
success: function(data) { success: function(data) {
if (data.type == "credentials") { if (data.type == "credentials") {
var i=0; var i=0;
if (data.image) { if (data.image) {
$("#node-dialog-login-image").attr("src",data.image); $("#node-dialog-login-image").attr("src",data.image);
} else { } else {
@ -56,7 +56,7 @@ RED.user = (function() {
var row = $("<div/>",{id:"rrr"+i,class:"form-row"}); var row = $("<div/>",{id:"rrr"+i,class:"form-row"});
$('<label for="node-dialog-login-'+field.id+'">'+field.label+':</label><br/>').appendTo(row); $('<label for="node-dialog-login-'+field.id+'">'+field.label+':</label><br/>').appendTo(row);
var input = $('<input style="width: 100%" id="node-dialog-login-'+field.id+'" type="'+field.type+'" tabIndex="'+(i+1)+'"/>').appendTo(row); var input = $('<input style="width: 100%" id="node-dialog-login-'+field.id+'" type="'+field.type+'" tabIndex="'+(i+1)+'"/>').appendTo(row);
if (i<data.prompts.length-1) { if (i<data.prompts.length-1) {
input.keypress( input.keypress(
(function() { (function() {
@ -72,17 +72,17 @@ RED.user = (function() {
} }
row.appendTo("#node-dialog-login-fields"); row.appendTo("#node-dialog-login-fields");
} }
$('<div class="form-row" style="text-align: right; margin-top: 10px;"><span id="node-dialog-login-failed" style="line-height: 2em;float:left;" class="hide">'+RED._("dialog.loginFailed")+'</span><img src="red/images/spin.svg" style="height: 30px; margin-right: 10px; " class="login-spinner hide"/>'+ $('<div class="form-row" style="text-align: right; margin-top: 10px;"><span id="node-dialog-login-failed" style="line-height: 2em;float:left;" class="hide">'+RED._("user.loginFailed")+'</span><img src="red/images/spin.svg" style="height: 30px; margin-right: 10px; " class="login-spinner hide"/>'+
(opts.cancelable?'<a href="#" id="node-dialog-login-cancel" style="margin-right: 20px;" tabIndex="'+(i+1)+'">'+RED._("dialog.cancel")+'</a>':'')+ (opts.cancelable?'<a href="#" id="node-dialog-login-cancel" style="margin-right: 20px;" tabIndex="'+(i+1)+'">'+RED._("common.label.cancel")+'</a>':'')+
'<input type="submit" id="node-dialog-login-submit" style="width: auto;" tabIndex="'+(i+2)+'" value="'+RED._("dialog.login")+'"></div>').appendTo("#node-dialog-login-fields"); '<input type="submit" id="node-dialog-login-submit" style="width: auto;" tabIndex="'+(i+2)+'" value="'+RED._("user.login")+'"></div>').appendTo("#node-dialog-login-fields");
$("#node-dialog-login-submit").button(); $("#node-dialog-login-submit").button();
$("#node-dialog-login-fields").submit(function(event) { $("#node-dialog-login-fields").submit(function(event) {
$("#node-dialog-login-submit").button("option","disabled",true); $("#node-dialog-login-submit").button("option","disabled",true);
$("#node-dialog-login-failed").hide(); $("#node-dialog-login-failed").hide();
$(".login-spinner").show(); $(".login-spinner").show();
var body = { var body = {
client_id: "node-red-editor", client_id: "node-red-editor",
grant_type: "password", grant_type: "password",
@ -116,7 +116,7 @@ RED.user = (function() {
} }
} }
dialog.dialog("open"); dialog.dialog("open");
} }
}); });
} }
@ -131,7 +131,7 @@ RED.user = (function() {
} }
}) })
} }
function updateUserMenu() { function updateUserMenu() {
$("#usermenu-submenu li").remove(); $("#usermenu-submenu li").remove();
if (RED.settings.user.anonymous) { if (RED.settings.user.anonymous) {
@ -141,7 +141,7 @@ RED.user = (function() {
onselect: function() { onselect: function() {
RED.user.login({cancelable:true},function() { RED.user.login({cancelable:true},function() {
RED.settings.load(function() { RED.settings.load(function() {
RED.notify(RED._("notification.loggedInAs")+RED.settings.user.username,"success"); RED.notify(RED._("user.loggedInAs",{name:RED.settings.user.username}),"success");
updateUserMenu(); updateUserMenu();
}); });
}); });
@ -160,25 +160,25 @@ RED.user = (function() {
} }
}); });
} }
} }
function init() { function init() {
if (RED.settings.user) { if (RED.settings.user) {
if (!RED.settings.editorTheme || !RED.settings.editorTheme.hasOwnProperty("userMenu")) { if (!RED.settings.editorTheme || !RED.settings.editorTheme.hasOwnProperty("userMenu")) {
$('<li><a id="btn-usermenu" class="button hide" data-toggle="dropdown" href="#"><i class="fa fa-user"></i></a></li>') $('<li><a id="btn-usermenu" class="button hide" data-toggle="dropdown" href="#"><i class="fa fa-user"></i></a></li>')
.prependTo(".header-toolbar"); .prependTo(".header-toolbar");
RED.menu.init({id:"btn-usermenu", RED.menu.init({id:"btn-usermenu",
options: [] options: []
}); });
updateUserMenu(); updateUserMenu();
} }
} }
} }
return { return {
init: init, init: init,

View File

@ -55,10 +55,10 @@
<div id="workspace-add-tab"><a id="btn-workspace-add-tab" href="#"><i class="fa fa-plus"></i></a></div> <div id="workspace-add-tab"><a id="btn-workspace-add-tab" href="#"><i class="fa fa-plus"></i></a></div>
<div id="chart"></div> <div id="chart"></div>
<div id="workspace-toolbar"> <div id="workspace-toolbar">
<a class="button" id="workspace-subflow-edit" href="#" data-i18n="[append]workspaces.editSubflowName"><i class="fa fa-pencil"></i> </a> <a class="button" id="workspace-subflow-edit" href="#" data-i18n="[append]subflow.editSubflowName"><i class="fa fa-pencil"></i> </a>
<a class="button disabled" id="workspace-subflow-add-input" href="#" data-i18n="[append]workspaces.input"><i class="fa fa-plus"></i> </a> <a class="button disabled" id="workspace-subflow-add-input" href="#" data-i18n="[append]subflow.input"><i class="fa fa-plus"></i> </a>
<a class="button" id="workspace-subflow-add-output" href="#" data-i18n="[append]workspaces.output"><i class="fa fa-plus"></i> </a> <a class="button" id="workspace-subflow-add-output" href="#" data-i18n="[append]subflow.output"><i class="fa fa-plus"></i> </a>
<a class="button" id="workspace-subflow-delete" href="#" data-i18n="[append]workspaces.deleteSubflow"><i class="fa fa-trash"></i> </a> <a class="button" id="workspace-subflow-delete" href="#" data-i18n="[append]subflow.deleteSubflow"><i class="fa fa-trash"></i> </a>
</div> </div>
</div> </div>
@ -80,14 +80,14 @@
</div> </div>
<div id="notifications"></div> <div id="notifications"></div>
<div id="dropTarget"><div data-i18n="[append]workspaces.dropFlowHere"><br/><i class="fa fa-download"></i></div></div> <div id="dropTarget"><div data-i18n="[append]workspace.dropFlowHere"><br/><i class="fa fa-download"></i></div></div>
<div id="dialog" class="hide"><form id="dialog-form" class="form-horizontal"></form></div> <div id="dialog" class="hide"><form id="dialog-form" class="form-horizontal"></form></div>
<div id="node-config-dialog" class="hide"><form id="dialog-config-form" class="form-horizontal"></form><div class="form-tips" id="node-config-dialog-user-count"></div></div> <div id="node-config-dialog" class="hide"><form id="dialog-config-form" class="form-horizontal"></form><div class="form-tips" id="node-config-dialog-user-count"></div></div>
<div id="subflow-dialog" class="hide"> <div id="subflow-dialog" class="hide">
<form class="form-horizontal"> <form class="form-horizontal">
<div class="form-row"> <div class="form-row">
<label data-i18n="workspaces.subflowName"></label><input type="text" id="subflow-input-name"> <label data-i18n="common.label.name"></label><input type="text" id="subflow-input-name">
</div> </div>
</form> </form>
<div class="form-tips" id="subflow-dialog-user-count"></div> <div class="form-tips" id="subflow-dialog-user-count"></div>
@ -95,11 +95,11 @@
<div id="node-dialog-confirm-deploy" class="hide"> <div id="node-dialog-confirm-deploy" class="hide">
<form class="form-horizontal"> <form class="form-horizontal">
<div id="node-dialog-confirm-deploy-config" style="text-align: left; padding-top: 30px;" data-i18n="workspaces.confirmDeployImproperlyConfigured"></div> <div id="node-dialog-confirm-deploy-config" style="text-align: left; padding-top: 30px;" data-i18n="[prepend]deploy.confirm.improperlyConfigured;[append]deploy.confirm.confirm"> </div>
<div id="node-dialog-confirm-deploy-unknown" style="text-align: left; padding-top: 10px;" data-i18n="[prepend]workspaces.confirmDeployUnknown;[append]workspaces.confirmDeploy"> <div id="node-dialog-confirm-deploy-unknown" style="text-align: left; padding-top: 10px;" data-i18n="[prepend]deploy.confirm.unknown;[append]deploy.confirm.confirm">
<ul style="font-size: 0.9em; width: 400px; margin: 10px auto; text-align: left;" id="node-dialog-confirm-deploy-unknown-list"></ul> <ul style="font-size: 0.9em; width: 400px; margin: 10px auto; text-align: left;" id="node-dialog-confirm-deploy-unknown-list"></ul>
</div> </div>
<div id="node-dialog-confirm-deploy-unused" style="text-align: left; padding-top: 10px;" data-i18n="[prepend]workspaces.confirmDeployUnusedConfig;[append]workspaces.confirmDeploy"> <div id="node-dialog-confirm-deploy-unused" style="text-align: left; padding-top: 10px;" data-i18n="[prepend]deploy.confirm.unusedConfig;[append]deploy.confirm.confirm">
<ul style="font-size: 0.9em; width: 400px; margin: 10px auto; text-align: left;" id="node-dialog-confirm-deploy-unused-list"></ul> <ul style="font-size: 0.9em; width: 400px; margin: 10px auto; text-align: left;" id="node-dialog-confirm-deploy-unused-list"></ul>
</div> </div>
</form> </form>
@ -115,12 +115,12 @@
<div id="node-dialog-library-save" class="hide"> <div id="node-dialog-library-save" class="hide">
<form class="form-horizontal"> <form class="form-horizontal">
<div class="form-row"> <div class="form-row">
<label for="node-dialog-library-save-folder" data-i18n="[append]workspaces.folderLabel"><i class="fa fa-folder-open"></i> </label> <label for="node-dialog-library-save-folder" data-i18n="[append]library.folder"><i class="fa fa-folder-open"></i> </label>
<input type="text" id="node-dialog-library-save-folder" data-i18n="[placeholder]workspaces.folderPlaceholder"> <input type="text" id="node-dialog-library-save-folder" data-i18n="[placeholder]library.folderPlaceholder">
</div> </div>
<div class="form-row"> <div class="form-row">
<label for="node-dialog-library-save-filename" data-i18n="[append]workspaces.filenameLabel"><i class="fa fa-file"></i> </label> <label for="node-dialog-library-save-filename" data-i18n="[append]library.filename"><i class="fa fa-file"></i> </label>
<input type="text" id="node-dialog-library-save-filename" data-i18n="[placeholder]workspaces.filenamePlaceholder"> <input type="text" id="node-dialog-library-save-filename" data-i18n="[placeholder]library.filenamePlaceholder">
</div> </div>
</form> </form>
</div> </div>
@ -129,7 +129,7 @@
<form class="form-horizontal"> <form class="form-horizontal">
<div class="form-row"> <div class="form-row">
<ul id="node-dialog-library-breadcrumbs" class="breadcrumb"> <ul id="node-dialog-library-breadcrumbs" class="breadcrumb">
<li class="active" data-i18n="[append]workspaces.libraryBreadcrumb"><a href="#"></a></li> <li class="active" data-i18n="[append]library.breadcrumb"><a href="#"></a></li>
</ul> </ul>
</div> </div>
<div class="form-row"> <div class="form-row">
@ -145,7 +145,7 @@
<div id="node-dialog-rename-workspace" class="hide"> <div id="node-dialog-rename-workspace" class="hide">
<form class="form-horizontal"> <form class="form-horizontal">
<div class="form-row"> <div class="form-row">
<label for="node-input-workspace-name" ><i class="fa fa-tag"></i> <span data-i18n="workspace.label.name"></span></label> <label for="node-input-workspace-name" ><i class="fa fa-tag"></i> <span data-i18n="common.label.name"></span></label>
<input type="text" id="node-input-workspace-name"> <input type="text" id="node-input-workspace-name">
</div> </div>
</form> </form>
@ -159,15 +159,15 @@
<script type="text/x-red" data-template-name="export-library-dialog"> <script type="text/x-red" data-template-name="export-library-dialog">
<div class="form-row"> <div class="form-row">
<label for="node-input-filename" data-i18n="[append]editor:workspaces.libraryFilenameLabel"><i class="fa fa-file"></i> </label> <label for="node-input-filename" data-i18n="[append]editor:library.filename"><i class="fa fa-file"></i> </label>
<input type="text" id="node-input-filename" data-i18n="[placeholder]editor:workspaces.libraryFilenamePlaceholder"> <input type="text" id="node-input-filename" data-i18n="[placeholder]editor:library.fullFilenamePlaceholder">
</div> </div>
</script> </script>
<script type="text/x-red" data-template-name="subflow"> <script type="text/x-red" data-template-name="subflow">
<div class="form-row"> <div class="form-row">
<label for="node-input-name" data-i18n="[append]editor:workspaces.libraryNameLabel"><i class="fa fa-tag"></i> </label> <label for="node-input-name" data-i18n="[append]editor:common.label.name"><i class="fa fa-tag"></i> </label>
<input type="text" id="node-input-name" data-i18n="[placeholder]editor:workspaces.libraryNamePlaceholder"> <input type="text" id="node-input-name">
</div> </div>
</script> </script>

View File

@ -1,178 +1,192 @@
{ {
"common": {
"label": {
"name": "Name",
"ok": "Ok",
"cancel": "Cancel",
"delete": "Delete",
"close": "Close"
}
},
"workspace": { "workspace": {
"renameSheet": "Rename sheet",
"confirmDelete": "Confirm delete",
"delete": "Are you sure you want to delete '__label__'?",
"dropFlowHere": "Drop the flow here"
},
"menu": {
"label": { "label": {
"name": "Name:" "sidebar": "Sidebar",
"displayStatus": "Display node status",
"import": "Import",
"export": "Export",
"clipboard": "Clipboard",
"library": "Library",
"configurationNodes": "Configuration nodes",
"subflows": "Subflows",
"createSubflow": "Create subflow",
"selectionToSubflow": "Selection to subflow",
"workspaces": "Workspaces",
"add": "Add",
"rename": "Rename",
"delete": "Delete",
"keyboardShortcuts": "Keyboard Shortcuts",
"login": "Login",
"logout": "Logout"
} }
}, },
"menu": { "user": {
"label": { "loggedInAs": "Logged in as __name__",
"sidebar": "Sidebar", "login": "Login",
"displayStatus": "Display node status", "loginFailed": "Login failed"
"import": "Import",
"export": "Export",
"clipboard": "Clipboard",
"library": "Library",
"configurationNodes": "Configuration nodes",
"subflows": "Subflows",
"createSubflow": "Create subflow",
"selectionToSubflow": "Selection to subflow",
"workspaces": "Workspaces",
"add": "Add",
"rename": "Rename",
"delete": "Delete",
"keyboardShortcuts": "Keyboard Shortcuts",
"login": "Login",
"logout": "Logout"
}
},
"notification": {
"nodeAdded": "Node added to palette:",
"nodeAdded_plural": "Nodes added to palette",
"nodeRemoved": "Node removed from palette:",
"nodeRemoved_plural": "Nodes removed from palette:",
"nodeEnabled": "Node enabled:",
"nodeEnabled_plural": "Nodes enabled:",
"nodeDisabled": "Node disabled:",
"nodeDisabled_plural": "Nodes disabled:",
"lostConnectionError": "<b>Error</b>: Lost connection to server",
"importUnrecognised": "Imported unrecognised ",
"loggedInAs": "Logged in as ",
"invalidFilename": "Invalid filename",
"savedType": "Saved __type__",
"saveFailed": "Save failed: ",
"noNodesSelected": "<strong>Cannot create subflow</strong>: no nodes selected",
"multipleInputsToSelection": "<strong>Cannot create subflow</strong>: multiple inputs to selection",
"cannotAddSubflowToItself": "<strong>Error</strong>: Cannot add subflow to itself",
"cannotAddCircularReference": "<strong>Error</strong>: Cannot add subflow - circular reference detected",
"nodeCopied": "__count__ node copied",
"nodeCopied_plural": "__count__ nodes copied",
"undeployedChanges": "<strong>Warning</strong>: node has undeployed changes",
"nodeActionDisabled": "<strong>Warning</strong>: node actions disabled within subflow",
"error": "<strong>Error</strong>: "
},
"error": {
"apiSubflowOnly": "this api is subflow only. called with:",
"invalidFlow": "Invalid flow: ",
"cannotAddSubflowToItself": "Cannot add subflow to itself",
"cannotAddCircularReference": "Cannot add subflow - circular reference detected"
},
"dialog": {
"cancel": "Cancel",
"login": "Login",
"loginFailed": "Login failed",
"ok": "Ok",
"delete": "Delete",
"close": "Close",
"nodes": " Nodes:",
"selectToCopy": "Select the text above and copy to the clipboard with Ctrl-C.",
"pasteNodesHere": "Paste nodes here",
"importNodes": "Import nodes",
"exportNodesClipboard": "Export nodes to clipboard",
"renameSheet": "Rename sheet",
"confirmDelete": "Confirm delete"
},
"deploy": {
"deploy": "Deploy",
"full": "Full",
"modifiedFlows": "Modified Flows",
"modifiedNodes": "Modified Nodes",
"fullDesc": "Deploys everything in the workspace",
"modifiedFlowsDesc": "Only deploys flows that contain changed nodes",
"modifiedNodesDesc": "Only deploys nodes that have changed",
"confirmDeploy": "Confirm deploy",
"cancelDeploy": "Cancel",
"undeployedChanges": "You have undeployed changes.\n\nLeaving this page will lose these changes.",
"successfulDeploy": "Successfully Deployed",
"error": "<strong>Error</strong>: ",
"noResponseError": "no response from server"
},
"editor": {
"savedNodes": "Saved nodes",
"configEdit": "edit",
"configAdd": "add",
"configDelete": "Delete",
"editFlow": "Edit flow ",
"nodesUse": "__count__ node uses this config",
"nodesUse_plural": "__count__ nodes use this config",
"addNewConfig": "Add new __type__ config node",
"editConfig": "Edit __type__ config node",
"addNewType": "Add new __type__...",
"subflow": "Subflow: ",
"subflowInstances": "There is __count__ instance of this subflow",
"subflowInstances_plural": "There are __count__ instances of this subflow"
},
"keyboard": {
"selectAll": "Select all nodes",
"selectAllConnected": "Select all connected nodes",
"addRemoveNode": "Add/remove node from selection",
"deleteSelected": "Delete selected nodes or link",
"importNode": "Import nodes",
"exportNode": "Export selected nodes",
"toggleSidebar": "Toggle sidebar",
"deleteNode": "Delete selected nodes or link",
"copyNode": "Copy selected nodes",
"cutNode": "Cut selected nodes",
"pasteNode": "Paste nodes"
},
"library": {
"openLibrary": "Open Library...",
"saveToLibrary": "Save to Library...",
"typeLibrary": "__type__ library",
"unnamedType": "Unnamed __type__",
"saveToLibrary": "Save to Library",
"exportToLibrary": "Export nodes to library",
"dialogSaveOverwrite": "A __libraryType__ called __libraryName__ already exists. Overwrite?"
},
"palette": {
"noInfo": "no information available",
"popOverError": "Error generating pop-over label for '__type__'.",
"filter": "filter",
"label": {
"subflows": "subflows",
"input": "input",
"output": "output",
"function": "function",
"social": "social",
"storage": "storage",
"analysis": "analysis",
"advanced": "advanced"
}
},
"tabInfo": {
"node": "Node",
"type": "Type",
"id": "ID",
"subflow": "Subflow",
"name": "name",
"instances": "instances",
"properties": "Properties",
"blank": "blank"
},
"sidebar": {
"info": "info",
"config": "config"
}, },
"workspaces": { "notification": {
"subflow": "Subflow: ", "warning": "<strong>Warning</strong>: __message__",
"warnings": {
"undeployedChanges": "node has undeployed changes",
"nodeActionDisabled": "node actions disabled within subflow"
},
"error": "<strong>Error</strong>: __message__",
"errors": {
"lostConnection": "Lost connection to server",
"cannotAddSubflowToItself": "Cannot add subflow to itself",
"cannotAddCircularReference": "Cannot add subflow - circular reference detected"
}
},
"clipboard": {
"nodes": "Nodes:",
"selectNodes": "Select the text above and copy to the clipboard.",
"pasteNodes": "Paste nodes here",
"importNodes": "Import nodes",
"exportNodes": "Export nodes to clipboard",
"importUnrecognised": "Imported unrecognised type:",
"importUnrecognised_plural": "Imported unrecognised types:",
"nodeCopied": "__count__ node copied",
"nodeCopied_plural": "__count__ nodes copied",
"invalidFlow": "Invalid flow: __message__"
},
"deploy": {
"deploy": "Deploy",
"full": "Full",
"fullDesc": "Deploys everything in the workspace",
"modifiedFlows": "Modified Flows",
"modifiedFlowsDesc": "Only deploys flows that contain changed nodes",
"modifiedNodes": "Modified Nodes",
"modifiedNodesDesc": "Only deploys nodes that have changed",
"successfulDeploy": "Successfully Deployed",
"errors": {
"noResponse": "no response from server"
},
"confirm": {
"button": {
"confirm": "Confirm deploy",
"cancel": "Cancel"
},
"undeployedChanges": "You have undeployed changes.\n\nLeaving this page will lose these changes.",
"improperlyConfigured": "Some of the nodes are not properly configured.",
"unknown": "The workspace contains some unknown node types:",
"unusedConfig": "The workspace contains some unused configuration nodes:",
"confirm": "Are you sure you want to deploy?"
}
},
"subflow": {
"tabLabel": "Subflow: __name__",
"editSubflow": "Edit flow __name__",
"edit": "Edit flow",
"subflowInstances": "There is __count__ instance of this subflow",
"subflowInstances_plural": "There are __count__ instances of this subflow",
"editSubflowName": "edit name", "editSubflowName": "edit name",
"input": "input", "input": "input",
"output": "output", "output": "output",
"deleteSubflow": "delete subflow", "deleteSubflow": "delete subflow",
"dropFlowHere": "Drop the flow here", "errors": {
"subflowName": "Name", "noNodesSelected": "<strong>Cannot create subflow</strong>: no nodes selected",
"folderPlaceholder": "Folder", "multipleInputsToSelection": "<strong>Cannot create subflow</strong>: multiple inputs to selection"
"filenamePlaceholder": "Filename", }
"folderLabel": "Folder", },
"filenameLabel": "Filename", "editor": {
"libraryBreadcrumb": "Library", "configEdit": "edit",
"libraryFilenamePlaceholder": "Filename", "configAdd": "add",
"libraryFilenameLabel": "Filename:", "configDelete": "Delete",
"libraryNamePlaceholder": "Name", "nodesUse": "__count__ node uses this config",
"libraryNameLabel": "Name", "nodesUse_plural": "__count__ nodes use this config",
"confirmDeployImproperlyConfigured": "Some of the nodes are not properly configured. Are you sure you want to deploy?", "addNewConfig": "Add new __type__ config node",
"confirmDeployUnknown": "The workspace contains some unknown node types:", "editConfig": "Edit __type__ config node",
"confirmDeployUnusedConfig": "The workspace contains some unused configuration nodes:", "addNewType": "Add new __type__..."
"confirmDeploy": "Are you sure you want to deploy?", },
"deleteDialog": "Are you sure you want to delete '__label__'?" "keyboard": {
"selectAll": "Select all nodes",
"selectAllConnected": "Select all connected nodes",
"addRemoveNode": "Add/remove node from selection",
"deleteSelected": "Delete selected nodes or link",
"importNode": "Import nodes",
"exportNode": "Export selected nodes",
"toggleSidebar": "Toggle sidebar",
"deleteNode": "Delete selected nodes or link",
"copyNode": "Copy selected nodes",
"cutNode": "Cut selected nodes",
"pasteNode": "Paste nodes"
},
"library": {
"openLibrary": "Open Library...",
"saveToLibrary": "Save to Library...",
"typeLibrary": "__type__ library",
"unnamedType": "Unnamed __type__",
"saveToLibrary": "Save to Library",
"exportToLibrary": "Export nodes to library",
"dialogSaveOverwrite": "A __libraryType__ called __libraryName__ already exists. Overwrite?",
"invalidFilename": "Invalid filename",
"savedNodes": "Saved nodes",
"savedType": "Saved __type__",
"saveFailed": "Save failed: __message__",
"filename": "Filename",
"folder": "Folder",
"filenamePlaceholder": "file",
"fullFilenamePlaceholder": "a/b/file",
"folderPlaceholder": "a/b",
"breadcrumb": "Library"
},
"palette": {
"noInfo": "no information available",
"filter": "filter",
"label": {
"subflows": "subflows",
"input": "input",
"output": "output",
"function": "function",
"social": "social",
"storage": "storage",
"analysis": "analysis",
"advanced": "advanced"
},
"event": {
"nodeAdded": "Node added to palette:",
"nodeAdded_plural": "Nodes added to palette",
"nodeRemoved": "Node removed from palette:",
"nodeRemoved_plural": "Nodes removed from palette:",
"nodeEnabled": "Node enabled:",
"nodeEnabled_plural": "Nodes enabled:",
"nodeDisabled": "Node disabled:",
"nodeDisabled_plural": "Nodes disabled:"
}
},
"sidebar": {
"info": {
"title": "info",
"node": "Node",
"type": "Type",
"id": "ID",
"subflow": "Subflow",
"instances": "Instances",
"properties": "Properties",
"blank": "blank",
"arrayItems": "__count__ items"
},
"config": {
"title": "config"
}
} }
} }

View File

@ -6,7 +6,7 @@
"settings": "Settings file : __path__" "settings": "Settings file : __path__"
} }
}, },
"server": { "server": {
"loading": "Loading palette nodes", "loading": "Loading palette nodes",
"errors": "Failed to register __count__ node type", "errors": "Failed to register __count__ node type",
@ -23,14 +23,14 @@
"install-failed": "Install failed", "install-failed": "Install failed",
"install-failed-long": "Installation of module __name__ failed:", "install-failed-long": "Installation of module __name__ failed:",
"install-failed-not-found": "$t(install-failed-long) module not found", "install-failed-not-found": "$t(install-failed-long) module not found",
"uninstalling": "Uninstalling module: __name__", "uninstalling": "Uninstalling module: __name__",
"uninstall-failed": "Uninstall failed", "uninstall-failed": "Uninstall failed",
"uninstall-failed-long": "Uninstall of module __name__ failed:", "uninstall-failed-long": "Uninstall of module __name__ failed:",
"uninstalled": "Uninstalled module: __name__" "uninstalled": "Uninstalled module: __name__"
} }
}, },
"api": { "api": {
"flows": { "flows": {
"error-save": "Error saving flows: __message__" "error-save": "Error saving flows: __message__"
@ -47,18 +47,18 @@
"error-enable": "Failed to enable node:" "error-enable": "Failed to enable node:"
} }
}, },
"comms": { "comms": {
"error": "Communication channel error: __message__", "error": "Communication channel error: __message__",
"error-server": "Communication server error: __message__", "error-server": "Communication server error: __message__",
"error-send": "Communication send error: __message__" "error-send": "Communication send error: __message__"
}, },
"settings": { "settings": {
"not-available": "Settings not available", "not-available": "Settings not available",
"property-read-only": "Property '__prop__' is read-only" "property-read-only": "Property '__prop__' is read-only"
}, },
"nodes": { "nodes": {
"credentials": { "credentials": {
"error":"Error loading credentials: __message__", "error":"Error loading credentials: __message__",
@ -82,7 +82,6 @@
"stopped": "Stopped", "stopped": "Stopped",
"missing-types": "Waiting for missing types to be registered:", "missing-types": "Waiting for missing types to be registered:",
"missing-type-provided": " - __type__ (provided by npm module __module__)", "missing-type-provided": " - __type__ (provided by npm module __module__)",
"missing-type-install-1": "To install any of these missing modules, run:", "missing-type-install-1": "To install any of these missing modules, run:",
"missing-type-install-2": "in the directory:" "missing-type-install-2": "in the directory:"
}, },
@ -102,7 +101,7 @@
} }
} }
}, },
"storage": { "storage": {
"index": { "index": {
"forbidden-flow-name": "forbidden flow name" "forbidden-flow-name": "forbidden flow name"
@ -113,7 +112,7 @@
"create": "Creating new flow file" "create": "Creating new flow file"
} }
}, },
"httpadminauth-deprecated": "use of httpAdminAuth is deprecated. Use adminAuth instead", "httpadminauth-deprecated": "use of httpAdminAuth is deprecated. Use adminAuth instead",
"unable-to-listen": "Unable to listen on __listenpath__", "unable-to-listen": "Unable to listen on __listenpath__",
"port-in-use": "Error: port in use", "port-in-use": "Error: port in use",