mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Refactor LED-Device handling in UI and make element naming consistent
This commit is contained in:
parent
80d60c2406
commit
8d8ee8b3cd
@ -40,7 +40,7 @@
|
|||||||
<div class="bs-callout bs-callout-info" style="margin-top:0px"><h4 data-i18n="dashboard_infobox_label_title">Information</h4><span data-i18n="conf_leds_device_info_log"> In case your LEDs do not work, check here for errors: </span> <a onclick="SwitchToMenuItem('MenuItemLogging')" data-i18n="main_menu_logging_token" style="cursor:pointer"></a></div>
|
<div class="bs-callout bs-callout-info" style="margin-top:0px"><h4 data-i18n="dashboard_infobox_label_title">Information</h4><span data-i18n="conf_leds_device_info_log"> In case your LEDs do not work, check here for errors: </span> <a onclick="SwitchToMenuItem('MenuItemLogging')" data-i18n="main_menu_logging_token" style="cursor:pointer"></a></div>
|
||||||
</div>
|
</div>
|
||||||
<div class="panel-footer" style="text-align:right">
|
<div class="panel-footer" style="text-align:right">
|
||||||
<button id='btn_test_controller' class="btn btn-primary hidden" disabled data-toggle="tooltip" data-placement="top" title="Identify configured device by lighting it up">
|
<button id='btn_test_controller' class="btn btn-primary" disabled data-toggle="tooltip" data-placement="top" title="Identify configured device by lighting it up">
|
||||||
<i class="fa fa-fw fa-save"></i><span data-i18n="wiz_identify">Identify/Test</span>
|
<i class="fa fa-fw fa-save"></i><span data-i18n="wiz_identify">Identify/Test</span>
|
||||||
</button>
|
</button>
|
||||||
<button id='btn_submit_controller' class="btn btn-primary" data-toggle="tooltip" data-placement="top" title="Save the device's connectivity configuration">
|
<button id='btn_submit_controller' class="btn btn-primary" data-toggle="tooltip" data-placement="top" title="Save the device's connectivity configuration">
|
||||||
|
@ -564,13 +564,11 @@ $(document).ready(function () {
|
|||||||
// toggle live video
|
// toggle live video
|
||||||
$('#leds_prev_toggle_live_video').off().on("click", function () {
|
$('#leds_prev_toggle_live_video').off().on("click", function () {
|
||||||
setClassByBool('#leds_prev_toggle_live_video', window.imageStreamActive, "btn-success", "btn-danger");
|
setClassByBool('#leds_prev_toggle_live_video', window.imageStreamActive, "btn-success", "btn-danger");
|
||||||
if (window.imageStreamActive)
|
if (window.imageStreamActive) {
|
||||||
{
|
|
||||||
requestLedImageStop();
|
requestLedImageStop();
|
||||||
imageCanvasNodeCtx.clear();
|
imageCanvasNodeCtx.clear();
|
||||||
}
|
}
|
||||||
else
|
else {
|
||||||
{
|
|
||||||
requestLedImageStart();
|
requestLedImageStart();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -703,6 +701,8 @@ $(document).ready(function () {
|
|||||||
var hwLedCountDefault = 1;
|
var hwLedCountDefault = 1;
|
||||||
var colorOrderDefault = "rgb";
|
var colorOrderDefault = "rgb";
|
||||||
|
|
||||||
|
$('#btn_test_controller').hide();
|
||||||
|
|
||||||
switch (ledType) {
|
switch (ledType) {
|
||||||
case "cololight":
|
case "cololight":
|
||||||
case "wled":
|
case "wled":
|
||||||
@ -771,11 +771,38 @@ $(document).ready(function () {
|
|||||||
});
|
});
|
||||||
|
|
||||||
conf_editor.on('change', function () {
|
conf_editor.on('change', function () {
|
||||||
//Check, if device can be identified/tested and/or saved
|
// //Check, if device can be identified/tested and/or saved
|
||||||
var canIdentify = false;
|
var canIdentify = false;
|
||||||
var canSave = false;
|
var canSave = false;
|
||||||
|
|
||||||
switch (ledType) {
|
switch (ledType) {
|
||||||
|
|
||||||
|
case "atmoorb":
|
||||||
|
case "fadecandy":
|
||||||
|
case "tinkerforge":
|
||||||
|
case "tpm2net":
|
||||||
|
case "udpe131":
|
||||||
|
case "udpartnet":
|
||||||
|
case "udph801":
|
||||||
|
case "udpraw":
|
||||||
|
var host = conf_editor.getEditor("root.specificOptions.host").getValue();
|
||||||
|
if (host !== "") {
|
||||||
|
canSave = true;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case "philipshue":
|
||||||
|
var host = conf_editor.getEditor("root.specificOptions.host").getValue();
|
||||||
|
var username = conf_editor.getEditor("root.specificOptions.username").getValue();
|
||||||
|
if (host !== "" && username != "") {
|
||||||
|
var useEntertainmentAPI = conf_editor.getEditor("root.specificOptions.useEntertainmentAPI").getValue();
|
||||||
|
var clientkey = conf_editor.getEditor("root.specificOptions.clientkey").getValue();
|
||||||
|
if (!useEntertainmentAPI || clientkey !== "") {
|
||||||
|
canSave = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case "cololight":
|
case "cololight":
|
||||||
case "wled":
|
case "wled":
|
||||||
var hostList = conf_editor.getEditor("root.specificOptions.hostList").getValue();
|
var hostList = conf_editor.getEditor("root.specificOptions.hostList").getValue();
|
||||||
@ -799,50 +826,20 @@ $(document).ready(function () {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "adalight":
|
|
||||||
var output = conf_editor.getEditor("root.specificOptions.output").getValue();
|
|
||||||
if (output !== "NONE" && output !== "SELECT" && output !== "") {
|
|
||||||
canIdentify = true;
|
|
||||||
}
|
|
||||||
case "atmo":
|
|
||||||
case "dmx":
|
|
||||||
case "karate":
|
|
||||||
case "sedu":
|
|
||||||
case "tpm2":
|
|
||||||
case "apa102":
|
|
||||||
case "apa104":
|
|
||||||
case "ws2801":
|
|
||||||
case "lpd6803":
|
|
||||||
case "lpd8806":
|
|
||||||
case "p9813":
|
|
||||||
case "sk6812spi":
|
|
||||||
case "sk6822spi":
|
|
||||||
case "sk9822":
|
|
||||||
case "ws2812spi":
|
|
||||||
case "piblaster":
|
|
||||||
var output = conf_editor.getEditor("root.specificOptions.output").getValue();
|
|
||||||
if (output !== "NONE" && output !== "SELECT" && output !== "") {
|
|
||||||
canSave = true;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
default:
|
default:
|
||||||
canIdentify = false;
|
canIdentify = false;
|
||||||
canSave = true;
|
canSave = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!conf_editor.validate().length) {
|
if (!conf_editor.validate().length) {
|
||||||
|
|
||||||
if (canIdentify) {
|
if (canIdentify) {
|
||||||
$("#btn_test_controller").removeClass('hidden');
|
$("#btn_test_controller").show();
|
||||||
$('#btn_test_controller').attr('disabled', false);
|
$('#btn_test_controller').attr('disabled', false);
|
||||||
}
|
} else {
|
||||||
else {
|
$('#btn_test_controller').hide();
|
||||||
$('#btn_test_controller').attr('disabled', true);
|
$('#btn_test_controller').attr('disabled', true);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
var hardwareLedCount = conf_editor.getEditor("root.generalOptions.hardwareLedCount").getValue();
|
|
||||||
if (hardwareLedCount < 1) {
|
|
||||||
canSave = false;
|
canSave = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -854,7 +851,7 @@ $(document).ready(function () {
|
|||||||
else {
|
else {
|
||||||
$('#btn_submit_controller').attr('disabled', true);
|
$('#btn_submit_controller').attr('disabled', true);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
window.readOnlyMode ? $('#btn_cl_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
window.readOnlyMode ? $('#btn_cl_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||||
window.readOnlyMode ? $('#btn_ma_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
window.readOnlyMode ? $('#btn_ma_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||||
window.readOnlyMode ? $('#leds_custom_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
window.readOnlyMode ? $('#leds_custom_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||||
@ -890,9 +887,9 @@ $(document).ready(function () {
|
|||||||
conf_editor.getEditor(specOptPath + "host").setValue(val);
|
conf_editor.getEditor(specOptPath + "host").setValue(val);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
showAllDeviceInputOptions("hostList", showOptions);
|
showAllDeviceInputOptions("hostList", showOptions);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
conf_editor.watch('root.specificOptions.host', () => {
|
conf_editor.watch('root.specificOptions.host', () => {
|
||||||
@ -904,8 +901,10 @@ $(document).ready(function () {
|
|||||||
else {
|
else {
|
||||||
let params = {};
|
let params = {};
|
||||||
switch (ledType) {
|
switch (ledType) {
|
||||||
|
|
||||||
case "cololight":
|
case "cololight":
|
||||||
params = { host: host };
|
params = { host: host };
|
||||||
|
getProperties_device(ledType, host, params);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "nanoleaf":
|
case "nanoleaf":
|
||||||
@ -914,33 +913,70 @@ $(document).ready(function () {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
params = { host: host, token: token };
|
params = { host: host, token: token };
|
||||||
|
getProperties_device(ledType, host, params);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "wled":
|
case "wled":
|
||||||
params = { host: host, filter: "info" };
|
params = { host: host, filter: "info" };
|
||||||
|
getProperties_device(ledType, host, params);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
getProperties_device(ledType, host, params);
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
conf_editor.watch('root.specificOptions.output', () => {
|
conf_editor.watch('root.specificOptions.output', () => {
|
||||||
var output = conf_editor.getEditor("root.specificOptions.output").getValue();
|
var output = conf_editor.getEditor("root.specificOptions.output").getValue();
|
||||||
if (output === "NONE" || output === "SELECT" || output === "") {
|
if (output === "NONE" || output === "SELECT" || output === "") {
|
||||||
|
|
||||||
|
$('#btn_submit_controller').attr('disabled', true);
|
||||||
|
$('#btn_test_controller').attr('disabled', true);
|
||||||
|
$('#btn_test_controller').hide();
|
||||||
|
|
||||||
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(1);
|
conf_editor.getEditor("root.generalOptions.hardwareLedCount").setValue(1);
|
||||||
showAllDeviceInputOptions("output", false);
|
showAllDeviceInputOptions("output", false);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
showAllDeviceInputOptions("output", true);
|
showAllDeviceInputOptions("output", true);
|
||||||
let params = {};
|
let params = {};
|
||||||
|
var canIdentify = false;
|
||||||
switch (ledType) {
|
switch (ledType) {
|
||||||
|
case "adalight":
|
||||||
|
canIdentify = true;
|
||||||
|
break;
|
||||||
case "atmo":
|
case "atmo":
|
||||||
case "karate":
|
case "karate":
|
||||||
params = { serialPort: output };
|
params = { serialPort: output };
|
||||||
getProperties_device(ledType, output, params);
|
getProperties_device(ledType, output, params);
|
||||||
break;
|
break;
|
||||||
|
case "dmx":
|
||||||
|
case "sedu":
|
||||||
|
case "tpm2":
|
||||||
|
case "apa102":
|
||||||
|
case "apa104":
|
||||||
|
case "ws2801":
|
||||||
|
case "lpd6803":
|
||||||
|
case "lpd8806":
|
||||||
|
case "p9813":
|
||||||
|
case "sk6812spi":
|
||||||
|
case "sk6822spi":
|
||||||
|
case "sk9822":
|
||||||
|
case "ws2812spi":
|
||||||
|
case "piblaster":
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!conf_editor.validate().length) {
|
||||||
|
if (canIdentify) {
|
||||||
|
$("#btn_test_controller").show();
|
||||||
|
$('#btn_test_controller').attr('disabled', false);
|
||||||
|
} else {
|
||||||
|
$('#btn_test_controller').hide();
|
||||||
|
$('#btn_test_controller').attr('disabled', true);
|
||||||
|
}
|
||||||
|
if (!window.readOnlyMode) {
|
||||||
|
$('#btn_submit_controller').attr('disabled', false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -1233,6 +1269,8 @@ function saveLedConfig(genDefLayout = false) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//Rewrite whole LED & Layout configuration, in case changes were done accross tabs and no default layout
|
//Rewrite whole LED & Layout configuration, in case changes were done accross tabs and no default layout
|
||||||
if (genDefLayout !== true) {
|
if (genDefLayout !== true) {
|
||||||
result.ledConfig = getLedConfig();
|
result.ledConfig = getLedConfig();
|
||||||
@ -1439,6 +1477,9 @@ var updateSelectList = function (ledType, discoveryInfo) {
|
|||||||
};
|
};
|
||||||
|
|
||||||
async function discover_device(ledType, params) {
|
async function discover_device(ledType, params) {
|
||||||
|
|
||||||
|
$('#btn_submit_controller').attr('disabled', true);
|
||||||
|
|
||||||
const result = await requestLedDeviceDiscovery(ledType, params);
|
const result = await requestLedDeviceDiscovery(ledType, params);
|
||||||
|
|
||||||
var discoveryResult;
|
var discoveryResult;
|
||||||
@ -1479,6 +1520,7 @@ async function getProperties_device(ledType, key, params) {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$('#btn_submit_controller').attr('disabled', true);
|
$('#btn_submit_controller').attr('disabled', true);
|
||||||
|
$('#btn_test_controller').attr('disabled', true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -391,12 +391,30 @@ bool SettingsManager::handleConfigUpgrade(QJsonObject& config)
|
|||||||
Warning(_log, "Instance [%u]: HwLedCount/Layout mismatch! Setting Hardware LED count to number of LEDs configured via layout", _instance);
|
Warning(_log, "Instance [%u]: HwLedCount/Layout mismatch! Setting Hardware LED count to number of LEDs configured via layout", _instance);
|
||||||
hwLedcount = layoutLedCount;
|
hwLedcount = layoutLedCount;
|
||||||
newDeviceConfig["hardwareLedCount"] = hwLedcount;
|
newDeviceConfig["hardwareLedCount"] = hwLedcount;
|
||||||
|
|
||||||
config["device"] = newDeviceConfig;
|
|
||||||
migrated = true;
|
migrated = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (newDeviceConfig.contains("type"))
|
||||||
|
{
|
||||||
|
QString type = newDeviceConfig["type"].toString();
|
||||||
|
if (type == "atmoorb" || type == "fadecandy" || type == "philipshue" )
|
||||||
|
{
|
||||||
|
if (newDeviceConfig.contains("output"))
|
||||||
|
{
|
||||||
|
newDeviceConfig["host"] = newDeviceConfig["output"].toString();
|
||||||
|
newDeviceConfig.remove("output");
|
||||||
|
migrated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (migrated)
|
||||||
|
{
|
||||||
|
config["device"] = newDeviceConfig;
|
||||||
|
Debug(_log, "LED-Device records migrated");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.contains("grabberV4L2"))
|
if (config.contains("grabberV4L2"))
|
||||||
|
@ -147,7 +147,6 @@
|
|||||||
"ledBlacklist": {
|
"ledBlacklist": {
|
||||||
"type": "array",
|
"type": "array",
|
||||||
"title": "conf_leds_layout_blacklist_rules_title",
|
"title": "conf_leds_layout_blacklist_rules_title",
|
||||||
"minimum": 1,
|
|
||||||
"uniqueItems": true,
|
"uniqueItems": true,
|
||||||
"items": {
|
"items": {
|
||||||
"type": "object",
|
"type": "object",
|
||||||
|
@ -50,7 +50,7 @@ bool LedDeviceAtmoOrb::init(const QJsonObject &deviceConfig)
|
|||||||
if ( LedDevice::init(deviceConfig) )
|
if ( LedDevice::init(deviceConfig) )
|
||||||
{
|
{
|
||||||
|
|
||||||
_multicastGroup = deviceConfig["output"].toString(MULTICAST_GROUP_DEFAULT_ADDRESS);
|
_multicastGroup = deviceConfig["host"].toString(MULTICAST_GROUP_DEFAULT_ADDRESS);
|
||||||
_multiCastGroupPort = static_cast<quint16>(deviceConfig["port"].toInt(MULTICAST_GROUP_DEFAULT_PORT));
|
_multiCastGroupPort = static_cast<quint16>(deviceConfig["port"].toInt(MULTICAST_GROUP_DEFAULT_PORT));
|
||||||
_useOrbSmoothing = deviceConfig["useOrbSmoothing"].toBool(false);
|
_useOrbSmoothing = deviceConfig["useOrbSmoothing"].toBool(false);
|
||||||
_skipSmoothingDiff = deviceConfig["skipSmoothingDiff"].toInt(0);
|
_skipSmoothingDiff = deviceConfig["skipSmoothingDiff"].toInt(0);
|
||||||
|
@ -55,7 +55,7 @@ bool LedDeviceFadeCandy::init(const QJsonObject& deviceConfig)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_host = deviceConfig["output"].toString("127.0.0.1");
|
_host = deviceConfig["host"].toString("127.0.0.1");
|
||||||
_port = deviceConfig["port"].toInt(STREAM_DEFAULT_PORT);
|
_port = deviceConfig["port"].toInt(STREAM_DEFAULT_PORT);
|
||||||
|
|
||||||
//If host not configured the init fails
|
//If host not configured the init fails
|
||||||
|
@ -12,7 +12,7 @@ namespace {
|
|||||||
bool verbose = false;
|
bool verbose = false;
|
||||||
|
|
||||||
// Configuration settings
|
// Configuration settings
|
||||||
const char CONFIG_ADDRESS[] = "output";
|
const char CONFIG_ADDRESS[] = "host";
|
||||||
//const char CONFIG_PORT[] = "port";
|
//const char CONFIG_PORT[] = "port";
|
||||||
const char CONFIG_USERNAME[] = "username";
|
const char CONFIG_USERNAME[] = "username";
|
||||||
const char CONFIG_CLIENTKEY[] = "clientkey";
|
const char CONFIG_CLIENTKEY[] = "clientkey";
|
||||||
|
@ -16,11 +16,10 @@
|
|||||||
"access": "advanced",
|
"access": "advanced",
|
||||||
"propertyOrder": 2
|
"propertyOrder": 2
|
||||||
},
|
},
|
||||||
"output": {
|
"host": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"title": "edt_dev_spec_multicastGroup_title",
|
"title": "edt_dev_spec_multicastGroup_title",
|
||||||
"default": "239.255.255.250",
|
"default": "239.255.255.250",
|
||||||
"access": "expert",
|
|
||||||
"propertyOrder": 3
|
"propertyOrder": 3
|
||||||
},
|
},
|
||||||
"port": {
|
"port": {
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"type":"object",
|
"type":"object",
|
||||||
"required":true,
|
"required":true,
|
||||||
"properties": {
|
"properties": {
|
||||||
"output" : {
|
"host": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"title": "edt_dev_spec_targetIp_title",
|
"title": "edt_dev_spec_targetIp_title",
|
||||||
"default": "127.0.0.1",
|
"default": "127.0.0.1",
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
"type": "object",
|
"type": "object",
|
||||||
"required": true,
|
"required": true,
|
||||||
"properties": {
|
"properties": {
|
||||||
"output": {
|
"host": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"title": "edt_dev_spec_targetIp_title",
|
"title": "edt_dev_spec_targetIp_title",
|
||||||
"default": "",
|
"default": "",
|
||||||
|
Loading…
Reference in New Issue
Block a user