From 3a215aa40a700682efea7fc84e63c5bf65f046c8 Mon Sep 17 00:00:00 2001 From: Calin Crisan Date: Sat, 19 Oct 2013 15:06:09 +0300 Subject: [PATCH] improved remote camera adding ui --- doc/todo.txt | 3 --- static/js/main.js | 17 ++++++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/doc/todo.txt b/doc/todo.txt index 7924432..e7ad0ea 100644 --- a/doc/todo.txt +++ b/doc/todo.txt @@ -1,7 +1,4 @@ --> add/remove camera: apply button still there - -> http clients don't die: max_clients limit reached, request queued. 10 active, 217 queued requests. --> remote adding ui could be improved (cleanup fields on ok/on load, no error message until everything is ok) -> add an autoupdate mechanism diff --git a/static/js/main.js b/static/js/main.js index 6277bd9..2c041ef 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -668,6 +668,8 @@ function showApply() { } function showProgress() { + refreshDisabled++; + if (!$('div.settings-container').is(':visible')) { return; /* settings panel is not open */ } @@ -684,8 +686,6 @@ function showProgress() { applyButton.addClass('progress'); $('div.camera-progress').css('opacity', '0.5'); - - refreshDisabled++; } function hideApply() { @@ -702,6 +702,8 @@ function hideApply() { } function endProgress() { + refreshDisabled--; + if (Object.keys(pushConfigs).length === 0) { hideApply(); } @@ -710,8 +712,6 @@ function endProgress() { } $('div.camera-progress').css('opacity', '0'); - - refreshDisabled--; } function isProgress() { @@ -994,7 +994,7 @@ function runAddCameraDialog() { this.validate(); }); - if (uiValid() && deviceSelect.val() == 'remote') { + if (content.is(':visible') && uiValid() && deviceSelect.val() == 'remote') { fetchRemoteCameras(); } } @@ -1037,7 +1037,10 @@ function runAddCameraDialog() { ajax('GET', '/config/list/', data, function (data) { if (data == null || data.error) { progress.remove(); - showErrorMessage(data && data.error); + if (passwordEntry.val()) { /* only show an error message when a password is supplied */ + showErrorMessage(data && data.error); + } + return; } @@ -1064,7 +1067,7 @@ function runAddCameraDialog() { updateUi(); showModalDialog(''); - + /* fetch the available devices */ ajax('GET', '/config/list_devices/', null, function (data) { if (data == null || data.error) { -- 2.39.5