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:
brindosch
2016-10-30 17:54:38 +01:00
committed by GitHub
parent 33c91f73e3
commit 864538f188
20 changed files with 135 additions and 133 deletions

View 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();
});

View File

@@ -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

View File

@@ -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+'}');
}

View File

@@ -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:'',