Add support for changing monitor function in list view

This commit is contained in:
Kyle Johnson 2015-02-11 13:45:07 -05:00
parent 2d418f9205
commit 23b50f044e
2 changed files with 22 additions and 4 deletions

View File

@ -253,7 +253,7 @@ ZoneMinder.controller('MonitorController', function($scope, $http, $location, Mo
}; };
}); });
ZoneMinder.controller('ConsoleController', function($scope, Console) { ZoneMinder.controller('ConsoleController', function($scope, Console, Monitor) {
$scope.grid = true; $scope.grid = true;
$scope.gridButton = 'glyphicon-th'; $scope.gridButton = 'glyphicon-th';
$scope.consoleLayout = 4; $scope.consoleLayout = 4;
@ -323,6 +323,15 @@ ZoneMinder.controller('ConsoleController', function($scope, Console) {
$scope.gridButton = $scope.gridButton == 'glyphicon-th' ? 'glyphicon-th-list' : 'glyphicon-th'; $scope.gridButton = $scope.gridButton == 'glyphicon-th' ? 'glyphicon-th-list' : 'glyphicon-th';
$scope.grid = $scope.grid == true ? false : true; $scope.grid = $scope.grid == true ? false : true;
}; };
$scope.saveMonitor = function(monitor) {
var i = document.getElementById('function'+monitor.Id).parentNode.parentNode;
Monitor.saveMonitor(monitor)
.success(function(data) {
i.className = i.className + " has-success has-feedback";
});
};
}); });

View File

@ -55,12 +55,11 @@
<div class="row" ng-hide="grid"> <div class="row" ng-hide="grid">
<div class="col-md-12"> <div class="col-md-12">
<table class="table table-striped"> <table class="table table-striped">
<tr> <tr>
<th>Id</th> <th>Id</th>
<th>Name</th> <th>Name</th>
<th>Function</th> <th class="col-md-1">Function</th>
<th>Source</th> <th>Source</th>
<th>Enabled</th> <th>Enabled</th>
<th>Zones</th> <th>Zones</th>
@ -70,7 +69,17 @@
<tr ng-repeat="monitor in monitors"> <tr ng-repeat="monitor in monitors">
<td ng-bind="monitor.Id"></td> <td ng-bind="monitor.Id"></td>
<td><a ng-href="/?view=monitor&mid={{ monitor.Id }}">{{ monitor.Name}} </a></td> <td><a ng-href="/?view=monitor&mid={{ monitor.Id }}">{{ monitor.Name}} </a></td>
<td ng-bind="monitor.Function"></td> <td class="col-md-1">
<label class="sr-only">Function</label>
<select id="function{{monitor.Id}}" ng-model="monitor.Function" class="form-control" ng-change="saveMonitor(monitor)">
<option value="None">None</option>
<option value="Monitor">Monitor</option>
<option value="Modect">Modect</option>
<option value="Record">Record</option>
<option value="Mocord">Mocord</option>
<option value="Nodect">Nodect</option>
</select>
</td>
<td ng-bind="monitor.Type"></td> <td ng-bind="monitor.Type"></td>
<td ng-bind="monitor.Enabled"></td> <td ng-bind="monitor.Enabled"></td>
<td ng-bind="monitor.Zones"></td> <td ng-bind="monitor.Zones"></td>