mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2025-03-01 10:33:28 +00:00
Read-Only Configuration-Database support (#1046)
This commit is contained in:
@@ -43,6 +43,8 @@
|
||||
info += '- UI Access: ' + storedAccess + '\n';
|
||||
//info += 'Log lvl: ' + window.serverConfig.logger.level + '\n';
|
||||
info += '- Avail Capt: ' + window.serverInfo.grabbers.available + '\n';
|
||||
info += '- Database: ' + (shy.readOnlyMode ? "ready-only" : "read/write") + '\n';
|
||||
|
||||
info += '\n';
|
||||
|
||||
info += 'Hyperion Server OS: \n';
|
||||
|
@@ -35,7 +35,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
editor_color.on('change',function() {
|
||||
editor_color.validate().length ? $('#btn_submit_color').attr('disabled', true) : $('#btn_submit_color').attr('disabled', false);
|
||||
editor_color.validate().length || window.readOnlyMode ? $('#btn_submit_color').attr('disabled', true) : $('#btn_submit_color').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_color').off().on('click',function() {
|
||||
@@ -48,7 +48,8 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
editor_smoothing.on('change',function() {
|
||||
editor_smoothing.validate().length ? $('#btn_submit_smoothing').attr('disabled', true) : $('#btn_submit_smoothing').attr('disabled', false);
|
||||
editor_smoothing.validate().length || window.readOnlyMode ? $('#btn_submit_smoothing').attr('disabled', true) : $('#btn_submit_smoothing').attr('disabled', false);
|
||||
|
||||
});
|
||||
|
||||
$('#btn_submit_smoothing').off().on('click',function() {
|
||||
@@ -61,7 +62,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
editor_blackborder.on('change',function() {
|
||||
editor_blackborder.validate().length ? $('#btn_submit_blackborder').attr('disabled', true) : $('#btn_submit_blackborder').attr('disabled', false);
|
||||
editor_blackborder.validate().length || window.readOnlyMode ? $('#btn_submit_blackborder').attr('disabled', true) : $('#btn_submit_blackborder').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_blackborder').off().on('click',function() {
|
||||
|
@@ -70,7 +70,6 @@ $(document).ready( function() {
|
||||
});
|
||||
|
||||
var instancename = window.currentHyperionInstanceName;
|
||||
console.log ("instancename: ",instancename);
|
||||
|
||||
$('#dash_statush').html(hyperion_enabled ? '<span style="color:green">'+$.i18n('general_btn_on')+'</span>' : '<span style="color:red">'+$.i18n('general_btn_off')+'</span>');
|
||||
$('#btn_hsc').html(hyperion_enabled ? '<button class="btn btn-sm btn-danger" onClick="requestSetComponentState(\'ALL\',false)">'+$.i18n('dashboard_infobox_label_disableh', instancename)+'</button>' : '<button class="btn btn-sm btn-success" onClick="requestSetComponentState(\'ALL\',true)">'+$.i18n('dashboard_infobox_label_enableh', instancename)+'</button>');
|
||||
|
@@ -43,7 +43,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
effects_editor.on('change',function() {
|
||||
effects_editor.validate().length ? $('#btn_submit_effects').attr('disabled', true) : $('#btn_submit_effects').attr('disabled', false);
|
||||
effects_editor.validate().length || window.readOnlyMode ? $('#btn_submit_effects').attr('disabled', true) : $('#btn_submit_effects').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_effects').off().on('click',function() {
|
||||
@@ -65,11 +65,11 @@ $(document).ready( function() {
|
||||
});
|
||||
|
||||
foregroundEffect_editor.on('change',function() {
|
||||
foregroundEffect_editor.validate().length ? $('#btn_submit_foregroundEffect').attr('disabled', true) : $('#btn_submit_foregroundEffect').attr('disabled', false);
|
||||
foregroundEffect_editor.validate().length || window.readOnlyMode ? $('#btn_submit_foregroundEffect').attr('disabled', true) : $('#btn_submit_foregroundEffect').attr('disabled', false);
|
||||
});
|
||||
|
||||
backgroundEffect_editor.on('change',function() {
|
||||
backgroundEffect_editor.validate().length ? $('#btn_submit_backgroundEffect').attr('disabled', true) : $('#btn_submit_backgroundEffect').attr('disabled', false);
|
||||
backgroundEffect_editor.validate().length || window.readOnlyMode ? $('#btn_submit_backgroundEffect').attr('disabled', true) : $('#btn_submit_backgroundEffect').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_foregroundEffect').off().on('click',function() {
|
||||
|
@@ -83,7 +83,8 @@ $(document).ready( function() {
|
||||
}
|
||||
if( effects_editor.validate().length == 0 && effectName != "")
|
||||
{
|
||||
$('#btn_start_test, #btn_write').attr('disabled', false);
|
||||
$('#btn_start_test').attr('disabled', false);
|
||||
!window.readOnlyMode ? $('#btn_write').attr('disabled', false) : $('#btn_write').attr('disabled', true);
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -101,6 +102,7 @@ $(document).ready( function() {
|
||||
} else {
|
||||
effects_editor.enable();
|
||||
$("#eff_footer").children().attr('disabled',false);
|
||||
!window.readOnlyMode ? $('#btn_write').attr('disabled', false) : $('#btn_write').attr('disabled', true);
|
||||
}
|
||||
});
|
||||
|
||||
|
@@ -18,7 +18,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor.on('change',function() {
|
||||
conf_editor.validate().length ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit').off().on('click',function() {
|
||||
@@ -28,6 +28,12 @@ $(document).ready( function() {
|
||||
// Instance handling
|
||||
function handleInstanceRename(e)
|
||||
{
|
||||
|
||||
conf_editor.on('change',function() {
|
||||
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);
|
||||
});
|
||||
|
||||
var inst = e.currentTarget.id.split("_")[1];
|
||||
showInfoDialog('renInst', $.i18n('conf_general_inst_renreq_t'), getInstanceNameByIndex(inst));
|
||||
|
||||
@@ -77,6 +83,10 @@ $(document).ready( function() {
|
||||
$('#instren_'+inst[key].instance).off().on('click', handleInstanceRename);
|
||||
$('#inst_'+inst[key].instance).off().on('click', handleInstanceStartStop);
|
||||
$('#instdel_'+inst[key].instance).off().on('click', handleInstanceDelete);
|
||||
|
||||
window.readOnlyMode ? $('#instren_'+inst[key].instance).attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
window.readOnlyMode ? $('#inst_'+inst[key].instance).attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
window.readOnlyMode ? $('#instdel_'+inst[key].instance).attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +95,7 @@ $(document).ready( function() {
|
||||
buildInstanceList();
|
||||
|
||||
$('#inst_name').off().on('input',function(e) {
|
||||
(e.currentTarget.value.length >= 5) ? $('#btn_create_inst').attr('disabled', false) : $('#btn_create_inst').attr('disabled', true);
|
||||
(e.currentTarget.value.length >= 5) && !window.readOnlyMode ? $('#btn_create_inst').attr('disabled', false) : $('#btn_create_inst').attr('disabled', true);
|
||||
if(5-e.currentTarget.value.length >= 1 && 5-e.currentTarget.value.length <= 4)
|
||||
$('#inst_chars_needed').html(5-e.currentTarget.value.length + " " + $.i18n('general_chars_needed'))
|
||||
else
|
||||
@@ -105,7 +115,7 @@ $(document).ready( function() {
|
||||
//import
|
||||
function dis_imp_btn(state)
|
||||
{
|
||||
state ? $('#btn_import_conf').attr('disabled', true) : $('#btn_import_conf').attr('disabled', false);
|
||||
state || window.readOnlyMode ? $('#btn_import_conf').attr('disabled', true) : $('#btn_import_conf').attr('disabled', false);
|
||||
}
|
||||
|
||||
function readFile(evt)
|
||||
|
@@ -213,7 +213,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_instCapt.on('change',function() {
|
||||
conf_editor_instCapt.validate().length ? $('#btn_submit_instCapt').attr('disabled', true) : $('#btn_submit_instCapt').attr('disabled', false);
|
||||
conf_editor_instCapt.validate().length || window.readOnlyMode ? $('#btn_submit_instCapt').attr('disabled', true) : $('#btn_submit_instCapt').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_instCapt').off().on('click',function() {
|
||||
@@ -226,7 +226,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_fg.on('change',function() {
|
||||
conf_editor_fg.validate().length ? $('#btn_submit_fg').attr('disabled', true) : $('#btn_submit_fg').attr('disabled', false);
|
||||
conf_editor_fg.validate().length || window.readOnlyMode ? $('#btn_submit_fg').attr('disabled', true) : $('#btn_submit_fg').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_fg').off().on('click',function() {
|
||||
@@ -239,7 +239,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_v4l2.on('change',function() {
|
||||
conf_editor_v4l2.validate().length ? $('#btn_submit_v4l2').attr('disabled', true) : $('#btn_submit_v4l2').attr('disabled', false);
|
||||
conf_editor_v4l2.validate().length || window.readOnlyMode ? $('#btn_submit_v4l2').attr('disabled', true) : $('#btn_submit_v4l2').attr('disabled', false);
|
||||
});
|
||||
|
||||
conf_editor_v4l2.on('ready', function() {
|
||||
|
@@ -26,6 +26,9 @@ $(document).ready(function () {
|
||||
|
||||
$(window.hyperion).on("cmd-serverinfo", function (event) {
|
||||
window.serverInfo = event.response.info;
|
||||
|
||||
window.readOnlyMode = window.sysInfo.hyperion.readOnlyMode;
|
||||
|
||||
// comps
|
||||
window.comps = event.response.info.components
|
||||
|
||||
|
@@ -468,6 +468,11 @@ $(document).ready(function() {
|
||||
$('#leds_custom_updsim').attr("disabled", true);
|
||||
$('#leds_custom_save').attr("disabled", true);
|
||||
}
|
||||
|
||||
if ( window.readOnlyMode )
|
||||
{
|
||||
$('#leds_custom_save').attr('disabled', true);
|
||||
}
|
||||
}
|
||||
}, window.serverConfig.leds);
|
||||
|
||||
@@ -520,7 +525,13 @@ $(document).ready(function() {
|
||||
};
|
||||
|
||||
// change save button state based on validation result
|
||||
conf_editor.validate().length ? $('#btn_submit_controller').attr('disabled', true) : $('#btn_submit_controller').attr('disabled', false);
|
||||
conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit_controller').attr('disabled', true) : $('#btn_submit_controller').attr('disabled', false);
|
||||
|
||||
conf_editor.on('change',function() {
|
||||
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 ? $('#leds_custom_save').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
});
|
||||
|
||||
// led controller sepecific wizards
|
||||
$('#btn_wiz_holder').html("");
|
||||
|
@@ -22,7 +22,7 @@ $(document).ready(function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor.on('change',function() {
|
||||
conf_editor.validate().length ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit').off().on('click',function() {
|
||||
@@ -80,6 +80,7 @@ $(document).ready(function() {
|
||||
info += 'UI Access: '+storedAccess+'\n';
|
||||
info += 'Log lvl: '+window.serverConfig.logger.level+'\n';
|
||||
info += 'Avail Capt: '+window.serverInfo.grabbers.available+'\n';
|
||||
info += 'Database: '+(shy.readOnlyMode ? "ready-only" : "read/write")+'\n';
|
||||
info += '\n';
|
||||
|
||||
info += 'Distribution:'+sys.prettyName+'\n';
|
||||
|
@@ -62,7 +62,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_net.on('change',function() {
|
||||
conf_editor_net.validate().length ? $('#btn_submit_net').attr('disabled', true) : $('#btn_submit_net').attr('disabled', false);
|
||||
conf_editor_net.validate().length || window.readOnlyMode ? $('#btn_submit_net').attr('disabled', true) : $('#btn_submit_net').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_net').off().on('click',function() {
|
||||
@@ -75,7 +75,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_json.on('change',function() {
|
||||
conf_editor_json.validate().length ? $('#btn_submit_jsonserver').attr('disabled', true) : $('#btn_submit_jsonserver').attr('disabled', false);
|
||||
conf_editor_json.validate().length || window.readOnlyMode ? $('#btn_submit_jsonserver').attr('disabled', true) : $('#btn_submit_jsonserver').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_jsonserver').off().on('click',function() {
|
||||
@@ -88,7 +88,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_fbs.on('change',function() {
|
||||
conf_editor_fbs.validate().length ? $('#btn_submit_fbserver').attr('disabled', true) : $('#btn_submit_fbserver').attr('disabled', false);
|
||||
conf_editor_fbs.validate().length || window.readOnlyMode ? $('#btn_submit_fbserver').attr('disabled', true) : $('#btn_submit_fbserver').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_fbserver').off().on('click',function() {
|
||||
@@ -101,7 +101,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_proto.on('change',function() {
|
||||
conf_editor_proto.validate().length ? $('#btn_submit_protoserver').attr('disabled', true) : $('#btn_submit_protoserver').attr('disabled', false);
|
||||
conf_editor_proto.validate().length || window.readOnlyMode ? $('#btn_submit_protoserver').attr('disabled', true) : $('#btn_submit_protoserver').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_protoserver').off().on('click',function() {
|
||||
@@ -114,7 +114,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_bobl.on('change',function() {
|
||||
conf_editor_bobl.validate().length ? $('#btn_submit_boblightserver').attr('disabled', true) : $('#btn_submit_boblightserver').attr('disabled', false);
|
||||
conf_editor_bobl.validate().length || window.readOnlyMode ? $('#btn_submit_boblightserver').attr('disabled', true) : $('#btn_submit_boblightserver').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_boblightserver').off().on('click',function() {
|
||||
@@ -129,7 +129,7 @@ $(document).ready( function() {
|
||||
}, true, true);
|
||||
|
||||
conf_editor_forw.on('change',function() {
|
||||
conf_editor_forw.validate().length ? $('#btn_submit_forwarder').attr('disabled', true) : $('#btn_submit_forwarder').attr('disabled', false);
|
||||
conf_editor_forw.validate().length || window.readOnlyMode ? $('#btn_submit_forwarder').attr('disabled', true) : $('#btn_submit_forwarder').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit_forwarder').off().on('click',function() {
|
||||
|
@@ -14,7 +14,7 @@
|
||||
}, true, true);
|
||||
|
||||
conf_editor.on('change',function() {
|
||||
conf_editor.validate().length ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
conf_editor.validate().length || window.readOnlyMode ? $('#btn_submit').attr('disabled', true) : $('#btn_submit').attr('disabled', false);
|
||||
});
|
||||
|
||||
$('#btn_submit').off().on('click',function() {
|
||||
|
@@ -471,8 +471,5 @@ async function requestLedDeviceProperties(type, params)
|
||||
function requestLedDeviceIdentification(type, params)
|
||||
{
|
||||
sendToHyperion("leddevice", "identify", '"ledDeviceType": "'+type+'","params": '+JSON.stringify(params)+'');
|
||||
|
||||
//let data = {ledDeviceType: type, params: params};
|
||||
//sendToHyperion("leddevice", "identify", data );
|
||||
}
|
||||
|
||||
|
@@ -21,7 +21,7 @@ function changePassword(){
|
||||
});
|
||||
|
||||
$('#newPw, #oldPw').off().on('input',function(e) {
|
||||
($('#oldPw').val().length >= 8 && $('#newPw').val().length >= 8) ? $('#id_btn_ok').attr('disabled', false) : $('#id_btn_ok').attr('disabled', true);
|
||||
($('#oldPw').val().length >= 8 && $('#newPw').val().length >= 8) && !window.readOnlyMode ? $('#id_btn_ok').attr('disabled', false) : $('#id_btn_ok').attr('disabled', true);
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -109,9 +109,13 @@ function beginWizardRGB() {
|
||||
if (redS == "r" && greenS == "g") {
|
||||
$('#btn_wiz_save').toggle(false);
|
||||
$('#btn_wiz_checkok').toggle(true);
|
||||
|
||||
window.readOnlyMode ? $('#btn_wiz_checkok').attr('disabled', true) : $('#btn_wiz_checkok').attr('disabled', false);
|
||||
}
|
||||
else {
|
||||
$('#btn_wiz_save').toggle(true);
|
||||
window.readOnlyMode ? $('#btn_wiz_save').attr('disabled', true) : $('#btn_wiz_save').attr('disabled', false);
|
||||
|
||||
$('#btn_wiz_checkok').toggle(false);
|
||||
}
|
||||
new_rgb_order = rgb_order;
|
||||
@@ -390,6 +394,7 @@ function performAction() {
|
||||
|
||||
$('#btn_wiz_next').attr("disabled", true);
|
||||
$('#btn_wiz_save').toggle(true);
|
||||
window.readOnlyMode ? $('#btn_wiz_save').attr('disabled', true) : $('#btn_wiz_save').attr('disabled', false);
|
||||
}
|
||||
else {
|
||||
$('#btn_wiz_next').attr("disabled", false);
|
||||
@@ -407,13 +412,13 @@ function updateWEditor(el, all) {
|
||||
}
|
||||
|
||||
function startWizardCC() {
|
||||
|
||||
// Ensure that Kodi's default REST-API port is not used, as now the Web-Socket port is used
|
||||
[kodiHost, kodiPort] = kodiAddress.split(":", 2);
|
||||
if (kodiPort === "8080") {
|
||||
kodiAddress = kodiHost;
|
||||
kodiPort = undefined;
|
||||
}
|
||||
|
||||
//create html
|
||||
$('#wiz_header').html('<i class="fa fa-magic fa-fw"></i>' + $.i18n('wiz_cc_title'));
|
||||
$('#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>');
|
||||
@@ -429,6 +434,7 @@ function startWizardCC() {
|
||||
});
|
||||
|
||||
$('#wiz_cc_kodiip').off().on('change', function () {
|
||||
|
||||
kodiAddress = $(this).val().trim();
|
||||
$('#kodi_status').html('');
|
||||
|
||||
@@ -1151,7 +1157,9 @@ function get_hue_lights() {
|
||||
cC++;
|
||||
}
|
||||
}
|
||||
(cC == 0) ? $('#btn_wiz_save').attr("disabled", true) : $('#btn_wiz_save').attr("disabled", false);
|
||||
|
||||
(cC == 0 || window.readOnlyMode) ? $('#btn_wiz_save').attr("disabled", true) : $('#btn_wiz_save').attr("disabled", false);
|
||||
|
||||
});
|
||||
}
|
||||
$('.hue_sel_watch').trigger('change');
|
||||
@@ -1497,7 +1505,8 @@ function assign_yeelight_lights() {
|
||||
cC++;
|
||||
}
|
||||
}
|
||||
if (cC === 0)
|
||||
|
||||
if (cC === 0 || window.readOnlyMode)
|
||||
$('#btn_wiz_save').attr("disabled", true);
|
||||
else
|
||||
$('#btn_wiz_save').attr("disabled", false);
|
||||
@@ -1527,7 +1536,6 @@ async function getProperties_yeelight(hostname, port) {
|
||||
|
||||
function identify_yeelight_device(hostname, port) {
|
||||
let params = { hostname: hostname, port: port };
|
||||
|
||||
const res = requestLedDeviceIdentification("yeelight", params);
|
||||
// TODO: error case unhandled
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
@@ -1759,7 +1767,7 @@ function assign_atmoorb_lights() {
|
||||
cC++;
|
||||
}
|
||||
}
|
||||
if (cC === 0)
|
||||
if (cC === 0 || window.readOnlyMode)
|
||||
$('#btn_wiz_save').attr("disabled", true);
|
||||
else
|
||||
$('#btn_wiz_save').attr("disabled", false);
|
||||
@@ -1860,7 +1868,6 @@ async function discover_providerRs232(rs232Type) {
|
||||
//****************************
|
||||
async function discover_providerHid(hidType) {
|
||||
const res = await requestLedDeviceDiscovery(hidType);
|
||||
console.log("discover_providerHid", res);
|
||||
|
||||
// TODO: error case unhandled
|
||||
// res can be: false (timeout) or res.error (not found)
|
||||
|
Reference in New Issue
Block a user