mirror of
https://github.com/openstf/stf
synced 2025-10-05 19:42:01 +02:00
Starting to add Logcat.
This commit is contained in:
parent
3b6da1542b
commit
9b304a939c
6 changed files with 75 additions and 8 deletions
4
res/app/components/stf/logcat/index.js
Normal file
4
res/app/components/stf/logcat/index.js
Normal file
|
@ -0,0 +1,4 @@
|
|||
module.exports = angular.module('stf.logcat', [
|
||||
|
||||
])
|
||||
.factory('LogcatService', require('./logcat-service'))
|
48
res/app/components/stf/logcat/logcat-service.js
Normal file
48
res/app/components/stf/logcat/logcat-service.js
Normal file
|
@ -0,0 +1,48 @@
|
|||
var _ = require('lodash')
|
||||
|
||||
module.exports = function LogcatServiceFactory(socket) {
|
||||
var LogcatService = {}
|
||||
|
||||
LogcatService.entries = []
|
||||
|
||||
LogcatService.logLevels = [
|
||||
'UNKNOWN',
|
||||
'DEFAULT',
|
||||
'VERBOSE',
|
||||
'DEBUG',
|
||||
'INFO',
|
||||
'WARN',
|
||||
'ERROR',
|
||||
'FATAL',
|
||||
'SILENT'
|
||||
]
|
||||
|
||||
var logLevelsLowerCase = _.map(LogcatService.logLevels, function (level) {
|
||||
return level.toLowerCase()
|
||||
})
|
||||
|
||||
var logLevelsCapitalized = _.map(logLevelsLowerCase, function (level) {
|
||||
//return _.capitalize(level)
|
||||
})
|
||||
|
||||
function enhanceEntry(data) {
|
||||
var date = new Date(data.date)
|
||||
// data.dateFormatted = _.pad(date.getHours(), 2, '0') + ':' +
|
||||
// _.pad(date.getMinutes(), 2, '0') + ':' +
|
||||
// _.pad(date.getSeconds(), 2, '0') + '.' +
|
||||
// _.pad(date.getMilliseconds(), 3, '0')
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
socket.on('logcat.entry', function (data) {
|
||||
LogcatService.entries.push(enhanceEntry(data))
|
||||
})
|
||||
|
||||
LogcatService.clear = function () {
|
||||
LogcatService.entries = []
|
||||
}
|
||||
|
||||
return LogcatService
|
||||
}
|
||||
|
11
res/app/components/stf/logcat/logcat-spec.js
Normal file
11
res/app/components/stf/logcat/logcat-spec.js
Normal file
|
@ -0,0 +1,11 @@
|
|||
describe('LogcatService', function() {
|
||||
|
||||
beforeEach(module('stf.logcat'));
|
||||
|
||||
it('should ...', inject(function(LogcatService) {
|
||||
|
||||
//expect(LogcatService.doSomething()).toEqual('something');
|
||||
|
||||
}));
|
||||
|
||||
})
|
|
@ -1,7 +1,7 @@
|
|||
require('./logs.less')
|
||||
|
||||
module.exports = angular.module('stf.logs', [
|
||||
|
||||
require('stf/logcat').name
|
||||
])
|
||||
.run(["$templateCache", function ($templateCache) {
|
||||
$templateCache.put('control-panes/logs/logs.jade',
|
||||
|
|
|
@ -1,10 +1,8 @@
|
|||
module.exports = function LogsCtrl($scope, socket) {
|
||||
module.exports = function LogsCtrl($scope, LogcatService) {
|
||||
|
||||
var filters = []
|
||||
|
||||
socket.scoped($scope).on('logcat.entry', function (entry) {
|
||||
console.log(entry)
|
||||
})
|
||||
$scope.logEntries = LogcatService.entries
|
||||
|
||||
|
||||
$scope.$watch('started', function (newValue, oldValue) {
|
||||
|
@ -19,6 +17,9 @@ module.exports = function LogsCtrl($scope, socket) {
|
|||
}
|
||||
|
||||
}
|
||||
})
|
||||
|
||||
});
|
||||
$scope.clear = function () {
|
||||
LogcatService.clear()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -17,7 +17,10 @@
|
|||
|
||||
//table.table.table-condensed(ng-show='filtering.show')
|
||||
|
||||
//
|
||||
|
||||
table.table.table-condensed.logcat-filters-table(ng-show='true')
|
||||
|
||||
//tr
|
||||
th(width='4%')//Line
|
||||
th(width='10%') Device
|
||||
|
@ -71,5 +74,5 @@
|
|||
th(width='16%')
|
||||
th(width='46%')
|
||||
tbody#logcatBody
|
||||
|
||||
br
|
||||
pre {{ logEntries | json }}
|
||||
br
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue