From: Calin Crisan Date: Sun, 6 Jul 2014 10:21:00 +0000 (+0300) Subject: disabled cameras fixes X-Git-Url: http://www.vanbest.org/gitweb/?a=commitdiff_plain;h=73cd629eee08d07dfb8ed28cb36be44035cbd9a7;p=motioneye-debian disabled cameras fixes --- diff --git a/static/js/main.js b/static/js/main.js index 9dd29cb..6d25e9d 100644 --- a/static/js/main.js +++ b/static/js/main.js @@ -1035,6 +1035,7 @@ function doApply() { pushConfigs = {}; endProgress(); + recreateCameraFrames(); /* a camera could have been disabled */ }); } @@ -1053,9 +1054,11 @@ function doRemCamera() { runConfirmDialog('Remove camera ' + deviceName + '?', function () { /* disable further refreshing of this camera */ - var img = $('div.camera-frame#camera' + cameraId).find('img.camera')[0]; - img.loading = 1; - + var img = $('div.camera-frame#camera' + cameraId).find('img.camera'); + if (img.length) { + img[0].loading = 1; + } + beginProgress(); ajax('POST', '/config/' + cameraId + '/rem/', null, function (data) { if (data == null || data.error) { @@ -1147,12 +1150,11 @@ function fetchCurrentConfig(onFetch) { } videoDeviceSelect.append(''); - var enabledCameras = cameras.filter(function (camera) {return camera['enabled'];}); - if (enabledCameras.length > 0) { - videoDeviceSelect[0].selectedIndex = cameras.indexOf(enabledCameras[0]); + if (cameras.length) { /* at least one camera */ + videoDeviceSelect[0].selectedIndex = 0; fetchCurrentCameraConfig(); } - else { + else { /* no camera at all */ videoDeviceSelect[0].selectedIndex = -1; }