New JSON Editor

This commit is contained in:
b1rdhous3 2016-08-30 23:49:21 +02:00
parent 4f5892bb72
commit 7009aa50ed
5 changed files with 902 additions and 9 deletions

View File

@ -7,7 +7,9 @@
</div>
<hr>
<div class="col-lg-12">
<form id="generalConfForm"></form>
<!--<form id="generalConfForm"></form>-->
<div id='editor_holder'></div>
<button id='submit'>Submit (console.log)</button>
</div>
</div>
</div>
@ -38,8 +40,35 @@
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
}
}
});
$('form').jsonForm({
document.getElementById('submit').addEventListener('click',function() {
// Get the value from the editor
console.log(editor.getValue());
});
/*$('form').jsonForm({
schema: {
logger,
jsonServer,
@ -57,7 +86,7 @@
console.log(values);
}
}
});
});*/

View File

@ -28,6 +28,9 @@
<script src="js/lib/underscore.js"></script>
<script src="js/lib/jsonform.js"></script>
<script src="js/lib/jsoneditor.min.js"></script>
<!--Language Support -->
<script src="js/lib/jquery-lang.js" charset="utf-8" type="text/javascript"></script>
<script src="js/lib/js.cookie.js"></script>
@ -451,7 +454,7 @@
$("#load_effects").on("click", function() {
$("#page-wrapper").load("effects.html");
});
$("#load_components").on("click", function() {
$("#page-wrapper").load("remote_components.html");
});
@ -484,7 +487,7 @@
var cleanCurrentVersion;
var latestVersion;
var cleanLatestVersion;
webSocket = new WebSocket('ws://'+document.location.hostname+':19444');
var serverInfo;
@ -501,12 +504,12 @@
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);
@ -517,9 +520,9 @@
$('#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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -11,6 +11,7 @@
{
"level" :
{
"type" : "string",
"enum" : ["silent", "warn", "verbose", "debug"],
"title" : "Log-Level"
}