mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 16:13:24 +02:00
Cleaning new Logcat table.
This commit is contained in:
@@ -1,12 +1,93 @@
|
||||
module.exports = function logcatTableDirective() {
|
||||
var _ = require('lodash')
|
||||
|
||||
module.exports = function logcatTableDirective($rootScope, $timeout, logcatAutoScroll) {
|
||||
return {
|
||||
restrict: 'E',
|
||||
replace: true,
|
||||
scope: {
|
||||
|
||||
},
|
||||
template: require('./logcat-table.jade'),
|
||||
link: function (scope, element, attrs) {
|
||||
var parent = element[0]
|
||||
var body = element.find('tbody')[0]
|
||||
|
||||
function scrollToBottom() {
|
||||
parent.scrollTop = parent.scrollHeight + 20
|
||||
$timeout(function () {
|
||||
parent.scrollTop = parent.scrollHeight
|
||||
}, 10)
|
||||
}
|
||||
|
||||
function addRow(data, batchRequest) {
|
||||
var newRow = body.insertRow(-1)
|
||||
|
||||
// newRow.insertCell(-1)
|
||||
// .appendChild($document.createTextNode(DeviceLogService.linesCounter));
|
||||
// newRow.insertCell(-1)
|
||||
// .appendChild($document.createTextNode(data.deviceName));
|
||||
// newRow.insertCell(-1)
|
||||
// .appendChild($document.createTextNode(data.levelName));
|
||||
// newRow.insertCell(-1)
|
||||
// .appendChild($document.createTextNode(data.dateFormatted));
|
||||
// if ($rootScope.platform === 'native') {
|
||||
newRow.insertCell(-1)
|
||||
.appendChild(document.createTextNode(data.pid))
|
||||
newRow.insertCell(-1)
|
||||
.appendChild(document.createTextNode(data.tid))
|
||||
newRow.insertCell(-1)
|
||||
.appendChild(document.createTextNode(data.app))
|
||||
newRow.insertCell(-1)
|
||||
.appendChild(document.createTextNode(data.tag))
|
||||
// }
|
||||
newRow.insertCell(-1)
|
||||
.appendChild(document.createTextNode(data.message))
|
||||
|
||||
if (logcatAutoScroll && !batchRequest) {
|
||||
_.throttle(scrollToBottom, 10)()
|
||||
}
|
||||
}
|
||||
|
||||
function clearTable() {
|
||||
var oldBody = body
|
||||
var newBody = document.createElement('tbody')
|
||||
oldBody.parentNode.replaceChild(newBody, oldBody)
|
||||
body = newBody
|
||||
}
|
||||
|
||||
addRow({
|
||||
"serial": "1cd49783",
|
||||
"date": 1399964036.984,
|
||||
"pid": 9246,
|
||||
"tid": 9540,
|
||||
"priority": 3,
|
||||
"tag": "MobileDataStateTracker",
|
||||
"message": "default: setPolicyDataEnable(enabled=true)"
|
||||
})
|
||||
|
||||
for (var i = 0; i < 50; i++) {
|
||||
addRow({
|
||||
"serial": "14141cd49783",
|
||||
"date": 1399964036.984,
|
||||
"pid": 9246,
|
||||
"tid": 9540,
|
||||
"priority": 3,
|
||||
"tag": "MobileDataStateTracker",
|
||||
"message": "XXdefault: setPolicyDataEnable(enabled=true)"
|
||||
})
|
||||
}
|
||||
|
||||
$timeout(function () {
|
||||
for (var i = 0; i < 10; i++) {
|
||||
addRow({
|
||||
"serial": "14141cd49783",
|
||||
"date": 1399964036.984,
|
||||
"pid": 9246,
|
||||
"tid": 9540,
|
||||
"priority": 3,
|
||||
"tag": "MobileDataStateTracker",
|
||||
"message": "XXdefault: setPolicyDataEnable(enabled=true)"
|
||||
})
|
||||
}
|
||||
}, 1000)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user