From: Calin Crisan <ccrisan@gmail.com> Date: Sat, 9 Nov 2013 16:16:08 +0000 (+0200) Subject: added some protections when motionEye is disabled or settings are to be X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=229043ee56b675a944787e6d3cf6ed94ef2ac5c3;p=motioneye-debian added some protections when motionEye is disabled or settings are to be applied --- diff --git a/static/css/main.css b/static/css/main.css index a559729..d915aa7 100644 --- a/static/css/main.css +++ b/static/css/main.css @@ -78,6 +78,7 @@ div.copyright-note { div.page-container { transition: all 0.2s linear; padding: 55px 5px 3em 5px; + text-align: center; } div.page-container.stretched { diff --git a/static/js/main.js b/static/js/main.js index b253910..e3d525e 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -786,6 +786,10 @@ function doApply() { } function doRemCamera() { + if (Object.keys(pushConfigs).length) { + return runAlertDialog('Please apply the modified settings first!'); + } + var cameraId = $('#videoDeviceSelect').val(); if (cameraId == null || cameraId === 'add') { runAlertDialog('No camera to remove!'); @@ -810,6 +814,10 @@ function doRemCamera() { } function doUpdate() { + if (Object.keys(pushConfigs).length) { + return runAlertDialog('Please apply the modified settings first!'); + } + showModalDialog('<div class="modal-progress"></div>'); ajax('GET', '/update/', null, function (data) { if (data.update_version == null) { @@ -985,6 +993,14 @@ function runConfirmDialog(message, onYes) { } function runAddCameraDialog() { + if (!$('#motionEyeSwitch')[0].checked) { + return runAlertDialog('Please enable motionEye first!'); + } + + if (Object.keys(pushConfigs).length) { + return runAlertDialog('Please apply the modified settings first!'); + } + var content = $('<table class="add-camera-dialog">' + '<tr>' + @@ -1328,7 +1344,7 @@ function recreateCameraFrames(cameras) { } } - if ($('#videoDeviceSelect').find('option').length < 2 && user === 'admin') { + if ($('#videoDeviceSelect').find('option').length < 2 && user === 'admin' && $('#motionEyeSwitch')[0].checked) { /* invite the user to add a camera */ var addCameraLink = $('<div style="text-align: center; margin-top: 30px;">' + '<a href="javascript:runAddCameraDialog()">You have not configured any camera yet. Click here to add one...</a></div>');