mirror of
https://github.com/node-red/node-red.git
synced 2025-03-01 10:36:34 +00:00
Merge branch 'dev' into dev-addjpn
This commit is contained in:
@@ -266,8 +266,8 @@ RED.nodes = (function() {
|
||||
},
|
||||
moveNode: function(n, newZ) {
|
||||
api.removeNode(n);
|
||||
tabMap[newZ] = tabMap[newZ] || [];
|
||||
tabMap[newZ].push(n);
|
||||
n.z = newZ;
|
||||
api.addNode(n)
|
||||
},
|
||||
moveNodesForwards: function(nodes) {
|
||||
var result = [];
|
||||
@@ -719,29 +719,29 @@ RED.nodes = (function() {
|
||||
moveGroupToTab(node,z);
|
||||
return;
|
||||
}
|
||||
var oldZ = node.z;
|
||||
allNodes.moveNode(node,z);
|
||||
var nl = nodeLinks[node.id];
|
||||
if (nl) {
|
||||
nl.in.forEach(function(l) {
|
||||
var idx = linkTabMap[node.z].indexOf(l);
|
||||
var idx = linkTabMap[oldZ].indexOf(l);
|
||||
if (idx != -1) {
|
||||
linkTabMap[node.z].splice(idx, 1);
|
||||
linkTabMap[oldZ].splice(idx, 1);
|
||||
}
|
||||
if ((l.source.z === z) && linkTabMap[z]) {
|
||||
linkTabMap[z].push(l);
|
||||
}
|
||||
});
|
||||
nl.out.forEach(function(l) {
|
||||
var idx = linkTabMap[node.z].indexOf(l);
|
||||
var idx = linkTabMap[oldZ].indexOf(l);
|
||||
if (idx != -1) {
|
||||
linkTabMap[node.z].splice(idx, 1);
|
||||
linkTabMap[oldZ].splice(idx, 1);
|
||||
}
|
||||
if ((l.target.z === z) && linkTabMap[z]) {
|
||||
linkTabMap[z].push(l);
|
||||
}
|
||||
});
|
||||
}
|
||||
node.z = z;
|
||||
RED.events.emit("nodes:change",node);
|
||||
}
|
||||
function moveGroupToTab(group, z) {
|
||||
@@ -2384,7 +2384,6 @@ RED.nodes = (function() {
|
||||
}
|
||||
|
||||
function clear() {
|
||||
allNodes.clear();
|
||||
links = [];
|
||||
linkTabMap = {};
|
||||
nodeLinks = {};
|
||||
@@ -2405,6 +2404,8 @@ RED.nodes = (function() {
|
||||
initialLoad = null;
|
||||
workspaces = {};
|
||||
|
||||
allNodes.clear();
|
||||
|
||||
RED.nodes.dirty(false);
|
||||
RED.view.redraw(true, true);
|
||||
RED.palette.refresh();
|
||||
|
@@ -201,6 +201,7 @@ var RED = (function() {
|
||||
RED.projects.refresh(function(activeProject) {
|
||||
loadFlows(function() {
|
||||
RED.sidebar.info.refresh()
|
||||
var showProjectWelcome = false;
|
||||
if (!activeProject) {
|
||||
// Projects enabled but no active project
|
||||
RED.menu.setDisabled('menu-item-projects-open',true);
|
||||
@@ -208,10 +209,10 @@ var RED = (function() {
|
||||
if (activeProject === false) {
|
||||
// User previously decline the migration to projects.
|
||||
} else { // null/undefined
|
||||
RED.projects.showStartup();
|
||||
showProjectWelcome = true;
|
||||
}
|
||||
}
|
||||
completeLoad();
|
||||
completeLoad(showProjectWelcome);
|
||||
});
|
||||
});
|
||||
} else {
|
||||
@@ -251,6 +252,9 @@ var RED = (function() {
|
||||
if (/^#flow\/.+$/.test(currentHash)) {
|
||||
RED.workspaces.show(currentHash.substring(6),true);
|
||||
}
|
||||
if (RED.workspaces.active() === 0 && RED.workspaces.count() > 0) {
|
||||
RED.workspaces.show(RED.nodes.getWorkspaceOrder()[0])
|
||||
}
|
||||
} catch(err) {
|
||||
console.warn(err);
|
||||
RED.notify(
|
||||
@@ -267,7 +271,7 @@ var RED = (function() {
|
||||
});
|
||||
}
|
||||
|
||||
function completeLoad() {
|
||||
function completeLoad(showProjectWelcome) {
|
||||
var persistentNotifications = {};
|
||||
RED.comms.subscribe("notification/#",function(topic,msg) {
|
||||
var parts = topic.split("/");
|
||||
@@ -477,8 +481,17 @@ var RED = (function() {
|
||||
RED.nodes.addNodeSet(m);
|
||||
addedTypes = addedTypes.concat(m.types);
|
||||
RED.i18n.loadNodeCatalog(id, function() {
|
||||
$.get('nodes/'+id, function(data) {
|
||||
appendNodeConfig(data);
|
||||
var lang = localStorage.getItem("editor-language")||RED.i18n.detectLanguage();
|
||||
$.ajax({
|
||||
headers: {
|
||||
"Accept":"text/html",
|
||||
"Accept-Language": lang
|
||||
},
|
||||
cache: false,
|
||||
url: 'nodes/'+id,
|
||||
success: function(data) {
|
||||
appendNodeConfig(data);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -505,10 +518,19 @@ var RED = (function() {
|
||||
typeList = "<ul><li>"+msg.types.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
|
||||
RED.notify(RED._("palette.event.nodeEnabled", {count:msg.types.length})+typeList,"success");
|
||||
} else {
|
||||
$.get('nodes/'+msg.id, function(data) {
|
||||
appendNodeConfig(data);
|
||||
typeList = "<ul><li>"+msg.types.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
|
||||
RED.notify(RED._("palette.event.nodeAdded", {count:msg.types.length})+typeList,"success");
|
||||
var lang = localStorage.getItem("editor-language")||RED.i18n.detectLanguage();
|
||||
$.ajax({
|
||||
headers: {
|
||||
"Accept":"text/html",
|
||||
"Accept-Language": lang
|
||||
},
|
||||
cache: false,
|
||||
url: 'nodes/'+msg.id,
|
||||
success: function(data) {
|
||||
appendNodeConfig(data);
|
||||
typeList = "<ul><li>"+msg.types.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
|
||||
RED.notify(RED._("palette.event.nodeAdded", {count:msg.types.length})+typeList,"success");
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -535,18 +557,24 @@ var RED = (function() {
|
||||
|
||||
setTimeout(function() {
|
||||
loader.end();
|
||||
checkFirstRun();
|
||||
checkFirstRun(function() {
|
||||
if (showProjectWelcome) {
|
||||
RED.projects.showStartup();
|
||||
}
|
||||
});
|
||||
},100);
|
||||
}
|
||||
|
||||
function checkFirstRun() {
|
||||
function checkFirstRun(done) {
|
||||
if (RED.settings.theme("tours") === false) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
if (!RED.settings.get("editor.view.view-show-welcome-tours", true)) {
|
||||
done();
|
||||
return;
|
||||
}
|
||||
RED.actions.invoke("core:show-welcome-tour", RED.settings.get("editor.tours.welcome"));
|
||||
RED.actions.invoke("core:show-welcome-tour", RED.settings.get("editor.tours.welcome"), done);
|
||||
}
|
||||
|
||||
function buildMainMenu() {
|
||||
|
@@ -436,18 +436,17 @@ RED.popover = (function() {
|
||||
return {
|
||||
create: createPopover,
|
||||
tooltip: function(target,content, action) {
|
||||
var label = content;
|
||||
if (action) {
|
||||
label = function() {
|
||||
var label = content;
|
||||
var label = function() {
|
||||
var label = content;
|
||||
if (action) {
|
||||
var shortcut = RED.keyboard.getShortcut(action);
|
||||
if (shortcut && shortcut.key) {
|
||||
label = $('<span>'+content+' <span class="red-ui-popover-key">'+RED.keyboard.formatKey(shortcut.key, true)+'</span></span>');
|
||||
}
|
||||
return label;
|
||||
}
|
||||
return label;
|
||||
}
|
||||
return RED.popover.create({
|
||||
var popover = RED.popover.create({
|
||||
tooltip: true,
|
||||
target:target,
|
||||
trigger: "hover",
|
||||
@@ -456,6 +455,14 @@ RED.popover = (function() {
|
||||
content: label,
|
||||
delay: { show: 750, hide: 50 }
|
||||
});
|
||||
popover.setContent = function(newContent) {
|
||||
content = newContent;
|
||||
}
|
||||
popover.setAction = function(newAction) {
|
||||
action = newAction;
|
||||
}
|
||||
return popover;
|
||||
|
||||
},
|
||||
menu: function(options) {
|
||||
var list = $('<ul class="red-ui-menu"></ul>');
|
||||
|
@@ -24,6 +24,9 @@
|
||||
* - rootSortable: boolean - if 'sortable' is set, then setting this to
|
||||
* false, prevents items being sorted to the
|
||||
* top level of the tree
|
||||
* - autoSelect: boolean - default true - triggers item selection when navigating
|
||||
* list by keyboard. If the list has checkboxed items
|
||||
* you probably want to set this to false
|
||||
*
|
||||
* methods:
|
||||
* - data(items) - clears existing items and replaces with new data
|
||||
@@ -50,6 +53,7 @@
|
||||
* deferBuild: true/false, // don't build any ui elements for the item's children
|
||||
* until it is expanded by the user.
|
||||
* element: // custom dom element to use for the item - ignored if `label` is set
|
||||
* collapsible: true/false, // prevent a parent item from being collapsed. default true.
|
||||
* }
|
||||
* ]
|
||||
*
|
||||
@@ -90,77 +94,99 @@
|
||||
$.widget( "nodered.treeList", {
|
||||
_create: function() {
|
||||
var that = this;
|
||||
|
||||
var autoSelect = true;
|
||||
if (that.options.autoSelect === false) {
|
||||
autoSelect = false;
|
||||
}
|
||||
this.element.addClass('red-ui-treeList');
|
||||
this.element.attr("tabIndex",0);
|
||||
var wrapper = $('<div>',{class:'red-ui-treeList-container'}).appendTo(this.element);
|
||||
this.element.on('keydown', function(evt) {
|
||||
var selected = that._topList.find(".selected").parent().data('data');
|
||||
if (!selected && (evt.keyCode === 40 || evt.keyCode === 38)) {
|
||||
that.select(that._data[0]);
|
||||
var focussed = that._topList.find(".focus").parent().data('data');
|
||||
if (!focussed && (evt.keyCode === 40 || evt.keyCode === 38)) {
|
||||
if (that._data[0]) {
|
||||
if (autoSelect) {
|
||||
that.select(that._data[0]);
|
||||
} else {
|
||||
that._topList.find(".focus").removeClass("focus")
|
||||
}
|
||||
that._data[0].treeList.label.addClass('focus')
|
||||
}
|
||||
return;
|
||||
}
|
||||
var target;
|
||||
switch(evt.keyCode) {
|
||||
case 32: // SPACE
|
||||
case 13: // ENTER
|
||||
if (evt.altKey || evt.ctrlKey || evt.metaKey || evt.shiftKey) {
|
||||
return
|
||||
}
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
if (selected.children) {
|
||||
if (selected.treeList.container.hasClass("expanded")) {
|
||||
selected.treeList.collapse()
|
||||
if (focussed.checkbox) {
|
||||
focussed.treeList.checkbox.trigger("click");
|
||||
} else if (focussed.radio) {
|
||||
focussed.treeList.radio.trigger("click");
|
||||
} else if (focussed.children) {
|
||||
if (focussed.treeList.container.hasClass("expanded")) {
|
||||
focussed.treeList.collapse()
|
||||
} else {
|
||||
selected.treeList.expand()
|
||||
focussed.treeList.expand()
|
||||
}
|
||||
} else {
|
||||
that._trigger("confirm",null,selected)
|
||||
that._trigger("confirm",null,focussed)
|
||||
}
|
||||
|
||||
break;
|
||||
case 37: // LEFT
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
if (selected.children&& selected.treeList.container.hasClass("expanded")) {
|
||||
selected.treeList.collapse()
|
||||
} else if (selected.parent) {
|
||||
target = selected.parent;
|
||||
if (focussed.children&& focussed.treeList.container.hasClass("expanded")) {
|
||||
focussed.treeList.collapse()
|
||||
} else if (focussed.parent) {
|
||||
target = focussed.parent;
|
||||
}
|
||||
break;
|
||||
case 38: // UP
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
target = that._getPreviousSibling(selected);
|
||||
target = that._getPreviousSibling(focussed);
|
||||
if (target) {
|
||||
target = that._getLastDescendant(target);
|
||||
}
|
||||
if (!target && selected.parent) {
|
||||
target = selected.parent;
|
||||
if (!target && focussed.parent) {
|
||||
target = focussed.parent;
|
||||
}
|
||||
break;
|
||||
case 39: // RIGHT
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
if (selected.children) {
|
||||
if (!selected.treeList.container.hasClass("expanded")) {
|
||||
selected.treeList.expand()
|
||||
if (focussed.children) {
|
||||
if (!focussed.treeList.container.hasClass("expanded")) {
|
||||
focussed.treeList.expand()
|
||||
}
|
||||
}
|
||||
break
|
||||
case 40: //DOWN
|
||||
evt.preventDefault();
|
||||
evt.stopPropagation();
|
||||
if (selected.children && Array.isArray(selected.children) && selected.children.length > 0 && selected.treeList.container.hasClass("expanded")) {
|
||||
target = selected.children[0];
|
||||
if (focussed.children && Array.isArray(focussed.children) && focussed.children.length > 0 && focussed.treeList.container.hasClass("expanded")) {
|
||||
target = focussed.children[0];
|
||||
} else {
|
||||
target = that._getNextSibling(selected);
|
||||
while (!target && selected.parent) {
|
||||
selected = selected.parent;
|
||||
target = that._getNextSibling(selected);
|
||||
target = that._getNextSibling(focussed);
|
||||
while (!target && focussed.parent) {
|
||||
focussed = focussed.parent;
|
||||
target = that._getNextSibling(focussed);
|
||||
}
|
||||
}
|
||||
break
|
||||
}
|
||||
if (target) {
|
||||
that.select(target);
|
||||
if (autoSelect) {
|
||||
that.select(target);
|
||||
} else {
|
||||
that._topList.find(".focus").removeClass("focus")
|
||||
}
|
||||
target.treeList.label.addClass('focus')
|
||||
}
|
||||
});
|
||||
this._data = [];
|
||||
@@ -463,6 +489,9 @@
|
||||
container.addClass("expanded");
|
||||
}
|
||||
item.treeList.collapse = function() {
|
||||
if (item.collapsible === false) {
|
||||
return
|
||||
}
|
||||
if (!item.children) {
|
||||
return;
|
||||
}
|
||||
@@ -583,7 +612,7 @@
|
||||
// Already a parent because we've got the angle-right icon
|
||||
return;
|
||||
}
|
||||
$('<i class="fa fa-angle-right" />').appendTo(treeListIcon);
|
||||
$('<i class="fa fa-angle-right" />').toggleClass("hide",item.collapsible === false).appendTo(treeListIcon);
|
||||
treeListIcon.on("click.red-ui-treeList-expand", function(e) {
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
@@ -634,6 +663,8 @@
|
||||
label.on("click", function(e) {
|
||||
e.stopPropagation();
|
||||
cb.trigger("click");
|
||||
that._topList.find(".focus").removeClass("focus")
|
||||
label.addClass('focus')
|
||||
})
|
||||
}
|
||||
item.treeList.select = function(v) {
|
||||
@@ -641,6 +672,7 @@
|
||||
cb.trigger("click");
|
||||
}
|
||||
}
|
||||
item.treeList.checkbox = cb;
|
||||
selectWrapper.appendTo(label)
|
||||
} else if (item.radio) {
|
||||
var selectWrapper = $('<span class="red-ui-treeList-icon"></span>');
|
||||
@@ -669,6 +701,8 @@
|
||||
label.on("click", function(e) {
|
||||
e.stopPropagation();
|
||||
cb.trigger("click");
|
||||
that._topList.find(".focus").removeClass("focus")
|
||||
label.addClass('focus')
|
||||
})
|
||||
}
|
||||
item.treeList.select = function(v) {
|
||||
@@ -677,6 +711,7 @@
|
||||
}
|
||||
}
|
||||
selectWrapper.appendTo(label)
|
||||
item.treeList.radio = cb;
|
||||
} else {
|
||||
label.on("click", function(e) {
|
||||
if (!that.options.multi) {
|
||||
@@ -684,10 +719,14 @@
|
||||
}
|
||||
label.addClass("selected");
|
||||
that._selected.add(item);
|
||||
that._topList.find(".focus").removeClass("focus")
|
||||
label.addClass('focus')
|
||||
|
||||
that._trigger("select",e,item)
|
||||
})
|
||||
label.on("dblclick", function(e) {
|
||||
that._topList.find(".focus").removeClass("focus")
|
||||
label.addClass('focus')
|
||||
if (!item.children) {
|
||||
that._trigger("confirm",e,item);
|
||||
}
|
||||
@@ -835,6 +874,9 @@
|
||||
if (item.treeList.label) {
|
||||
item.treeList.label.addClass("selected");
|
||||
}
|
||||
|
||||
that._topList.find(".focus").removeClass("focus");
|
||||
|
||||
if (triggerEvent !== false) {
|
||||
this._trigger("select",null,item)
|
||||
}
|
||||
@@ -842,6 +884,9 @@
|
||||
clearSelection: function() {
|
||||
this._selected.forEach(function(item) {
|
||||
item.selected = false;
|
||||
if (item.treeList.checkbox) {
|
||||
item.treeList.checkbox.prop('checked',false)
|
||||
}
|
||||
if (item.treeList.label) {
|
||||
item.treeList.label.removeClass("selected")
|
||||
}
|
||||
|
@@ -345,6 +345,47 @@
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
// For a type with options, check value is a valid selection
|
||||
// If !opt.multiple, returns the valid option object
|
||||
// if opt.multiple, returns an array of valid option objects
|
||||
// If not valid, returns null;
|
||||
|
||||
function isOptionValueValid(opt, currentVal) {
|
||||
if (!opt.multiple) {
|
||||
for (var i=0;i<opt.options.length;i++) {
|
||||
op = opt.options[i];
|
||||
if (typeof op === "string" && op === currentVal) {
|
||||
return {value:currentVal}
|
||||
} else if (op.value === currentVal) {
|
||||
return op;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Check to see if value is a valid csv of
|
||||
// options.
|
||||
var currentValues = {};
|
||||
var selected = [];
|
||||
currentVal.split(",").forEach(function(v) {
|
||||
if (v) {
|
||||
currentValues[v] = true;
|
||||
}
|
||||
});
|
||||
for (var i=0;i<opt.options.length;i++) {
|
||||
op = opt.options[i];
|
||||
var val = typeof op === "string" ? op : op.value;
|
||||
if (currentValues.hasOwnProperty(val)) {
|
||||
delete currentValues[val];
|
||||
selected.push(typeof op === "string" ? {value:op} : op.value)
|
||||
}
|
||||
}
|
||||
if (!$.isEmptyObject(currentValues)) {
|
||||
return null;
|
||||
}
|
||||
return selected
|
||||
}
|
||||
}
|
||||
|
||||
var nlsd = false;
|
||||
|
||||
$.widget( "nodered.typedInput", {
|
||||
@@ -408,6 +449,8 @@
|
||||
});
|
||||
|
||||
this.defaultInputType = this.input.attr('type');
|
||||
// Used to remember selections per-type to restore them when switching between types
|
||||
this.oldValues = {};
|
||||
|
||||
this.uiSelect.addClass("red-ui-typedInput-container");
|
||||
|
||||
@@ -512,9 +555,6 @@
|
||||
this.optionExpandButton = $('<button tabindex="0" class="red-ui-typedInput-option-expand" style="display:inline-block"></button>').appendTo(this.uiSelect);
|
||||
this.optionExpandButtonIcon = $('<i class="red-ui-typedInput-icon fa fa-ellipsis-h"></i>').appendTo(this.optionExpandButton);
|
||||
|
||||
// Used to remember selections per-type to restore them when switching between types
|
||||
this.oldValues = {};
|
||||
|
||||
this.type(this.options.default||this.typeList[0].value);
|
||||
}catch(err) {
|
||||
console.log(err.stack);
|
||||
@@ -859,22 +899,44 @@
|
||||
return this.propertyType;
|
||||
} else {
|
||||
var that = this;
|
||||
var previousValue = null;
|
||||
var opt = this.typeMap[type];
|
||||
if (opt && this.propertyType !== type) {
|
||||
// If previousType is !null, then this is a change of the type, rather than the initialisation
|
||||
var previousType = this.typeMap[this.propertyType];
|
||||
var typeChanged = !!previousType;
|
||||
previousValue = this.input.val();
|
||||
|
||||
if (typeChanged) {
|
||||
if (previousType.options && opt.hasValue !== true) {
|
||||
this.oldValues[previousType.value] = this.input.val();
|
||||
this.oldValues[previousType.value] = previousValue;
|
||||
} else if (previousType.hasValue === false) {
|
||||
this.oldValues[previousType.value] = this.input.val();
|
||||
this.oldValues[previousType.value] = previousValue;
|
||||
} else {
|
||||
this.oldValues["_"] = this.input.val();
|
||||
this.oldValues["_"] = previousValue;
|
||||
}
|
||||
if ((opt.options && opt.hasValue !== true) || opt.hasValue === false) {
|
||||
this.input.val(this.oldValues.hasOwnProperty(opt.value)?this.oldValues[opt.value]:(opt.default||[]).join(","))
|
||||
if (this.oldValues.hasOwnProperty(opt.value)) {
|
||||
this.input.val(this.oldValues[opt.value]);
|
||||
} else {
|
||||
// No old value for the option type.
|
||||
// It is possible code has called 'value' then 'type'
|
||||
// to set the selected option. This is what the Inject/Switch/Change
|
||||
// nodes did before 2.1.
|
||||
// So we need to be careful to not reset the value if it is a valid option.
|
||||
var validOptions = isOptionValueValid(opt,previousValue);
|
||||
if (previousValue && validOptions) {
|
||||
this.input.val(previousValue);
|
||||
} else {
|
||||
if (typeof opt.default === "string") {
|
||||
this.input.val(opt.default);
|
||||
} else if (Array.isArray(opt.default)) {
|
||||
this.input.val(opt.default.join(","))
|
||||
} else {
|
||||
this.input.val("");
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
this.input.val(this.oldValues.hasOwnProperty("_")?this.oldValues["_"]:(opt.default||""))
|
||||
}
|
||||
@@ -951,22 +1013,12 @@
|
||||
|
||||
var op;
|
||||
if (!opt.hasValue) {
|
||||
var validValue = false;
|
||||
var currentVal = this.input.val();
|
||||
// Check the value is valid for the available options
|
||||
var validValues = isOptionValueValid(opt,this.input.val());
|
||||
if (!opt.multiple) {
|
||||
for (var i=0;i<opt.options.length;i++) {
|
||||
op = opt.options[i];
|
||||
if (typeof op === "string" && op === currentVal) {
|
||||
that._updateOptionSelectLabel({value:currentVal});
|
||||
validValue = true;
|
||||
break;
|
||||
} else if (op.value === currentVal) {
|
||||
that._updateOptionSelectLabel(op);
|
||||
validValue = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (!validValue) {
|
||||
if (validValues) {
|
||||
that._updateOptionSelectLabel(validValues)
|
||||
} else {
|
||||
op = opt.options[0];
|
||||
if (typeof op === "string") {
|
||||
this.value(op);
|
||||
@@ -977,26 +1029,13 @@
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// Check to see if value is a valid csv of
|
||||
// options.
|
||||
var currentValues = {};
|
||||
var selected = [];
|
||||
currentVal.split(",").forEach(function(v) {
|
||||
if (v) {
|
||||
selected.push(v);
|
||||
currentValues[v] = true;
|
||||
}
|
||||
});
|
||||
for (var i=0;i<opt.options.length;i++) {
|
||||
op = opt.options[i];
|
||||
delete currentValues[op.value||op];
|
||||
if (!validValues) {
|
||||
validValues = (opt.default || []).map(function(v) {
|
||||
return typeof v === "string"?v:v.value
|
||||
});
|
||||
this.value(validValues.join(","));
|
||||
}
|
||||
if (!$.isEmptyObject(currentValues)) {
|
||||
selected = opt.default || [];
|
||||
// Invalid, set to default/empty
|
||||
this.value(selected.join(","));
|
||||
}
|
||||
that._updateOptionSelectLabel(selected);
|
||||
that._updateOptionSelectLabel(validValues);
|
||||
}
|
||||
} else {
|
||||
var selectedOption = this.optionValue||opt.options[0];
|
||||
|
@@ -243,7 +243,13 @@ RED.keyboard = (function() {
|
||||
|
||||
function resolveKeyEvent(evt) {
|
||||
var slot = partialState||handlers;
|
||||
if (evt.ctrlKey || evt.metaKey) {
|
||||
// We cheat with MacOS CMD key and consider it the same as Ctrl.
|
||||
// That means we don't have to have separate keymaps for different OS.
|
||||
// It mostly works.
|
||||
// One exception is shortcuts that include both Cmd and Ctrl. We don't
|
||||
// support them - but we need to make sure we don't block browser-specific
|
||||
// shortcuts (such as Cmd-Ctrl-F for fullscreen).
|
||||
if ((evt.ctrlKey || evt.metaKey) && (evt.ctrlKey !== evt.metaKey)) {
|
||||
slot = slot.ctrl;
|
||||
}
|
||||
if (slot && evt.shiftKey) {
|
||||
|
@@ -2387,6 +2387,7 @@ RED.projects = (function() {
|
||||
return {
|
||||
init: init,
|
||||
showStartup: function() {
|
||||
console.warn("showStartup")
|
||||
if (!RED.user.hasPermission("projects.write")) {
|
||||
RED.notify(RED._("user.errors.notAuthorized"),"error");
|
||||
return;
|
||||
|
@@ -393,10 +393,12 @@ RED.sidebar.help = (function() {
|
||||
treeList.treeList("select","changelog");
|
||||
show();
|
||||
}
|
||||
function showWelcomeTour(lastSeenVersion) {
|
||||
function showWelcomeTour(lastSeenVersion, done) {
|
||||
done = done || function() {};
|
||||
RED.tourGuide.load("./tours/welcome.js", function(err, tour) {
|
||||
if (err) {
|
||||
console.warn("Failed to load welcome tour",err);
|
||||
done()
|
||||
return;
|
||||
}
|
||||
var currentVersionParts = RED.settings.version.split(".");
|
||||
@@ -405,6 +407,7 @@ RED.sidebar.help = (function() {
|
||||
// Only display the tour if its MAJ.MIN versions the current version
|
||||
// This means if we update MAJ/MIN without updating the tour, the old tour won't get shown
|
||||
if (tourVersionParts[0] !== currentVersionParts[0] || tourVersionParts[1] !== currentVersionParts[1]) {
|
||||
done()
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -412,26 +415,31 @@ RED.sidebar.help = (function() {
|
||||
// Previously displayed a welcome tour.
|
||||
if (lastSeenVersion === RED.settings.version) {
|
||||
// Exact match - don't show the tour
|
||||
done()
|
||||
return;
|
||||
}
|
||||
var lastSeenParts = lastSeenVersion.split(".");
|
||||
if (currentVersionParts[0] < lastSeenParts[0] || (currentVersionParts[0] === lastSeenParts[0] && currentVersionParts[1] < lastSeenParts[1])) {
|
||||
// Running an *older* version than last displayed tour.
|
||||
done()
|
||||
return;
|
||||
}
|
||||
if (currentVersionParts[0] === lastSeenParts[0] && currentVersionParts[1] === lastSeenParts[1]) {
|
||||
if (lastSeenParts.length === 3 && currentVersionParts.length === 3) {
|
||||
// Matching non-beta MAJ.MIN - don't repeat tour
|
||||
done()
|
||||
return;
|
||||
}
|
||||
if (currentVersionParts.length === 4 && (lastSeenParts.length === 3 || currentVersionParts[3] < lastSeenParts[3])) {
|
||||
// Running an *older* beta than last displayed tour.
|
||||
done()
|
||||
return
|
||||
}
|
||||
}
|
||||
}
|
||||
RED.tourGuide.run("./tours/welcome.js", function(err) {
|
||||
RED.settings.set("editor.tours.welcome", RED.settings.version)
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
|
@@ -287,11 +287,11 @@ RED.sidebar.info.outliner = (function() {
|
||||
var node = RED.nodes.node(item.id) || RED.nodes.group(item.id);
|
||||
if (node) {
|
||||
if (node.type === 'group' || node._def.category !== "config") {
|
||||
RED.view.select({nodes:[node]})
|
||||
// RED.view.select({nodes:[node]})
|
||||
} else if (node._def.category === "config") {
|
||||
RED.sidebar.info.refresh(node);
|
||||
} else {
|
||||
RED.view.select({nodes:[]})
|
||||
// RED.view.select({nodes:[]})
|
||||
}
|
||||
}
|
||||
})
|
||||
|
@@ -563,7 +563,8 @@ RED.utils = (function() {
|
||||
expandPaths: expandPaths,
|
||||
ontoggle: ontoggle,
|
||||
exposeApi: exposeApi,
|
||||
tools: tools
|
||||
// tools: tools // Do not pass tools down as we
|
||||
// keep them attached to the top-level header
|
||||
}
|
||||
).appendTo(row);
|
||||
}
|
||||
@@ -592,7 +593,8 @@ RED.utils = (function() {
|
||||
expandPaths: expandPaths,
|
||||
ontoggle: ontoggle,
|
||||
exposeApi: exposeApi,
|
||||
tools: tools
|
||||
// tools: tools // Do not pass tools down as we
|
||||
// keep them attached to the top-level header
|
||||
}
|
||||
).appendTo(row);
|
||||
}
|
||||
@@ -647,7 +649,8 @@ RED.utils = (function() {
|
||||
expandPaths: expandPaths,
|
||||
ontoggle: ontoggle,
|
||||
exposeApi: exposeApi,
|
||||
tools: tools
|
||||
// tools: tools // Do not pass tools down as we
|
||||
// keep them attached to the top-level header
|
||||
}
|
||||
).appendTo(row);
|
||||
}
|
||||
|
@@ -4006,10 +4006,10 @@ RED.view = (function() {
|
||||
var labelParts;
|
||||
if (d.resize || this.__hideLabel__ !== hideLabel || this.__label__ !== label || this.__outputs__.length !== d.outputs) {
|
||||
labelParts = getLabelParts(label, "red-ui-flow-node-label");
|
||||
this.__label__ = label;
|
||||
if (labelParts.lines.length !== this.__labelLineCount__) {
|
||||
if (labelParts.lines.length !== this.__labelLineCount__ || this.__label__ !== label) {
|
||||
d.resize = true;
|
||||
}
|
||||
this.__label__ = label;
|
||||
this.__labelLineCount__ = labelParts.lines.length;
|
||||
|
||||
if (hideLabel) {
|
||||
|
@@ -43,12 +43,24 @@
|
||||
border-bottom: 1px solid $secondary-border-color;
|
||||
box-shadow: 0 2px 6px $shadow;
|
||||
}
|
||||
.red-ui-debug-filter-row {
|
||||
.red-ui-nodeList {
|
||||
margin: 10px 0;
|
||||
#red-ui-sidebar-debug-filter-node-list-row {
|
||||
.red-ui-treeList-label.disabled {
|
||||
font-style: italic;
|
||||
color: $secondary-text-color-disabled;
|
||||
}
|
||||
|
||||
.red-ui-treeList-label {
|
||||
&.selected, &.selected .red-ui-treeList-sublabel-text {
|
||||
background: inherit;
|
||||
}
|
||||
&.selected, &.selected .red-ui-treeList-sublabel-text {
|
||||
background: inherit;
|
||||
}
|
||||
&.focus, &.focus .red-ui-treeList-sublabel-text {
|
||||
background: $list-item-background-hover !important;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.red-ui-debug-msg {
|
||||
position: relative;
|
||||
border-bottom: 1px solid $debug-message-border;
|
||||
|
@@ -73,13 +73,13 @@
|
||||
.red-ui-projects-dialog-screen-start {
|
||||
.red-ui-projects-dialog-screen-start-hero {
|
||||
text-align: center;
|
||||
font-size: 2em;
|
||||
font-size: 1.4em;
|
||||
padding: 10px;
|
||||
min-height: 60px;
|
||||
min-height: 40px;
|
||||
color: $primary-text-color;
|
||||
}
|
||||
.red-ui-projects-dialog-screen-start-body {
|
||||
min-height: 400px;
|
||||
min-height: 300px;
|
||||
line-height: 1.6em;
|
||||
p {
|
||||
font-size: 1.1em;
|
||||
@@ -92,7 +92,7 @@
|
||||
}
|
||||
button.red-ui-button.red-ui-projects-dialog-button {
|
||||
width: calc(50% - 80px);
|
||||
margin: 20px;
|
||||
margin: 10px 20px;
|
||||
height: auto;
|
||||
line-height: 2em;
|
||||
padding: 10px;
|
||||
|
@@ -434,16 +434,19 @@ div.red-ui-info-table {
|
||||
}
|
||||
.red-ui-info-outline-item-controls {
|
||||
position: absolute;
|
||||
top:0;
|
||||
bottom: 0;
|
||||
right: 0px;
|
||||
padding: 2px 3px 0 1px;
|
||||
top:1px;
|
||||
bottom: 1px;
|
||||
right: 1px;
|
||||
padding: 1px 2px 0 1px;
|
||||
text-align: right;
|
||||
background: $list-item-background;
|
||||
|
||||
.red-ui-treeList-label:hover & {
|
||||
background: $list-item-background-hover;
|
||||
}
|
||||
.red-ui-treeList-label.focus & {
|
||||
background: $list-item-background-hover;
|
||||
}
|
||||
.red-ui-treeList-label.selected & {
|
||||
background: $list-item-background-selected;
|
||||
}
|
||||
|
@@ -89,6 +89,12 @@
|
||||
color: $list-item-color;
|
||||
text-decoration: none;
|
||||
}
|
||||
&.focus, &.focus .red-ui-treeList-sublabel-text {
|
||||
background: $list-item-background-hover;
|
||||
outline: 1px solid $form-input-focus-color !important;
|
||||
outline-offset: -1px;
|
||||
color: $list-item-color;
|
||||
}
|
||||
&.selected, &.selected .red-ui-treeList-sublabel-text {
|
||||
background: $list-item-background-selected;
|
||||
outline: none;
|
||||
|
@@ -144,7 +144,9 @@ export default {
|
||||
"ja": "Link Callノードを追加"
|
||||
},
|
||||
prepare(done) {
|
||||
$('[data-palette-type="link call"]')[0].scrollIntoView({block:"center"});
|
||||
this.paletteWasClosed = $("#red-ui-main-container").hasClass("red-ui-palette-closed");
|
||||
RED.actions.invoke("core:toggle-palette",true)
|
||||
$('[data-palette-type="link call"]')[0].scrollIntoView({block:"center"})
|
||||
setTimeout(done,100);
|
||||
},
|
||||
element: '[data-palette-type="link call"]',
|
||||
@@ -154,6 +156,22 @@ export default {
|
||||
"ja": "<p><code>Link Call</code>ノードを用いることで、<code>Link In</code>ノードから始まるフローを呼び出し、<code>Link Out</code>ノードに到達した時に、結果を取得できます。</p>"
|
||||
}
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "MQTT nodes support dynamic connections",
|
||||
"ja": "MQTTノードが動的接続をサポート"
|
||||
},
|
||||
prepare(done) {
|
||||
$('[data-palette-type="mqtt out"]')[0].scrollIntoView({block:"center"})
|
||||
setTimeout(done,100);
|
||||
},
|
||||
element: '[data-palette-type="mqtt out"]',
|
||||
direction: "right",
|
||||
description: {
|
||||
"en-US": '<p>The <code>MQTT</code> nodes now support creating their connections and subscriptions dynamically.</p>',
|
||||
"ja": '<p><code>MQTT</code>ノードは、動的な接続や購読ができるようになりました。</p>'
|
||||
},
|
||||
},
|
||||
{
|
||||
title: {
|
||||
"en-US": "File nodes renamed",
|
||||
@@ -163,6 +181,11 @@ export default {
|
||||
$('[data-palette-type="file"]')[0].scrollIntoView({block:"center"});
|
||||
setTimeout(done,100);
|
||||
},
|
||||
complete() {
|
||||
if (this.paletteWasClosed) {
|
||||
RED.actions.invoke("core:toggle-palette",false)
|
||||
}
|
||||
},
|
||||
element: '[data-palette-type="file"]',
|
||||
direction: "right",
|
||||
description: {
|
||||
|
Reference in New Issue
Block a user