]> www.vanbest.org Git - motioneye-debian/commitdiff
added some protections when motionEye is disabled or settings are to be
authorCalin Crisan <ccrisan@gmail.com>
Sat, 9 Nov 2013 16:16:08 +0000 (18:16 +0200)
committerCalin Crisan <ccrisan@gmail.com>
Sat, 9 Nov 2013 16:16:08 +0000 (18:16 +0200)
applied

static/css/main.css
static/js/main.js

index a559729f7fec43509fb1643b3037dee1c224ae14..d915aa75c27374d512cff16ed0d9b65ddb587e7e 100644 (file)
@@ -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 {
index b253910d47bae266e6432618a959c8fdf1846e4c..e3d525e2aab143728d675c4e8dd2b18adbde7fc4 100644 (file)
@@ -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>');