diff options
| author | pliablepixels <pliablepixels@gmail.com> | 2016-05-16 13:49:42 -0400 |
|---|---|---|
| committer | pliablepixels <pliablepixels@gmail.com> | 2016-05-16 13:49:42 -0400 |
| commit | befd33838021ea947154422a3431d006ed758955 (patch) | |
| tree | e082414af049df361459c633c22ea6eaa12952ef /www/js | |
| parent | cadf88096c24256d90db2b2c1567518187fcb125 (diff) | |
#234 - make sure you only pick an enabled and functional monitor
Former-commit-id: 864b6002cd4b3359f34022574fffe7ed6268682e
Diffstat (limited to 'www/js')
| -rw-r--r-- | www/js/WizardCtrl.js | 28 |
1 files changed, 24 insertions, 4 deletions
diff --git a/www/js/WizardCtrl.js b/www/js/WizardCtrl.js index b64d5ff9..d14cfeab 100644 --- a/www/js/WizardCtrl.js +++ b/www/js/WizardCtrl.js @@ -81,9 +81,29 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$ .then (function (success) { if (success.data.monitors.length > 0) { - - ZMDataModel.zmDebug("zmWizard - getFirstMonitor returned " + success.data.monitors[0].Monitor.Id); d.resolve(success.data.monitors[0].Monitor.Id); - return d.promise; + var foundMid = -1; + for (var i=0; i< success.data.monitors.length; i++) + { + if ( success.data.monitors[i].Monitor.Function != 'None' && + success.data.monitors[i].Monitor.Enabled == '1') + { + foundMid = success.data.monitors[i].Monitor.Id; + break; + } + } + + if (foundMid != -1) + { + ZMDataModel.zmDebug("zmWizard - getFirstMonitor returned " + foundMid); d.resolve(foundMid); + return d.promise; + } + else + { + d.reject(false); + return d.promise; + } + + } else @@ -229,7 +249,7 @@ angular.module('zmApp.controllers').controller('zmApp.WizardCtrl', ['$scope', '$ }, function (error){ $ionicLoading.hide(); - $scope.wizard.streamingValidText = "cgi-bin detection failed. No configured monitor found."; + $scope.wizard.streamingValidText = "cgi-bin detection failed. No configured/enabled monitor found."; $scope.wizard.streamingColor = "#e74c3c"; d.reject (false); return (d.promise); |
