diff --git a/views/default.handlebars b/views/default.handlebars index a09e2136..b9ffa8f7 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -2365,23 +2365,7 @@ } case 'pluginVersionsAvailable': { if (pluginHandler == null) break; - try { - var td = Q('pluginRow-'+message.list.id).querySelectorAll(".pluginUpgradeAvailable"); - var sel = Q('pluginRow-'+message.list.id).querySelectorAll(".pluginAction > select"); - td = td[0]; - sel = sel[0]; - if (message.list.hasUpdate && message.list.status) { - td.innerHTML = '' + message.list.version + ''; - if (sel.innerHTML.indexOf('Upgrade') === -1) { - var option = document.createElement("option"); - option.value = "install" - option.text = "Upgrade"; - sel.add(option); - } - } else { - td.innerHTML = "Up to date"; - } - } catch (e) { } + updatePluginList(message.list); break; } case 'plugin': { @@ -9434,8 +9418,12 @@ } } - function updatePluginList() { + function updatePluginList(versInfo) { if (installedPluginList.length) { + if (versInfo != null) { + if (installedPluginList['version_info'] == null) installedPluginList['version_info'] = []; + installedPluginList['version_info'][versInfo.id] = versInfo; + } var tr = Q('p7tbl').querySelectorAll(".p7tblRow"); if (tr.length) { for (const i in Object.values(tr)) { @@ -9458,24 +9446,51 @@ 'delete': 'Delete' }, 1: { - 'disable': 'Disable' + 'disable': 'Disable', + 'upgrade': 'Upgrade' } }; + var vers_not_compat = ` [ ! ]`; + var tbl = Q('p7tbl'); installedPluginList.forEach(function(p){ + var cant_action = []; if (p.hasAdminPanel == true) { p.name = `${p.name}`; } p.statusText = statusMap[p.status].text; p.statusColor = statusMap[p.status].color; + + + if (!p.status) { // It isn't technically installed, so no version number + p.version = ' - '; + } + p.upgradeAvail = 'Checking...'; + if (installedPluginList['version_info'] != null && installedPluginList['version_info'][p._id] != null) { + var vin = installedPluginList['version_info'][p._id]; + if (vin.hasUpdate) { + p.upgradeAvail = '' + vin.version + ''; + } else { + cant_action.push('upgrade'); + if (p.status) p.upgradeAvail = 'Up to date'; + else p.upgradeAvail = '' + vin.version + ''; + } + if (!vin.meshCentralCompat) { + p.upgradeAvail += vers_not_compat; + cant_action.push('install'); + } + } + p.actions = '' + p.actions += ''; - let tpl = `