mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Merge index.html and QJsonSchemaChecker changes
This commit is contained in:
parent
b6cec24596
commit
752b32c906
@ -1,4 +1,4 @@
|
||||
<!DOCTYPE html>
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
@ -25,10 +25,8 @@
|
||||
<link href="css/bootstrap-switch.min.css" rel="stylesheet">
|
||||
|
||||
<!-- JSONForm -->
|
||||
<script src="js/lib/underscore.js"></script>
|
||||
<script src="js/lib/jsonform.js"></script>
|
||||
|
||||
|
||||
<!--<script src="js/lib/underscore.js"></script>
|
||||
<script src="js/lib/jsonform.js"></script>-->
|
||||
<script src="js/lib/jsoneditor.min.js"></script>
|
||||
|
||||
<!--Language Support -->
|
||||
@ -38,19 +36,14 @@
|
||||
<script type="text/javascript">
|
||||
// Create language switcher instance
|
||||
var lang = new Lang();
|
||||
|
||||
lang.dynamic('de', 'lang/de.json');
|
||||
|
||||
lang.init({
|
||||
defaultLang: 'en',
|
||||
|
||||
cookie: {
|
||||
name: 'langCookie',
|
||||
expiry: 365,
|
||||
path: '/'
|
||||
},
|
||||
|
||||
|
||||
allowCookieOverride: true
|
||||
});
|
||||
</script>
|
||||
@ -493,12 +486,10 @@
|
||||
<!-- Custom Theme JavaScript -->
|
||||
<script src="js/lib/sb-admin-2.js"></script>
|
||||
<script>
|
||||
|
||||
$(document).ready( function() {
|
||||
$("#load_lighttest").on("click", function() {
|
||||
$("#page-wrapper").load("lighttest.html");
|
||||
});
|
||||
|
||||
$("#load_effects").on("click", function() {
|
||||
$("#page-wrapper").load("effects.html");
|
||||
});
|
||||
@ -506,75 +497,28 @@
|
||||
$("#load_components").on("click", function() {
|
||||
$("#page-wrapper").load("remote_components.html");
|
||||
});
|
||||
|
||||
$("#load_huebridge").on("click", function() {
|
||||
$("#page-wrapper").load("huebridge.html");
|
||||
});
|
||||
|
||||
$("#load_support").on("click", function() {
|
||||
$("#page-wrapper").load("support.html");
|
||||
});
|
||||
|
||||
$("#load_confKodi").on("click", function() {
|
||||
$("#page-wrapper").load("kodiconf.html");
|
||||
});
|
||||
|
||||
$("#load_update").on("click", function() {
|
||||
$("#page-wrapper").load("update.html");
|
||||
});
|
||||
|
||||
$("#load_confGeneral").on("click", function() {
|
||||
$("#page-wrapper").load("generalconf.html");
|
||||
});
|
||||
|
||||
//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>');
|
||||
}
|
||||
});
|
||||
|
||||
};
|
||||
loaddata();
|
||||
|
||||
});
|
||||
$(function(){
|
||||
var sidebar = $('#side-menu'); // cache sidebar to a variable for performance
|
||||
|
||||
sidebar.delegate('a.inactive','click',function(){
|
||||
sidebar.find('.active').toggleClass('active inactive');
|
||||
$(this).toggleClass('active inactive');
|
||||
|
@ -2,7 +2,7 @@
|
||||
#include <iterator>
|
||||
#include <sstream>
|
||||
#include <algorithm>
|
||||
#include <math.h>
|
||||
#include <math.h>
|
||||
|
||||
// Utils-Jsonschema includes
|
||||
#include <utils/jsonschema/QJsonSchemaChecker.h>
|
||||
@ -45,9 +45,9 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
|
||||
// check the current json value
|
||||
for (QJsonObject::const_iterator i = schema.begin(); i != schema.end(); ++i)
|
||||
{
|
||||
QString attribute = i.key();
|
||||
QString attribute = i.key();
|
||||
const QJsonValue & attributeValue = *i;
|
||||
|
||||
|
||||
if (attribute == "type")
|
||||
checkType(value, attributeValue);
|
||||
else if (attribute == "properties")
|
||||
@ -71,7 +71,7 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
|
||||
const QJsonObject & props = schema["properties"].toObject();
|
||||
ignoredProperties = props.keys();
|
||||
}
|
||||
|
||||
|
||||
checkAdditionalProperties(value.toObject(), attributeValue, ignoredProperties);
|
||||
}
|
||||
else
|
||||
@ -108,7 +108,7 @@ void QJsonSchemaChecker::validate(const QJsonValue & value, const QJsonObject &s
|
||||
; // nothing to do. value is present so always oke
|
||||
else if (attribute == "id")
|
||||
; // references have already been collected
|
||||
else if (attribute == "title" || attribute == "description" || attribute == "default")
|
||||
else if (attribute == "title" || attribute == "description" || attribute == "default" || attribute == "format")
|
||||
; // nothing to do.
|
||||
else
|
||||
{
|
||||
@ -135,7 +135,7 @@ const std::list<std::string> & QJsonSchemaChecker::getMessages() const
|
||||
void QJsonSchemaChecker::checkType(const QJsonValue & value, const QJsonValue & schema)
|
||||
{
|
||||
QString type = schema.toString();
|
||||
|
||||
|
||||
bool wrongType = false;
|
||||
if (type == "string")
|
||||
wrongType = !value.isString();
|
||||
@ -168,16 +168,16 @@ void QJsonSchemaChecker::checkType(const QJsonValue & value, const QJsonValue &
|
||||
}
|
||||
|
||||
void QJsonSchemaChecker::checkProperties(const QJsonObject & value, const QJsonObject & schema)
|
||||
{
|
||||
{
|
||||
for (QJsonObject::const_iterator i = schema.begin(); i != schema.end(); ++i)
|
||||
{
|
||||
QString property = i.key();
|
||||
|
||||
|
||||
const QJsonValue & propertyValue = i.value();
|
||||
|
||||
_currentPath.push_back(std::string(".") + property.toStdString());
|
||||
QJsonObject::const_iterator required = propertyValue.toObject().find("required");
|
||||
|
||||
|
||||
if (value.contains(property))
|
||||
{
|
||||
validate(value[property], propertyValue.toObject());
|
||||
@ -264,7 +264,7 @@ void QJsonSchemaChecker::checkItems(const QJsonValue & value, const QJsonObject
|
||||
setMessage("items only valid for arrays");
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
QJsonArray jArray = value.toArray();
|
||||
for(int i = 0; i < jArray.size(); ++i)
|
||||
{
|
||||
|
Loading…
x
Reference in New Issue
Block a user