Added after-the-fact filtering.

This commit is contained in:
Gunther Brunner
2014-05-21 16:32:44 +09:00
parent 9e753551af
commit 48d50757f8
7 changed files with 181 additions and 19 deletions

View File

@@ -4,10 +4,12 @@ module.exports = function LogsCtrl($scope, LogcatService) {
$scope.logEntries = LogcatService.entries
$scope.filters = LogcatService.filters
$scope.started = LogcatService.started
$scope.filters = {}
$scope.filters.levelNumbers = LogcatService.filters.levelNumbers
$scope.$watch('started', function (newValue, oldValue) {
if (newValue !== oldValue) {
LogcatService.started = newValue
@@ -28,4 +30,30 @@ module.exports = function LogsCtrl($scope, LogcatService) {
LogcatService.clear()
}
function defineFilterWatchers(props) {
angular.forEach(props, function (prop) {
$scope.$watch('filters.' + prop, function (newValue, oldValue) {
if (!angular.equals(newValue, oldValue)) {
LogcatService.filters[prop] = newValue
}
})
})
}
defineFilterWatchers([
'levelNumber',
'message',
'pid',
'tid',
'dateLabel',
'date',
'tag',
'priority'
])
// $scope.$watchCollection('filters', function (newValue, oldValue) {
// console.log(newValue)
// });
}