Skip to content

Commit

Permalink
Changes to version update logic
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
janpfischer committed Jun 20, 2019
1 parent a67bfaf commit 5953ae3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 6 deletions.
30 changes: 24 additions & 6 deletions assets/webconfig/js/content_dashboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -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>');
});
Expand Down
2 changes: 2 additions & 0 deletions assets/webconfig/js/hyperion.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand Down

0 comments on commit 5953ae3

Please sign in to comment.