mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
refactoring of webui and event based websocket layer (#219)
* make hyperion websocket api event based * implement new websocket handling for generalconf * migrate all webui stuff to new event based websocket api some cleanup ... now all html templates are in content refactoring of web stuff * add hyperionport to global start impl. removing advanced key * separate dashboard serverinfo is updated every 3 seconds automatily add input selection cleanup and remove not needed stuff * prepare infrastructure for server sided file execution * webui minor fixes * fix compile
This commit is contained in:
106
assets/webconfig/content/generalconf.html
Normal file
106
assets/webconfig/content/generalconf.html
Normal file
@@ -0,0 +1,106 @@
|
||||
<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>
|
||||
function removeAdvanced(obj,searchStack = [])
|
||||
{
|
||||
$.each(obj, function(key, val) {
|
||||
if ( typeof(val) == 'object' )
|
||||
{
|
||||
searchStack.push(key);
|
||||
if (! removeAdvanced(val,searchStack) )
|
||||
searchStack.pop();
|
||||
}
|
||||
else if ( key == "advanced" && val == true )
|
||||
{
|
||||
console.log(searchStack);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
return false;
|
||||
}
|
||||
|
||||
$(hyperion).on("cmd-config-getschema", function(event) {
|
||||
parsedConfSchemaJSON = event.response.result;
|
||||
|
||||
// remove all "advanced" options from schema
|
||||
//removeAdvanced(parsedConfSchemaJSON); // not working atm
|
||||
//console.log(JSON.stringify(parsedConfSchemaJSON));
|
||||
|
||||
schema_smoothing = parsedConfSchemaJSON.properties.smoothing;
|
||||
schema_kodiVideoChecker = parsedConfSchemaJSON.properties.kodiVideoChecker;
|
||||
schema_initialEffect = parsedConfSchemaJSON.properties.initialEffect;
|
||||
//schema_grabber-v4l2 = parsedConfSchemaJSON.properties.grabber-v4l2;
|
||||
schema_framegrabber = parsedConfSchemaJSON.properties.framegrabber;
|
||||
schema_forwarder = parsedConfSchemaJSON.properties.forwarder;
|
||||
schema_effects = parsedConfSchemaJSON.properties.effects;
|
||||
schema_device = parsedConfSchemaJSON.properties.device;
|
||||
schema_color = parsedConfSchemaJSON.properties.color;
|
||||
schema_blackborderdetector = parsedConfSchemaJSON.properties.blackborderdetector;
|
||||
schema_logger = parsedConfSchemaJSON.properties.logger;
|
||||
schema_jsonServer = parsedConfSchemaJSON.properties.jsonServer;
|
||||
schema_protoServer = parsedConfSchemaJSON.properties.protoServer;
|
||||
schema_boblightServer = parsedConfSchemaJSON.properties.boblightServer;
|
||||
schema_udpListener = parsedConfSchemaJSON.properties.udpListener;
|
||||
schema_webConfig = parsedConfSchemaJSON.properties.webConfig;
|
||||
|
||||
var element = document.getElementById('editor_holder');
|
||||
//JSONEditor.defaults.options.theme = 'bootstrap3';
|
||||
var general_conf_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: {
|
||||
schema_blackborderdetector,
|
||||
schema_color,
|
||||
schema_device,
|
||||
schema_effects,
|
||||
schema_forwarder,
|
||||
schema_framegrabber,
|
||||
//schema_grabber-v4l2,
|
||||
schema_initialEffect,
|
||||
schema_kodiVideoChecker,
|
||||
schema_smoothing,
|
||||
schema_logger,
|
||||
schema_jsonServer,
|
||||
schema_protoServer,
|
||||
schema_boblightServer,
|
||||
schema_udpListener,
|
||||
schema_webConfig
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$(document).ready( function() {
|
||||
requestServerConfigSchema();
|
||||
|
||||
document.getElementById('submit').addEventListener('click',function() {
|
||||
// Get the value from the editor
|
||||
console.log(general_conf_editor.getValue());
|
||||
});
|
||||
// $("[type='checkbox']").bootstrapSwitch();
|
||||
});
|
||||
|
||||
|
||||
</script>
|
Reference in New Issue
Block a user