mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Initial Write Config Support (#230)
* Initial JSON Write * Initial Write Config Support * .
This commit is contained in:
parent
0e941795d5
commit
4649786f68
@ -25,23 +25,23 @@ $(hyperion).one("cmd-config-getschema", function(event) {
|
|||||||
//removeAdvanced(parsedConfSchemaJSON, []); // not working atm
|
//removeAdvanced(parsedConfSchemaJSON, []); // not working atm
|
||||||
//console.log(JSON.stringify(parsedConfSchemaJSON));
|
//console.log(JSON.stringify(parsedConfSchemaJSON));
|
||||||
schema = parsedConfSchemaJSON.properties;
|
schema = parsedConfSchemaJSON.properties;
|
||||||
schema_blackborderdetector = schema.blackborderdetector;
|
blackborderdetector = schema.blackborderdetector;
|
||||||
schema_color = schema.color;
|
color = schema.color;
|
||||||
schema_effects = schema.effects;
|
effects = schema.effects;
|
||||||
schema_forwarder = schema.forwarder;
|
forwarder = schema.forwarder;
|
||||||
schema_initialEffect = schema.initialEffect;
|
initialEffect = schema.initialEffect;
|
||||||
schema_kodiVideoChecker = schema.kodiVideoChecker;
|
kodiVideoChecker = schema.kodiVideoChecker;
|
||||||
schema_smoothing = schema.smoothing;
|
smoothing = schema.smoothing;
|
||||||
schema_logger = schema.logger;
|
logger = schema.logger;
|
||||||
schema_jsonServer = schema.jsonServer;
|
jsonServer = schema.jsonServer;
|
||||||
schema_protoServer = schema.protoServer;
|
protoServer = schema.protoServer;
|
||||||
schema_boblightServer = schema.boblightServer;
|
boblightServer = schema.boblightServer;
|
||||||
schema_udpListener = schema.udpListener;
|
udpListener = schema.udpListener;
|
||||||
schema_webConfig = schema.webConfig;
|
webConfig = schema.webConfig;
|
||||||
|
|
||||||
var element = document.getElementById('editor_holder');
|
var element = document.getElementById('editor_holder');
|
||||||
//JSONEditor.defaults.options.theme = 'bootstrap3';
|
//JSONEditor.defaults.options.theme = 'bootstrap3';
|
||||||
|
|
||||||
var general_conf_editor = new JSONEditor(element,{
|
var general_conf_editor = new JSONEditor(element,{
|
||||||
theme: 'bootstrap3',
|
theme: 'bootstrap3',
|
||||||
disable_collapse: 'true',
|
disable_collapse: 'true',
|
||||||
@ -52,32 +52,42 @@ $(hyperion).one("cmd-config-getschema", function(event) {
|
|||||||
schema: {
|
schema: {
|
||||||
title:' ',
|
title:' ',
|
||||||
properties: {
|
properties: {
|
||||||
schema_blackborderdetector,
|
/*blackborderdetector,
|
||||||
schema_color,
|
color,
|
||||||
schema_effects,
|
effects,
|
||||||
schema_forwarder,
|
forwarder,
|
||||||
schema_initialEffect,
|
initialEffect,
|
||||||
schema_kodiVideoChecker,
|
kodiVideoChecker,
|
||||||
schema_smoothing,
|
smoothing,*/
|
||||||
schema_logger,
|
logger//,
|
||||||
schema_jsonServer,
|
/*jsonServer,
|
||||||
schema_protoServer,
|
protoServer,
|
||||||
schema_boblightServer,
|
boblightServer,
|
||||||
schema_udpListener,
|
udpListener,
|
||||||
schema_webConfig
|
webConfig*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
|
||||||
|
|
||||||
|
//Called everytime a Input Field is changed = No need for save button
|
||||||
|
general_conf_editor.on('change',function() {
|
||||||
|
console.log(JSON.stringify(general_conf_editor.getValue()));
|
||||||
|
requestWriteConfig(general_conf_editor.getValue());
|
||||||
|
});
|
||||||
|
|
||||||
|
//Alternative Function with submit button to get Values
|
||||||
|
document.getElementById('submit').addEventListener('click',function() {
|
||||||
|
console.log(general_conf_editor.getValue());
|
||||||
|
});
|
||||||
|
|
||||||
|
$(hyperion).on("cmd-config-setconfig",function(event){
|
||||||
|
parsedServerInfoJSON = event.response;
|
||||||
|
console.log(parsedServerInfoJSON);
|
||||||
|
});
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
$(document).ready( function() {
|
$(document).ready( function() {
|
||||||
requestServerConfigSchema();
|
requestServerConfigSchema();
|
||||||
|
//$("[type='checkbox']").bootstrapSwitch();
|
||||||
document.getElementById('submit').addEventListener('click',function() {
|
|
||||||
// Get the value from the editor
|
|
||||||
//console.log(general_conf_editor.getValue());
|
|
||||||
});
|
|
||||||
// $("[type='checkbox']").bootstrapSwitch();
|
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ var cronId = 0;
|
|||||||
var ledStreamActive=false;
|
var ledStreamActive=false;
|
||||||
var watchdog = 0;
|
var watchdog = 0;
|
||||||
|
|
||||||
//
|
//
|
||||||
function cron()
|
function cron()
|
||||||
{
|
{
|
||||||
if ( watchdog > 3)
|
if ( watchdog > 3)
|
||||||
@ -67,7 +67,7 @@ function initWebSocket()
|
|||||||
|
|
||||||
websocket.onopen = function (event) {
|
websocket.onopen = function (event) {
|
||||||
$(hyperion).trigger({type:"open"});
|
$(hyperion).trigger({type:"open"});
|
||||||
|
|
||||||
$(hyperion).on("cmd-serverinfo", function(event) {
|
$(hyperion).on("cmd-serverinfo", function(event) {
|
||||||
watchdog = 0;
|
watchdog = 0;
|
||||||
});
|
});
|
||||||
@ -183,7 +183,7 @@ function requestSetComponentState(comp, state){
|
|||||||
console.log(comp+' state: '+state_str);
|
console.log(comp+' state: '+state_str);
|
||||||
}
|
}
|
||||||
|
|
||||||
function requestSetSource( prio )
|
function requestSetSource(prio)
|
||||||
{
|
{
|
||||||
if ( prio == "auto" )
|
if ( prio == "auto" )
|
||||||
websocket.send('{"command":"sourceselect", "tan":'+wsTan+', "auto" : true}');
|
websocket.send('{"command":"sourceselect", "tan":'+wsTan+', "auto" : true}');
|
||||||
@ -191,3 +191,9 @@ function requestSetSource( prio )
|
|||||||
websocket.send('{"command":"sourceselect", "tan":'+wsTan+', "priority" : '+prio+'}');
|
websocket.send('{"command":"sourceselect", "tan":'+wsTan+', "priority" : '+prio+'}');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function requestWriteConfig(config, create, overwrite)
|
||||||
|
{
|
||||||
|
var create = (typeof create !== 'undefined') ? create : false;
|
||||||
|
var overwrite = (typeof overwrite !== 'undefined') ? overwrite : false;
|
||||||
|
websocket.send('{"command":"config","subcommand":"setconfig", "tan":'+wsTan+', "config":'+JSON.stringify(config)+',"create":'+create+', "overwrite":'+overwrite+'}');
|
||||||
|
}
|
||||||
|
@ -31,20 +31,21 @@
|
|||||||
"main_menu_update_token" : "Update",
|
"main_menu_update_token" : "Update",
|
||||||
"main_menu_system_token" : "System",
|
"main_menu_system_token" : "System",
|
||||||
"main_menu_input_selection_token" : "Eingabeauswahl",
|
"main_menu_input_selection_token" : "Eingabeauswahl",
|
||||||
"main_menu_general_conf_token":"Allgemein",
|
"main_menu_general_conf_token" : "Allgemein",
|
||||||
"main_menu_leds_conf_token":"LEDs",
|
"main_menu_leds_conf_token" : "LEDs",
|
||||||
"remote_colors_label_color":"Farbe: ",
|
"main_menu_grabber_conf_token" : "Aufnahme Hardware",
|
||||||
"remote_colors_button_reset":"Farbe zurücksetzen",
|
"remote_colors_label_color" : "Farbe: ",
|
||||||
|
"remote_colors_button_reset" : "Farbe zurücksetzen",
|
||||||
"remote_effects_intro" : "Die Effekt-Fernbedienung ermöglicht es dir Effekte zu starten für Demonstrations- oder Testzwecke. Vergessse nicht den Effekt wieder zu stoppen, wenn du fertig bist.",
|
"remote_effects_intro" : "Die Effekt-Fernbedienung ermöglicht es dir Effekte zu starten für Demonstrations- oder Testzwecke. Vergessse nicht den Effekt wieder zu stoppen, wenn du fertig bist.",
|
||||||
"remote_effects_label_effects":"Effekte",
|
"remote_effects_label_effects" : "Effekte",
|
||||||
"remote_effects_label_stopeffect":"Stoppe Effekte",
|
"remote_effects_label_stopeffect" : "Stoppe Effekte",
|
||||||
"remote_components_intro" : "Die Komponenten-Fenbedienung ermöglicht es dir Komponenten von Hyperion zu starten und stoppen. Beachte: Dies ist nur temporär und geht nach einem Neustart verloren. Möchtest du dauerhaft Komponenten aktivieren/deaktivieren benutze die Konfigurationsseiten.",
|
"remote_components_intro" : "Die Komponenten-Fenbedienung ermöglicht es dir Komponenten von Hyperion zu starten und stoppen. Beachte: Dies ist nur temporär und geht nach einem Neustart verloren. Möchtest du dauerhaft Komponenten aktivieren/deaktivieren benutze die Konfigurationsseiten.",
|
||||||
"hue_button_create_user_token":"Benutzer anlegen",
|
"hue_button_create_user_token" : "Benutzer anlegen",
|
||||||
"hue_press_link_modal":"Bitte Link Taste auf der Hue Bridge drücken.",
|
"hue_press_link_modal" : "Bitte Link Taste auf der Hue Bridge drücken.",
|
||||||
"hue_failure_connection_token":"Connection Timeout. Bitte drücke die Taste rechtzeitig.",
|
"hue_failure_connection_token" : "Connection Timeout. Bitte drücke die Taste rechtzeitig.",
|
||||||
"hue_button_pair":"Verbinden",
|
"hue_button_pair" : "Verbinden",
|
||||||
"hue_failure_ip_token":"Bitte überprüfe deine IP Adresse.",
|
"hue_failure_ip_token" : "Bitte überprüfe deine IP Adresse.",
|
||||||
"hue_label_username":"Benutzername:",
|
"hue_label_username" : "Benutzername:",
|
||||||
"conf_kodi_label_title" : "Kodi Überwachung",
|
"conf_kodi_label_title" : "Kodi Überwachung",
|
||||||
"conf_kodi_label_intro" : "Die Kodi Überwachung ermöglicht es dir abhängig von dem Kodi Status dein ambient light an oder abzuschalten. Dies ist nicht limitiert auf das selbe Gerät. Du kannst jedes Kodi in deinem lokalen Netzwerk überwachen lassen.",
|
"conf_kodi_label_intro" : "Die Kodi Überwachung ermöglicht es dir abhängig von dem Kodi Status dein ambient light an oder abzuschalten. Dies ist nicht limitiert auf das selbe Gerät. Du kannst jedes Kodi in deinem lokalen Netzwerk überwachen lassen.",
|
||||||
"support_label_title" : "Unterstütze Hyperion",
|
"support_label_title" : "Unterstütze Hyperion",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user