mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 08:13:31 +02:00
54 lines
1.1 KiB
JavaScript
54 lines
1.1 KiB
JavaScript
module.exports = function LogsCtrl($scope, LogcatService) {
|
|
|
|
$scope.started = LogcatService.started
|
|
|
|
$scope.filters = {}
|
|
|
|
$scope.filters.levelNumbers = LogcatService.filters.levelNumbers
|
|
|
|
LogcatService.filters.filterLines()
|
|
|
|
$scope.$watch('started', function (newValue, oldValue) {
|
|
if (newValue !== oldValue) {
|
|
LogcatService.started = newValue
|
|
if (newValue) {
|
|
$scope.control.startLogcat([]).then(function () {
|
|
})
|
|
} else {
|
|
$scope.control.stopLogcat()
|
|
}
|
|
}
|
|
})
|
|
|
|
window.onbeforeunload = function () {
|
|
if ($scope.control) {
|
|
$scope.control.stopLogcat()
|
|
}
|
|
}
|
|
|
|
$scope.clear = function () {
|
|
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'
|
|
])
|
|
}
|