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

Update palette manager properly when module updated

This commit is contained in:
Nick O'Leary 2019-01-07 14:54:35 +00:00
parent 43b7aa40c3
commit 19eb8e9a6d
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
4 changed files with 11 additions and 4 deletions

View File

@ -391,7 +391,7 @@ var RED = (function() {
typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>"; typeList = "<ul><li>"+msg.types.join("</li><li>")+"</li></ul>";
RED.notify(RED._("palette.event.nodeDisabled", {count:msg.types.length})+typeList,"success"); RED.notify(RED._("palette.event.nodeDisabled", {count:msg.types.length})+typeList,"success");
} }
} else if (topic == "node/upgraded") { } else if (topic == "notification/node/upgraded") {
RED.notify(RED._("palette.event.nodeUpgraded", {module:msg.module,version:msg.version}),"success"); RED.notify(RED._("palette.event.nodeUpgraded", {module:msg.module,version:msg.version}),"success");
RED.nodes.registry.setModulePendingUpdated(msg.module,msg.version); RED.nodes.registry.setModulePendingUpdated(msg.module,msg.version);
} }

View File

@ -289,7 +289,7 @@ RED.palette.editor = (function() {
} }
if (moduleInfo.pending_version) { if (moduleInfo.pending_version) {
nodeEntry.versionSpan.html(moduleInfo.version+' <i class="fa fa-long-arrow-right"></i> '+moduleInfo.pending_version).appendTo(nodeEntry.metaRow) nodeEntry.versionSpan.html(moduleInfo.version+' <i class="fa fa-long-arrow-right"></i> '+moduleInfo.pending_version).appendTo(nodeEntry.metaRow)
nodeEntry.updateButton.text(RED._('palette.editor.updated')).addClass('disabled').show(); nodeEntry.updateButton.text(RED._('palette.editor.updated')).addClass('disabled').css('display', 'inline-block');
} else if (loadedIndex.hasOwnProperty(module)) { } else if (loadedIndex.hasOwnProperty(module)) {
if (semVerCompare(loadedIndex[module].version,moduleInfo.version) === 1) { if (semVerCompare(loadedIndex[module].version,moduleInfo.version) === 1) {
nodeEntry.updateButton.show(); nodeEntry.updateButton.show();

View File

@ -270,6 +270,10 @@ function getNodeInfo(typeOrId) {
if (config.hasOwnProperty("loaded")) { if (config.hasOwnProperty("loaded")) {
info.loaded = config.loaded; info.loaded = config.loaded;
} }
if (module.pending_version) {
info.pending_version = module.pending_version;
}
info.version = module.version; info.version = module.version;
return info; return info;
} }
@ -342,6 +346,9 @@ function getModuleInfo(module) {
path: moduleConfigs[module].path, path: moduleConfigs[module].path,
nodes: [] nodes: []
}; };
if (moduleConfigs[module] && moduleConfigs[module].pending_version) {
m.pending_version = moduleConfigs[module].pending_version;
}
for (var i = 0; i < nodes.length; ++i) { for (var i = 0; i < nodes.length; ++i) {
var nodeInfo = filterNodeInfo(moduleConfigs[module].nodes[nodes[i]]); var nodeInfo = filterNodeInfo(moduleConfigs[module].nodes[nodes[i]]);
nodeInfo.version = m.version; nodeInfo.version = m.version;

View File

@ -151,8 +151,8 @@ function reportNodeStateChange(info,enabled) {
} }
function installModule(module,version) { function installModule(module,version) {
var ex_module = registry.getModuleInfo(module); var existingModule = registry.getModuleInfo(module);
var isUpgrade = !!ex_module; var isUpgrade = !!existingModule;
return registry.installModule(module,version).then(function(info) { return registry.installModule(module,version).then(function(info) {
if (isUpgrade) { if (isUpgrade) {
events.emit("runtime-event",{id:"node/upgraded",retain:false,payload:{module:module,version:version}}); events.emit("runtime-event",{id:"node/upgraded",retain:false,payload:{module:module,version:version}});