hyperion.ng/assets/webconfig/generalconf.html
2016-08-31 00:46:39 +02:00

83 lines
2.2 KiB
HTML

<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 id="generalConfForm"></form>
<div id='editor_holder'></div>
<button id='submit'>Submit (console.log)</button>
</div>
</div>
</div>
</div>
<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;
var element = document.getElementById('editor_holder');
//JSONEditor.defaults.options.theme = 'bootstrap3';
var editor = new JSONEditor(element,{
theme: 'bootstrap3',
disable_collapse: 'true',
form_name_root: 'sa',
disable_edit_json: 'true',
disable_properties: 'true',
no_additional_properties: 'true',
schema: {
title:' ',
properties: {
logger,
jsonServer,
protoServer,
boblightServer,
udpListener,
webConfig
}
}
});
document.getElementById('submit').addEventListener('click',function() {
// Get the value from the editor
console.log(editor.getValue());
});
$("[type='checkbox']").bootstrapSwitch();
}
});
</script>