Web: Dashboard version comparison (#196)

* update version

* update version

* update

* add update echeck
This commit is contained in:
brindosch 2016-08-23 20:17:50 +02:00 committed by GitHub
parent d679affeb4
commit 2cc107842a
5 changed files with 85 additions and 28 deletions

View File

@ -9,6 +9,8 @@ body{font-family:Roboto,"Helvetica Neue",Helvetica,Arial,sans-serif;font-size:15
@media (max-width: 767px){div[class*="col-"] {padding:0;}}
/*icon spacing*/
.fa-fw{margin-right:5px;}
/*borderless table*/
table.borderless td,table.borderless th{border: none !important;}
/*Header*/
.navbar-brand{padding: 5px;height:90px;}

View File

@ -345,10 +345,6 @@
<h4 lang="en" data-lang-token="dashboard_label_intro">The dashboard give you a quick overview about the status of Hyperion and show you the latest news of the Hyperion Blog.</h4>
</div>
<hr>
<div class="alert alert-info alert-dismissible" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
<strong>Info!</strong> A newer version of Hyperion is available!
</div>
<div class="col-lg-4">
<div class="panel panel-default">
<div class="panel-heading">
@ -356,9 +352,24 @@
<span lang="en" data-lang-token="dashboard_label_infobox_title">Information</span>
</div>
<div class="panel-body">
<p lang="en" data-lang-token="dashboard_label_infobox_currenthyp">Your Hyperion version:</p>
<p lang="en" data-lang-token="dashboard_label_infobox_latesthyp">Latest version:</p>
<p lang="en" data-lang-token="dashboard_label_infobox_device">Device:</p>
<table class="table borderless">
<tbody>
<tr>
<td lang="en" data-lang-token="dashboard_label_infobox_currenthyp">Your Hyperion version:</td>
<td id="currentversion"></td>
</tr>
<tr>
<td lang="en" data-lang-token="dashboard_label_infobox_latesthyp">Latest version:</td>
<td id="latestversion"></td>
</tr>
<tr>
<td lang="en" data-lang-token="dashboard_label_infobox_device">Device:</td>
<td></td>
</tr>
</tbody>
</table>
<hr>
<span id="versioninforesult"></span>
</div>
</div>
</div>
@ -462,6 +473,47 @@
//Change all Checkboxes to Switches
$("[type='checkbox']").bootstrapSwitch();
// vesion check
var currentVersion;
var cleanCurrentVersion;
var latestVersion;
var cleanLatestVersion;
webSocket = new WebSocket('ws://'+document.location.hostname+':19444');
var serverInfo;
webSocket.onerror = function(event) {
alert(event.data);
};
webSocket.onopen = function(event) {
webSocket.send('{"command":"serverinfo"}');
};
webSocket.onmessage = function(response){
responseJSON = JSON.parse(response.data );
currentVersion = responseJSON.info.hyperion[0].version;
cleanCurrentVersion = currentVersion.replace(/\./g, '');
$.get( "https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/version.json", function( data ) {
var responseJSON = JSON.parse(data);
latestVersion = responseJSON[0].versionnr;
cleanLatestVersion = latestVersion.replace(/\./g, '');
$('#currentversion').append(' V'+currentVersion);
$('#latestversion').append(' V'+latestVersion);
if ( cleanCurrentVersion < cleanLatestVersion ) {
$('#versioninforesult').append('<div lang="en" data-lang-token="dashboard_message_infobox_updatewarning" style="margin:0px;" class="alert alert-warning">A newer version of Hyperion is available!</div>');
}
else{
$('#versioninforesult').append('<div lang="en" data-lang-token="dashboard_message_infobox_updatesuccess" style="margin:0px;" class="alert alert-success">You run the latest version of Hyperion.</div>');
}
});
};
});
$(function(){
var sidebar = $('#side-menu'); // cache sidebar to a variable for performance

View File

@ -16,6 +16,8 @@
"dashboard_label_infobox_device" : "Geräteinformation:",
"dashboard_label_componentbox_title" : "Komponenten Status",
"dashboard_label_newsbox_title" : "Die letzten Blogposts",
"dashboard_message_infobox_updatewarning" : "Eine aktuellere Version von Hyperion ist verfügbar!",
"dashboard_message_infobox_updatesuccess" : "Du nutzt die aktuellste Version von Hyperion.",
"main_menu_dashboard_token" : "Dashboard",
"main_menu_configuration_token" : "Konfiguration",
"main_menu_kodiwatch_token" : "Kodi Überwachung",

View File

@ -18,7 +18,7 @@ $.get( "https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/ve
var vlist = JSON.parse(data);
for (key in vlist)
{
$('#versionlist').append('<div class="col-lg-6"><div class="panel panel-default"><div class="panel-heading"><i class="fa fa-television fa-fw"></i>Hyperion V'+key+'</div><div class="panel-body"><p><span style="font-weight:bold;" lang="en" data-lang-token="update_label_type">Type:</span> '+ vlist[key].channel +'</p><p><span style="font-weight:bold;" lang="en" data-lang-token="update_label_description">Description:</span> '+vlist[key].versiondesc+'</p><hr><a class="btn btn-primary" href="'+ vlist[key].versionchangelog +'" target="_blank"><i class="fa fa-list fa-fw"></i><span style="font-weight:bold;" lang="en" data-lang-token="update_button_changelog">Full changelog</span></a><button type="button" class="btn btn-warning pull-right"><i class="fa fa-download fa-fw"></i><span lang="en" data-lang-token="update_button_install">Install</span></button></div></div></div>');
$('#versionlist').append('<div class="col-lg-6"><div class="panel panel-default"><div class="panel-heading"><i class="fa fa-television fa-fw"></i>Hyperion V'+vlist[key].versionnr+'</div><div class="panel-body"><p><span style="font-weight:bold;" lang="en" data-lang-token="update_label_type">Type:</span> '+ vlist[key].channel +'</p><p><span style="font-weight:bold;" lang="en" data-lang-token="update_label_description">Description:</span> '+vlist[key].versiondesc+'</p><hr><a class="btn btn-primary" href="'+ vlist[key].versionchangelog +'" target="_blank"><i class="fa fa-list fa-fw"></i><span style="font-weight:bold;" lang="en" data-lang-token="update_button_changelog">Full changelog</span></a><button type="button" class="btn btn-warning pull-right"><i class="fa fa-download fa-fw"></i><span lang="en" data-lang-token="update_button_install">Install</span></button></div></div></div>');
}
});

View File

@ -1,20 +1,21 @@
{
"2.1.0":
{
"versiondesc": "This version introduces feature x and some small bugfixes at the web configuration",
"versionchangelog":"https://www.hyperion-project.org/blog/id1",
"channel" : "Stable"
},
"2.0.1":
{
"versiondesc": "This is a bugfix release for 2.0.0",
"versionchangelog": "https://www.hyperion-project.org/blog/id3",
"channel" : "Stable"
},
"2.0.0":
{
"versiondesc": "Version 2.0.0 introduces the succesor of Hyperion 1.0 with plenty new features to discover with a entire code rework and a highly extended JSON RPC!",
"versionchangelog": "https://www.hyperion-project.org/blog/id0",
"channel" : "Stable"
}
}
[
{
"versionnr" : "2.1.0",
"versiondesc": "This version introduces feature x and some small bugfixes at the web configuration",
"versionchangelog":"https://www.hyperion-project.org/blog/id1",
"channel" : "Stable"
},
{
"versionnr" : "2.0.1",
"versiondesc": "This is a bugfix release for 2.0.0",
"versionchangelog": "https://www.hyperion-project.org/blog/id3",
"channel" : "Stable"
},
{
"versionnr" : "2.0.0",
"versiondesc": "Version 2.0.0 introduces the succesor of Hyperion 1.0 with plenty new features to discover with a entire code rework and a highly extended JSON RPC!",
"versionchangelog": "https://www.hyperion-project.org/blog/id0",
"channel" : "Stable"
}
]