mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Effects Configurator (#281)
* update translation * add css * Update JsonClientConnection.cpp * add effectscreator * remove udp * fix title c/p issue for sparks [skip ci] * update schemas [skip ci] * typo [skpi ci]
This commit is contained in:
53
assets/webconfig/js/content_effectsconfigurator.js
Normal file
53
assets/webconfig/js/content_effectsconfigurator.js
Normal file
@@ -0,0 +1,53 @@
|
||||
$(hyperion).one("cmd-config-getschema", function(event) {
|
||||
effects = parsedConfSchemaJSON.properties.effectSchemas.internal
|
||||
EffectsHtml = "";
|
||||
for(var idx=0; idx<effects.length; idx++)
|
||||
{
|
||||
EffectsHtml += '<option value="'+effects[idx].schemaContent.script+'">'+effects[idx].schemaContent.title+'</option>';
|
||||
}
|
||||
$("#effectslist").html(EffectsHtml);
|
||||
$("#effectslist").trigger("change");
|
||||
});
|
||||
|
||||
effects_editor = null;
|
||||
effectPy = "";
|
||||
|
||||
$("#effectslist").off().on("change", function(event) {
|
||||
for(var idx=0; idx<effects.length; idx++){
|
||||
if (effects[idx].schemaContent.script == this.value){
|
||||
effects_editor = createJsonEditor('editor_container', {
|
||||
args : effects[idx].schemaContent,
|
||||
},false);
|
||||
effectPy = ':';
|
||||
effectPy += effects[idx].schemaContent.script;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$('#btn_write').off().on('click',function() {
|
||||
|
||||
effectName = $('#name-input').val();
|
||||
if (effectName == "")
|
||||
{
|
||||
showInfoDialog('error','INVALID NAME FIELD','Effect name is empty! Please fill in a name and try again.')
|
||||
}
|
||||
else
|
||||
{
|
||||
var errors = effects_editor.validate();
|
||||
if(errors.length)
|
||||
{
|
||||
showInfoDialog('error','INVALID VALUES','Please check for red marked inputs and try again.')
|
||||
}
|
||||
else
|
||||
{
|
||||
requestWriteEffect(effectName,effectPy,JSON.stringify(effects_editor.getValue()));
|
||||
showInfoDialog('success','SUCCESS!','Your effect has been created successfully!')
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
$(document).ready( function() {
|
||||
requestServerConfigSchema();
|
||||
});
|
@@ -14,6 +14,7 @@ $(document).ready( function() {
|
||||
bindNavToContent("#load_confGrabber","grabber",false);
|
||||
bindNavToContent("#load_confColors","colors",false);
|
||||
bindNavToContent("#load_confNetwork","network",false);
|
||||
bindNavToContent("#load_effectsconfig","effects_configurator",false);
|
||||
|
||||
|
||||
//Change all Checkboxes to Switches
|
||||
|
@@ -203,3 +203,9 @@ function requestWriteConfig(config)
|
||||
});
|
||||
websocket.send('{"command":"config","subcommand":"setconfig", "tan":'+wsTan+', "config":'+JSON.stringify(complete_config)+'}');
|
||||
}
|
||||
|
||||
function requestWriteEffect(effectName,effectPy,effectArgs)
|
||||
{
|
||||
var cutArgs = effectArgs.slice(1, -1);
|
||||
websocket.send('{"command":"create-effect","name":"'+effectName+'", "script":"'+effectPy+'", '+cutArgs+'}');
|
||||
}
|
@@ -95,6 +95,7 @@ function createJsonEditor(container,schema,setconfig)
|
||||
form_name_root: 'sa',
|
||||
disable_edit_json: 'true',
|
||||
disable_properties: 'true',
|
||||
disable_array_reorder: 'true',
|
||||
no_additional_properties: 'true',
|
||||
schema: {
|
||||
title:'',
|
||||
|
Reference in New Issue
Block a user