Merge branch 'master' into dev

This commit is contained in:
Nick O'Leary
2021-02-25 17:56:01 +00:00
12 changed files with 162 additions and 37 deletions

View File

@@ -298,7 +298,7 @@ var RED = (function() {
"merge-complete": RED._("notification.project.merge-complete")
}[msg.action];
loader.end()
RED.notify("<p>"+message+"</p>");
RED.notify($("<p>").text(message));
RED.sidebar.info.refresh()
});
});
@@ -469,7 +469,7 @@ var RED = (function() {
});
});
if (addedTypes.length) {
typeList = "<ul><li>"+addedTypes.join("</li><li>")+"</li></ul>";
typeList = "<ul><li>"+addedTypes.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
RED.notify(RED._("palette.event.nodeAdded", {count:addedTypes.length})+typeList,"success");
}
loadIconList();
@@ -478,7 +478,7 @@ var RED = (function() {
m = msg[i];
info = RED.nodes.removeNodeSet(m.id);
if (info.added) {
typeList = "<ul><li>"+m.types.join("</li><li>")+"</li></ul>";
typeList = "<ul><li>"+m.types.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
RED.notify(RED._("palette.event.nodeRemoved", {count:m.types.length})+typeList,"success");
}
}
@@ -488,12 +488,12 @@ var RED = (function() {
info = RED.nodes.getNodeSet(msg.id);
if (info.added) {
RED.nodes.enableNodeSet(msg.id);
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
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.join("</li><li>")+"</li></ul>";
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");
});
}
@@ -501,7 +501,7 @@ var RED = (function() {
} else if (topic == "notification/node/disabled") {
if (msg.types) {
RED.nodes.disableNodeSet(msg.id);
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
typeList = "<ul><li>"+msg.types.map(RED.utils.sanitize).join("</li><li>")+"</li></ul>";
RED.notify(RED._("palette.event.nodeDisabled", {count:msg.types.length})+typeList,"success");
}
} else if (topic == "notification/node/upgraded") {

View File

@@ -31,15 +31,66 @@ RED.palette.editor = (function() {
var eventTimers = {};
var activeFilter = "";
function semVerCompare(A,B) {
var aParts = A.split(".").map(function(m) { return parseInt(m);});
var bParts = B.split(".").map(function(m) { return parseInt(m);});
for (var i=0;i<3;i++) {
var j = aParts[i]-bParts[i];
if (j<0) { return -1 }
if (j>0) { return 1 }
var semverre = /^(?<major>\d+)(\.(?<minor>\d+))?(\.(?<patch>\d+))?(-(?<pre>[0-9A-Za-z-]+))?(\.(?<build>[0-9A-Za-z-.]+))?$/;
var NUMBERS_ONLY = /^\d+$/;
function SemVerPart ( part ) {
this.number = 0;
this.text = part;
if ( NUMBERS_ONLY.test( toe ) )
{
this.number = parseInt( part );
this.type = "N";
} else
{
this.type = part == undefined || part.length < 1 ? "E" : "T";
}
return 0;
}
SemVerPart.prototype.compare = function ( other ) {
const types = this.type + other.type;
switch ( types )
{
case "EE": return 0;
case "NT":
case "TE":
case "EN": return -1;
case "NN": return this.number - other.number;
case "TT": return this.text.localeCompare( other.text );
case "ET":
case "TN":
case "NE": return 1;
}
};
function SemVer ( ver ) {
const groups = ver.match( semverre ).groups;
this.parts = [ new SemVerPart( groups.major ), new SemVerPart( groups.minor ), new SemVerPart( groups.patch ), new SemVerPart( groups.pre ), new SemVerPart( groups.build ) ];
}
SemVer.prototype.compare = function ( other ) {
let result = 0;
for ( let i = 0, n = this.parts.length; result == 0 && i < n; i++ )
{
result = this.parts[ i ].compare( other.parts[ i ] );
}
return result;
};
function semVerCompare ( ver1, ver2 ) {
const semver1 = new SemVer( ver1 );
const semver2 = new SemVer( ver2 );
const result = semver1.compare( semver2 );
return result;
}
function delayCallback(start,callback) {

View File

@@ -1606,6 +1606,11 @@ RED.projects = (function() {
done(null,data);
},
400: {
'credentials_load_failed': function(data) {
dialog.dialog( "close" );
RED.events.emit("project:change", {name:name});
done(null,data);
},
'*': done
},
}