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> </div>
<hr> <hr>
<div class="col-lg-12"> <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> </div>
</div> </div>
@ -38,8 +40,35 @@
udpListener = JSON.parse(response.data).result.properties.udpListener; udpListener = JSON.parse(response.data).result.properties.udpListener;
webConfig = JSON.parse(response.data).result.properties.webConfig; 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: { schema: {
logger, logger,
jsonServer, jsonServer,
@ -57,7 +86,7 @@
console.log(values); console.log(values);
} }
} }
}); });*/

View File

@ -28,6 +28,9 @@
<script src="js/lib/underscore.js"></script> <script src="js/lib/underscore.js"></script>
<script src="js/lib/jsonform.js"></script> <script src="js/lib/jsonform.js"></script>
<script src="js/lib/jsoneditor.min.js"></script>
<!--Language Support --> <!--Language Support -->
<script src="js/lib/jquery-lang.js" charset="utf-8" type="text/javascript"></script> <script src="js/lib/jquery-lang.js" charset="utf-8" type="text/javascript"></script>
<script src="js/lib/js.cookie.js"></script> <script src="js/lib/js.cookie.js"></script>

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" : "level" :
{ {
"type" : "string",
"enum" : ["silent", "warn", "verbose", "debug"], "enum" : ["silent", "warn", "verbose", "debug"],
"title" : "Log-Level" "title" : "Log-Level"
} }