Example JSON Form Example with General setting (#185)

I have created a new Category "General" with several Settings for
Hyperion.
For now the Submit Button only console.log's the values.

Known Bug: For some reason it seems to do not load the bootstrap
correctly or maybe the Lib isn't compatible with the newest version of
bootstrap.
This commit is contained in:
b1rdhous3 2016-08-18 21:14:50 +02:00 committed by redPanther
parent b9ad2977de
commit d8f6f86948
9 changed files with 11540 additions and 30 deletions

6757
assets/webconfig/css/bootstrap.css vendored Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,75 @@
<div class="container-fluid">
<div class="row">
<div class="col-lg-12">
<h1 class="page-header" lang="en" data-lang-token="main_menu_general_conf_token">General</h1>
<div class="introd">
<h4 lang="en" data-lang-token="remote_general_conf_intro">You can edit the general configuration here.</h4>
</div>
<hr>
<div class="col-lg-12">
<form></form>
</div>
</div>
</div>
</div>
<script type="text/javascript">
</script>
<script>
$(document).ready( function() {
webSocket = new WebSocket('ws://'+document.location.hostname+':19444');
var serverInfo;
webSocket.onerror = function(event) {
alert(event.data);
};
webSocket.onopen = function(event) {
webSocket.send('{"command":"config","subcommand":"getschema"}');
};
webSocket.onmessage = function(response){
logger = JSON.parse(response.data).result.properties.logger;
jsonServer = JSON.parse(response.data).result.properties.jsonServer;
protoServer = JSON.parse(response.data).result.properties.protoServer;
boblightServer = JSON.parse(response.data).result.properties.boblightServer;
udpListener = JSON.parse(response.data).result.properties.udpListener;
webConfig = JSON.parse(response.data).result.properties.webConfig;
$('form').jsonForm({
schema: {
logger,
jsonServer,
protoServer,
boblightServer,
udpListener,
webConfig,
},
onSubmit: function (errors, values) {
if (errors) {
console.log(errors);
}
else {
console.log(values);
}
}
});
}
});
</script>

View File

@ -15,6 +15,10 @@
<!-- jQuery --> <!-- jQuery -->
<script src="js/jquery.min.js"></script> <script src="js/jquery.min.js"></script>
<!-- JSONForm -->
<script src="js/underscore.js"></script>
<script src="js/jsonform.js"></script>
<!--Language Support --> <!--Language Support -->
<script src="js/jquery-lang.js" charset="utf-8" type="text/javascript"></script> <script src="js/jquery-lang.js" charset="utf-8" type="text/javascript"></script>
<script src="js/js.cookie.js"></script> <script src="js/js.cookie.js"></script>
@ -41,7 +45,7 @@
<!-- Bootstrap Core CSS --> <!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel="stylesheet"> <link href="css/bootstrap.css" rel="stylesheet">
<!-- Flags --> <!-- Flags -->
<link href="css/flag-icon.min.css" rel="stylesheet"> <link href="css/flag-icon.min.css" rel="stylesheet">
@ -280,6 +284,9 @@
<li> <li>
<a class="inactive" href="#"><i class="fa fa-cog fa-fw"></i><span lang="en" data-lang-token="main_menu_configuration_token">Configuration</span><span class="fa arrow"></span></a> <a class="inactive" href="#"><i class="fa fa-cog fa-fw"></i><span lang="en" data-lang-token="main_menu_configuration_token">Configuration</span><span class="fa arrow"></span></a>
<ul class="nav nav-second-level"> <ul class="nav nav-second-level">
<li>
<a class="inactive" href="#" id="load_confGeneral"><i class="fa fa-play-circle-o fa-fw"></i><span lang="en" data-lang-token="main_menu_general_conf_token">General</span></a>
</li>
<li> <li>
<a class="inactive" href="#" id="load_confKodi"><i class="fa fa-play-circle-o fa-fw"></i><span lang="en" data-lang-token="main_menu_kodiwatch_token">Kodi Watch</span></a> <a class="inactive" href="#" id="load_confKodi"><i class="fa fa-play-circle-o fa-fw"></i><span lang="en" data-lang-token="main_menu_kodiwatch_token">Kodi Watch</span></a>
</li> </li>
@ -425,6 +432,10 @@
$("#load_confKodi").on("click", function() { $("#load_confKodi").on("click", function() {
$("#page-wrapper").load("kodiconf.html"); $("#page-wrapper").load("kodiconf.html");
}); });
$("#load_confGeneral").on("click", function() {
$("#page-wrapper").load("generalconf.html");
});
}); });
$(function(){ $(function(){
var sidebar = $('#side-menu'); // cache sidebar to a variable for performance var sidebar = $('#side-menu'); // cache sidebar to a variable for performance

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
"general_country_nl" : "Niederlande", "general_country_nl" : "Niederlande",
"general_speech_de" : "Deutsch", "general_speech_de" : "Deutsch",
"general_speech_en" : "Englisch", "general_speech_en" : "Englisch",
"dashboard_label_intro" : "Das Dashboard zeigt dir Informationen zum Systemstatus, ob Updates verfügbar sind, den Komponenten Status sowie die letzten Blog-Posts vom Hyperion Team", "dashboard_label_intro" : "Das Dashboard zeigt dir Informationen zum Systemstatus, ob Updates verfügbar sind, den Komponentenstatus sowie die letzten Blog-Posts vom Hyperion Team.",
"dashboard_label_infobox_title" : "Informationen", "dashboard_label_infobox_title" : "Informationen",
"dashboard_label_infobox_currenthyp" : "Deine Hyperion Version:", "dashboard_label_infobox_currenthyp" : "Deine Hyperion Version:",
"dashboard_label_infobox_latesthyp" : "Aktuellste Hyperion Version:", "dashboard_label_infobox_latesthyp" : "Aktuellste Hyperion Version:",
@ -56,7 +56,9 @@
"support_label_wikititle" : "Wiki", "support_label_wikititle" : "Wiki",
"support_label_wikitext" : "Von A bis Z - Alles wissenwerte zu Hyperion", "support_label_wikitext" : "Von A bis Z - Alles wissenwerte zu Hyperion",
"support_label_forumtitle" : "Forum", "support_label_forumtitle" : "Forum",
"support_label_forumtext" : "Diskussion und Hilfestellung von der Community" "support_label_forumtext" : "Diskussion und Hilfestellung von der Community",
"main_menu_general_conf_token":"Allgemein",
"remote_general_conf_intro":"Hier kannst du allgemeine Einstellungen von Hyperion vornehmen."
}, },
"regex": [ "regex": [
["^Something at start of text", ""], ["^Something at start of text", ""],

View File

@ -6,11 +6,13 @@
"logger" : "logger" :
{ {
"type" : "object", "type" : "object",
"title" : "Logging",
"properties" : "properties" :
{ {
"level" : "level" :
{ {
"enum" : ["silent", "warn", "verbose", "debug"] "enum" : ["silent", "warn", "verbose", "debug"],
"title" : "Log-Level"
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -700,12 +702,14 @@
{ {
"type" : "object", "type" : "object",
"required" : true, "required" : true,
"title" : "JSON Server",
"properties" : "properties" :
{ {
"port" : "port" :
{ {
"type" : "integer", "type" : "integer",
"required" : true, "required" : true,
"title" : "Port",
"minimum" : 0, "minimum" : 0,
"maximum" : 65535 "maximum" : 65535
} }
@ -716,12 +720,14 @@
{ {
"type" : "object", "type" : "object",
"required" : true, "required" : true,
"title" : "Proto Server",
"properties" : "properties" :
{ {
"port" : "port" :
{ {
"type" : "integer", "type" : "integer",
"required" : true, "required" : true,
"title" : "Port",
"minimum" : 0, "minimum" : 0,
"maximum" : 65535 "maximum" : 65535
} }
@ -731,22 +737,26 @@
"boblightServer" : "boblightServer" :
{ {
"type" : "object", "type" : "object",
"title" : "Boblight Server",
"properties" : "properties" :
{ {
"enable" : "enable" :
{ {
"type" : "boolean" "type" : "boolean",
"title" : "Activate"
}, },
"port" : "port" :
{ {
"type" : "integer", "type" : "integer",
"required" : true, "required" : true,
"title" : "Port",
"minimum" : 0, "minimum" : 0,
"maximum" : 65535 "maximum" : 65535
}, },
"priority" : "priority" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Priority"
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -754,34 +764,41 @@
"udpListener" : "udpListener" :
{ {
"type" : "object", "type" : "object",
"title" : "UDP Listener",
"properties" : "properties" :
{ {
"enable" : "enable" :
{ {
"type" : "boolean" "type" : "boolean",
"title" : "Activate"
}, },
"address" : "address" :
{ {
"type" : "string", "type" : "string",
"title" : "Address",
"required" : true "required" : true
}, },
"port" : "port" :
{ {
"type" : "integer", "type" : "integer",
"title" : "Port",
"minimum" : 0, "minimum" : 0,
"maximum" : 65535 "maximum" : 65535
}, },
"priority" : "priority" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Priority"
}, },
"timeout" : "timeout" :
{ {
"type" : "integer" "type" : "integer",
"title" : "Timeout"
}, },
"shared" : "shared" :
{ {
"type" : "boolean" "type" : "boolean",
"title" : "Shared"
} }
}, },
"additionalProperties" : false "additionalProperties" : false
@ -789,22 +806,26 @@
"webConfig" : "webConfig" :
{ {
"type" : "object", "type" : "object",
"title" : "WebUI - DANGER CHANGES CAN MAKE THE WEBUI UNREACHABLE!",
"required" : true, "required" : true,
"properties" : "properties" :
{ {
"enable" : "enable" :
{ {
"type" : "boolean", "type" : "boolean",
"title" : "Activate",
"required" : true "required" : true
}, },
"document_root" : "document_root" :
{ {
"type" : "string", "type" : "string",
"title" : "Document Root",
"required" : true "required" : true
}, },
"port" : "port" :
{ {
"type" : "integer", "type" : "integer",
"description" : "Port",
"required" : true "required" : true
} }
}, },