mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
json-rpc - origin, ui update (#407)
* try ace * . * update * ... * update * update * test * - * update * fix * . * Revert "." This reverts commit631c30f8c0
. * Revert "fix" This reverts commitbe3dbc9cbd
. * Revert "update" This reverts commit50fc89e800
. * Revert "-" This reverts commit8a6c1fdab3
. * Revert "test" This reverts commit50b3641490
. * update schema * update ui * flags * adjustments
This commit is contained in:
@@ -1,6 +1,53 @@
|
||||
$(document).ready( function() {
|
||||
performTranslation();
|
||||
|
||||
function newsCont(t,e,l)
|
||||
{
|
||||
var h = '<div style="padding-left:9px;border-left:6px solid #0088cc;">';
|
||||
h += '<h4 style="font-weight:bold;font-size:17px">'+t+'</h4>';
|
||||
h += e;
|
||||
h += '<a href="'+l+'" class="" target="_blank"><i class="fa fa-fw fa-newspaper-o"></i>'+$.i18n('dashboard_newsbox_readmore')+'</a>';
|
||||
h += '</div><hr/>';
|
||||
$('#dash_news').append(h);
|
||||
}
|
||||
|
||||
function createNews(d)
|
||||
{
|
||||
for(var i = 0; i<d.length; i++)
|
||||
{
|
||||
if(i > 5)
|
||||
break;
|
||||
|
||||
title = d[i].title.rendered;
|
||||
excerpt = d[i].excerpt.rendered;
|
||||
link = d[i].link+'?pk_campaign=WebUI&pk_kwd=post_'+d[i].slug;
|
||||
|
||||
newsCont(title,excerpt,link);
|
||||
}
|
||||
}
|
||||
|
||||
function getNews()
|
||||
{
|
||||
var h = '<span style="color:red;font-weight:bold">'+$.i18n('dashboard_newsbox_noconn')+'</span>';
|
||||
$.ajax({
|
||||
url: 'https://hyperion-project.org/wp-json/wp/v2/posts?_embed',
|
||||
dataType: 'json',
|
||||
type: 'GET',
|
||||
timeout: 2000
|
||||
})
|
||||
.done( function( data, textStatus, jqXHR ) {
|
||||
if(jqXHR.status == 200)
|
||||
createNews(data);
|
||||
else
|
||||
$('#dash_news').html(h);
|
||||
})
|
||||
.fail( function( jqXHR, textStatus ) {
|
||||
$('#dash_news').html(h);
|
||||
});
|
||||
}
|
||||
|
||||
//getNews();
|
||||
|
||||
function updateComponents()
|
||||
{
|
||||
var components = serverInfo.info.components;
|
||||
@@ -12,13 +59,11 @@ $(document).ready( function() {
|
||||
$("#tab_components").html(components_html);
|
||||
}
|
||||
|
||||
// get active led device
|
||||
var leddevice = serverInfo.info.ledDevices.active;
|
||||
$('#dash_leddevice').html(leddevice);
|
||||
|
||||
// get host
|
||||
var hostname = serverInfo.info.hostname;
|
||||
$('#dash_systeminfo').html(hostname+':'+jsonPort);
|
||||
// add more info
|
||||
$('#dash_leddevice').html(serverInfo.info.ledDevices.active);
|
||||
$('#dash_currv').html(currentVersion);
|
||||
$('#dash_instance').html(serverConfig.general.name);
|
||||
$('#dash_ports').html(jsonPort+' | '+serverConfig.protoServer.port);
|
||||
|
||||
$.get( "https://raw.githubusercontent.com/hyperion-project/hyperion.ng/master/version.json", function( data ) {
|
||||
parsedUpdateJSON = JSON.parse(data);
|
||||
@@ -26,8 +71,7 @@ $(document).ready( function() {
|
||||
var cleanLatestVersion = latestVersion.replace(/\./g, '');
|
||||
var cleanCurrentVersion = currentVersion.replace(/\./g, '');
|
||||
|
||||
$('#currentversion').html(currentVersion);
|
||||
$('#latestversion').html(latestVersion);
|
||||
$('#dash_latev').html(latestVersion);
|
||||
|
||||
if ( cleanCurrentVersion < cleanLatestVersion )
|
||||
$('#versioninforesult').html('<div style="margin:0px;" class="alert alert-warning">'+$.i18n('dashboard_infobox_message_updatewarning', latestVersion)+'</div>');
|
||||
@@ -35,6 +79,24 @@ $(document).ready( function() {
|
||||
$('#versioninforesult').html('<div style="margin:0px;" class="alert alert-success">'+$.i18n('dashboard_infobox_message_updatesuccess')+'</div>');
|
||||
});
|
||||
|
||||
//determine platform
|
||||
var grabbers = serverInfo.info.grabbers.available;
|
||||
var html = "";
|
||||
|
||||
if(grabbers.indexOf('dispmanx') > -1)
|
||||
html += 'Raspberry Pi';
|
||||
else if(grabbers.indexOf('x11') > -1)
|
||||
html += 'X86';
|
||||
else if(grabbers.indexOf('osx') > -1)
|
||||
html += 'OSX';
|
||||
else if(grabbers.indexOf('amlogic') > -1)
|
||||
html += 'Amlogic';
|
||||
else
|
||||
html += 'Framebuffer';
|
||||
|
||||
$('#dash_platform').html(html);
|
||||
|
||||
|
||||
//interval update
|
||||
updateComponents();
|
||||
$(hyperion).on("cmd-serverinfo",updateComponents);
|
||||
|
Reference in New Issue
Block a user