Changes to version update logic

Now the last stable will be used when the latest stable version have a higher version number than the last beta version. This only triggers when Beta Branch is used. If the user chooses Stable only stable versions will be considered.
This commit is contained in:
birdhouse 2019-06-20 21:02:37 +02:00
parent a67bfaf7b3
commit 5953ae3b21
2 changed files with 26 additions and 6 deletions

View File

@ -84,21 +84,39 @@ $(document).ready( function() {
window.parsedUpdateJSON = JSON.parse(data);
for(let i=0; i<window.parsedUpdateJSON.length; i++) {
if(window.parsedUpdateJSON[i].channel == window.serverConfig.general.versionBranch) {
window.latestVersion = window.parsedUpdateJSON[i].versionnr;
if(window.parsedUpdateJSON[i].channel == "Stable") {
window.latestStableVersion = window.parsedUpdateJSON[i];
break;
}
else window.latestVersion = window.currentVersion;
}
var cleanLatestVersion = window.latestVersion.replace(/\./g, '');
for(let i=0; i<window.parsedUpdateJSON.length; i++) {
if(window.parsedUpdateJSON[i].channel == "Beta") {
window.latestBetaVersion = window.parsedUpdateJSON[i];
break;
}
}
console.log("Stable"+ window.latestStableVersion.versionnr.replace(/\./g, ''))
console.log("Beta"+ window.latestBetaVersion.versionnr.replace(/\./g, ''))
if(window.serverConfig.general.versionBranch == "Beta" && window.latestStableVersion.versionnr.replace(/\./g, '') <= window.latestBetaVersion.versionnr.replace(/\./g, '')) {
window.latestVersion = window.latestBetaVersion;
}
else {
window.latestVersion = window.latestStableVersion;
}
console.log(latestVersion)
var cleanLatestVersion = window.latestVersion.versionnr.replace(/\./g, '');
var cleanCurrentVersion = window.currentVersion.replace(/\./g, '');
$('#dash_latev').html(window.currentVersion);
$('#dash_latev').html(window.latestVersion);
$('#dash_latev').html(window.latestVersion.versionnr + ' (' + window.latestVersion.channel + ')');
if ( cleanCurrentVersion < cleanLatestVersion )
$('#versioninforesult').html('<div class="bs-callout bs-callout-warning" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion)+'</div>');
$('#versioninforesult').html('<div class="bs-callout bs-callout-warning" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatewarning', window.latestVersion.versionnr) + ' (' + window.latestVersion.channel + ')</div>');
else
$('#versioninforesult').html('<div class="bs-callout bs-callout-success" style="margin:0px">'+$.i18n('dashboard_infobox_message_updatesuccess')+'</div>');
});

View File

@ -4,6 +4,8 @@ window.webOrigin = "Web Configuration";
window.showOptHelp = true;
window.currentVersion = null;
window.latestVersion = null;
window.latestStableVersion = null;
window.latestBetaVersion = null;
window.serverInfo = {};
window.parsedUpdateJSON = {};
window.serverSchema = {};