mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Threading and more
- webui remove restarts - threading for LedDevice
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
$(document).ready( function() {
|
||||
var uiLock = false;
|
||||
|
||||
loadContentTo("#container_connection_lost","connection_lost");
|
||||
loadContentTo("#container_restart","restart");
|
||||
@@ -7,42 +6,26 @@ $(document).ready( function() {
|
||||
|
||||
$(hyperion).on("cmd-serverinfo",function(event){
|
||||
serverInfo = event.response.info;
|
||||
// protect components from serverinfo updates
|
||||
if(!compsInited)
|
||||
{
|
||||
comps = event.response.info.components
|
||||
compsInited = true;
|
||||
}
|
||||
// comps
|
||||
comps = event.response.info.components
|
||||
|
||||
if(!priosInited)
|
||||
{
|
||||
priosInited = true;
|
||||
}
|
||||
$(hyperion).trigger("ready");
|
||||
|
||||
if (serverInfo.hyperion.config_modified)
|
||||
$("#hyperion_reload_notify").fadeIn("fast");
|
||||
else
|
||||
$("#hyperion_reload_notify").fadeOut("fast");
|
||||
comps.forEach( function(obj) {
|
||||
if (obj.name == "ALL")
|
||||
{
|
||||
if(obj.enabled)
|
||||
$("#hyperion_disabled_notify").fadeOut("fast");
|
||||
else
|
||||
$("#hyperion_disabled_notify").fadeIn("fast");
|
||||
}
|
||||
});
|
||||
|
||||
if (serverInfo.hyperion.enabled)
|
||||
$("#hyperion_disabled_notify").fadeOut("fast");
|
||||
else
|
||||
$("#hyperion_disabled_notify").fadeIn("fast");
|
||||
|
||||
if (!serverInfo.hyperion.config_writeable)
|
||||
{
|
||||
showInfoDialog('uilock',$.i18n('InfoDialog_nowrite_title'),$.i18n('InfoDialog_nowrite_text'));
|
||||
$('#wrapper').toggle(false);
|
||||
uiLock = true;
|
||||
}
|
||||
else if (uiLock)
|
||||
{
|
||||
$("#modal_dialog").modal('hide');
|
||||
$('#wrapper').toggle(true);
|
||||
uiLock = false;
|
||||
}
|
||||
|
||||
updateSessions();
|
||||
}); // end cmd-serverinfo
|
||||
|
||||
@@ -51,21 +34,21 @@ $(document).ready( function() {
|
||||
updateSessions();
|
||||
});
|
||||
|
||||
$(hyperion).one("cmd-sysinfo", function(event) {
|
||||
$(hyperion).on("cmd-sysinfo", function(event) {
|
||||
requestServerInfo();
|
||||
sysInfo = event.response.info;
|
||||
|
||||
currentVersion = sysInfo.hyperion.version;
|
||||
});
|
||||
|
||||
$(hyperion).one("cmd-config-getschema", function(event) {
|
||||
$(hyperion).on("cmd-config-getschema", function(event) {
|
||||
serverSchema = event.response.info;
|
||||
requestServerConfig();
|
||||
|
||||
schema = serverSchema.properties;
|
||||
});
|
||||
|
||||
$(hyperion).one("cmd-config-getconfig", function(event) {
|
||||
$(hyperion).on("cmd-config-getconfig", function(event) {
|
||||
serverConfig = event.response.info;
|
||||
requestSysInfo();
|
||||
|
||||
@@ -80,7 +63,7 @@ $(document).ready( function() {
|
||||
requestServerConfigSchema();
|
||||
});
|
||||
|
||||
$(hyperion).one("ready", function(event) {
|
||||
$(hyperion).on("ready", function(event) {
|
||||
loadContent();
|
||||
});
|
||||
|
||||
@@ -98,7 +81,7 @@ $(document).ready( function() {
|
||||
// notfication in index
|
||||
if (obj.name == "ALL")
|
||||
{
|
||||
if(obj.enable)
|
||||
if(obj.enabled)
|
||||
$("#hyperion_disabled_notify").fadeOut("fast");
|
||||
else
|
||||
$("#hyperion_disabled_notify").fadeIn("fast");
|
||||
@@ -117,10 +100,6 @@ $(document).ready( function() {
|
||||
serverInfo.effects = event.response.data.effects
|
||||
});
|
||||
|
||||
$("#btn_hyperion_reload").on("click", function(){
|
||||
initRestart();
|
||||
});
|
||||
|
||||
$(".mnava").bind('click.menu', function(e){
|
||||
loadContent(e);
|
||||
window.scrollTo(0, 0);
|
||||
|
@@ -203,6 +203,14 @@ $(document).ready(function() {
|
||||
function updateComponents()
|
||||
{
|
||||
components = comps;
|
||||
var hyperionEnabled = true;
|
||||
components.forEach( function(obj) {
|
||||
if (obj.name == "ALL")
|
||||
{
|
||||
hyperionEnabled = obj.enabled
|
||||
}
|
||||
});
|
||||
|
||||
// create buttons
|
||||
$('#componentsbutton').html("");
|
||||
for ( idx=0; idx<components.length;idx++)
|
||||
@@ -214,7 +222,7 @@ $(document).ready(function() {
|
||||
enable_icon = (components[idx].enabled? "fa-play" : "fa-stop");
|
||||
comp_name = components[idx].name;
|
||||
comp_btn_id = "comp_btn_"+comp_name;
|
||||
comp_goff = serverInfo.hyperion.enabled? "enabled" : "disabled";
|
||||
comp_goff = hyperionEnabled? "enabled" : "disabled";
|
||||
|
||||
// create btn if not there
|
||||
if ($("#"+comp_btn_id).length == 0)
|
||||
|
@@ -25,14 +25,8 @@ var wSess = [];
|
||||
var plugins_installed = {};
|
||||
var plugins_available = {};
|
||||
|
||||
//comps serverinfo lock
|
||||
//comps serverinfo
|
||||
comps = [];
|
||||
compsInited = false;
|
||||
|
||||
// prios serverinfo lock
|
||||
priosInited = false;
|
||||
// token list
|
||||
tokenList = {}
|
||||
|
||||
function initRestart()
|
||||
{
|
||||
|
@@ -91,7 +91,7 @@ function getHashtag()
|
||||
}
|
||||
}
|
||||
|
||||
function loadContent(event)
|
||||
function loadContent(event, forceRefresh)
|
||||
{
|
||||
var tag;
|
||||
|
||||
@@ -104,7 +104,7 @@ function loadContent(event)
|
||||
else
|
||||
tag = getHashtag();
|
||||
|
||||
if(prevTag != tag)
|
||||
if(forceRefresh || prevTag != tag)
|
||||
{
|
||||
prevTag = tag;
|
||||
$("#page-content").off();
|
||||
|
@@ -58,7 +58,7 @@
|
||||
$('#wizp2_body').append('<div class="form-group"><label>'+$.i18n('wiz_rgb_switchevery')+'</label><div class="input-group" style="width:100px"><select id="wiz_switchtime_select" class="form-control"></select><div class="input-group-addon">'+$.i18n('edt_append_s')+'</div></div></div>');
|
||||
$('#wizp2_body').append('<canvas id="wiz_canv_color" width="100" height="100" style="border-radius:60px;background-color:red; display:block; margin: 10px 0;border:4px solid grey;"></canvas><label>'+$.i18n('wiz_rgb_q')+'</label>');
|
||||
$('#wizp2_body').append('<table class="table borderless" style="width:200px"><tbody><tr><td class="ltd"><label>'+$.i18n('wiz_rgb_qrend')+'</label></td><td class="itd"><select id="wiz_r_select" class="form-control wselect"></select></td></tr><tr><td class="ltd"><label>'+$.i18n('wiz_rgb_qgend')+'</label></td><td class="itd"><select id="wiz_g_select" class="form-control wselect"></select></td></tr></tbody></table>');
|
||||
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_save"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_saverestart')+'</button><button type="button" class="btn btn-primary" id="btn_wiz_checkok" style="display:none" data-dismiss="modal"><i class="fa fa-fw fa-check"></i>'+$.i18n('general_btn_ok')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>')
|
||||
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_save"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_save')+'</button><button type="button" class="btn btn-primary" id="btn_wiz_checkok" style="display:none" data-dismiss="modal"><i class="fa fa-fw fa-check"></i>'+$.i18n('general_btn_ok')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>')
|
||||
|
||||
//open modal
|
||||
$("#wizard_modal").modal({
|
||||
@@ -155,7 +155,6 @@
|
||||
resetWizard();
|
||||
serverConfig.device.colorOrder = new_rgb_order;
|
||||
requestWriteConfig({"device" : serverConfig.device});
|
||||
setTimeout(initRestart, 100);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -416,7 +415,7 @@
|
||||
$('#wizp1_body').html('<h4 style="font-weight:bold;text-transform:uppercase;">'+$.i18n('wiz_cc_title')+'</h4><p>'+$.i18n('wiz_cc_intro1')+'</p><label>'+$.i18n('wiz_cc_kwebs')+'</label><input class="form-control" style="width:170px;margin:auto" id="wiz_cc_kodiip" type="text" placeholder="'+kodiAddress+'" value="'+kodiAddress+'" /><span id="kodi_status"></span><span id="multi_cali"></span>');
|
||||
$('#wizp1_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_cont" disabled="disabled"><i class="fa fa-fw fa-check"></i>'+$.i18n('general_btn_continue')+'</button><button type="button" class="btn btn-danger" data-dismiss="modal"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
|
||||
$('#wizp2_body').html('<div id="wiz_cc_desc" style="font-weight:bold"></div><div id="editor_container_wiz"></div>');
|
||||
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_back"><i class="fa fa-fw fa-chevron-left"></i>'+$.i18n('general_btn_back')+'</button><button type="button" class="btn btn-primary" id="btn_wiz_next">'+$.i18n('general_btn_next')+'<i style="margin-left:4px;"class="fa fa-fw fa-chevron-right"></i></button><button type="button" class="btn btn-warning" id="btn_wiz_save" style="display:none"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_saverestart')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>')
|
||||
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_back"><i class="fa fa-fw fa-chevron-left"></i>'+$.i18n('general_btn_back')+'</button><button type="button" class="btn btn-primary" id="btn_wiz_next">'+$.i18n('general_btn_next')+'<i style="margin-left:4px;"class="fa fa-fw fa-chevron-right"></i></button><button type="button" class="btn btn-warning" id="btn_wiz_save" style="display:none"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_save')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>')
|
||||
|
||||
//open modal
|
||||
$("#wizard_modal").modal({
|
||||
@@ -500,7 +499,6 @@
|
||||
$('#btn_wiz_save').off().on('click',function() {
|
||||
requestWriteConfig(wiz_editor.getValue());
|
||||
resetWizard();
|
||||
setTimeout(initRestart, 200);
|
||||
});
|
||||
|
||||
wiz_editor.on("change", function(e){
|
||||
@@ -538,7 +536,7 @@
|
||||
$('#wizp2_body').append('<div id="hue_ids_t" style="display:none"><p style="font-weight:bold">'+$.i18n('wiz_hue_desc2')+'</p></div>');
|
||||
createTable("lidsh", "lidsb", "hue_ids_t");
|
||||
$('.lidsh').append(createTableRow([$.i18n('edt_dev_spec_lightid_title'),$.i18n('wiz_hue_pos'),$.i18n('wiz_hue_ident')], true));
|
||||
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_save" style="display:none"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_saverestart')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
|
||||
$('#wizp2_footer').html('<button type="button" class="btn btn-primary" id="btn_wiz_save" style="display:none"><i class="fa fa-fw fa-save"></i>'+$.i18n('general_btn_save')+'</button><button type="button" class="btn btn-danger" id="btn_wiz_abort"><i class="fa fa-fw fa-close"></i>'+$.i18n('general_btn_cancel')+'</button>');
|
||||
$('#wizp3_body').html('<span>'+$.i18n('wiz_hue_press_link')+'</span> <br /><br /><center><span id="connectionTime"></span><br /><i class="fa fa-cog fa-spin" style="font-size:100px"></i></center>');
|
||||
|
||||
//open modal
|
||||
@@ -751,7 +749,7 @@
|
||||
serverConfig.smoothing.enable = false;
|
||||
|
||||
requestWriteConfig(serverConfig, true);
|
||||
setTimeout(initRestart,200);
|
||||
resetWizard();
|
||||
});
|
||||
|
||||
$('#btn_wiz_abort').off().on('click', resetWizard);
|
||||
|
Reference in New Issue
Block a user