From 229043ee56b675a944787e6d3cf6ed94ef2ac5c3 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 9 Nov 2013 18:16:08 +0200 Subject: [PATCH] added some protections when motionEye is disabled or settings are to be applied --- static/css/main.css | 1 + static/js/main.js | 18 +++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) 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(''); 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 = $('' + '' + @@ -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 = $('
' + 'You have not configured any camera yet. Click here to add one...
'); -- 2.39.5