mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-28 00:35:18 +02:00
Cleaning new Logcat table.
This commit is contained in:
@@ -3,4 +3,5 @@ require('./logcat-table.css')
|
||||
module.exports = angular.module('stf.logcat-table', [
|
||||
|
||||
])
|
||||
.value('logcatAutoScroll', true)
|
||||
.directive('logcatTable', require('./logcat-table-directive'))
|
||||
|
||||
@@ -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)
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,3 +1,71 @@
|
||||
.stf-logcat-table {
|
||||
background: #fff;
|
||||
position: absolute;
|
||||
top: 69px;
|
||||
left: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
overflow-y: auto;
|
||||
box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
|
||||
/*z-index: -10;*/
|
||||
}
|
||||
|
||||
}
|
||||
.stf-logcat-table table {
|
||||
table-layout: fixed !important;
|
||||
}
|
||||
|
||||
.stf-logcat-table tbody tr {
|
||||
border-bottom: 1px solid rgb(240, 240, 240);
|
||||
}
|
||||
|
||||
.stf-logcat-table tbody td {
|
||||
padding-left: 5px;
|
||||
padding-right: 5px;
|
||||
}
|
||||
|
||||
.stf-logcat-table .console-message-text {
|
||||
font-size: 11px !important;
|
||||
font-family: Menlo, monospace;
|
||||
white-space: pre-wrap;
|
||||
}
|
||||
|
||||
.stf-logcat-table .console-message-text td {
|
||||
/*color: rgb(48, 57, 66);*/
|
||||
}
|
||||
|
||||
/**
|
||||
Logging colors
|
||||
*/
|
||||
|
||||
.stf-logcat-table .log-unknown {
|
||||
color: bisque;
|
||||
}
|
||||
|
||||
.stf-logcat-table .log-default,
|
||||
.stf-logcat-table .log-silent {
|
||||
color: darkolivegreen;
|
||||
}
|
||||
|
||||
.stf-logcat-table .log-verbose {
|
||||
color: blueviolet;
|
||||
}
|
||||
|
||||
.stf-logcat-table .log-debug {
|
||||
color: rgb(48, 57, 66);
|
||||
}
|
||||
|
||||
.stf-logcat-table .log-info {
|
||||
color: blue;
|
||||
}
|
||||
|
||||
.stf-logcat-table .log-warn {
|
||||
color: coral;
|
||||
}
|
||||
|
||||
.stf-logcat-table .log-error {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.stf-logcat-table .log-fatal {
|
||||
color: darkcyan;
|
||||
}
|
||||
|
||||
@@ -1 +1,3 @@
|
||||
div.stf-logcat-table
|
||||
.stf-logcat-table.force-gpu
|
||||
table.console-message-text.tableX.table-condensedX.selectableX
|
||||
tbody
|
||||
|
||||
Reference in New Issue
Block a user