gatewayd: beef up browse.html a bit

This commit is contained in:
Lennart Poettering 2012-10-10 02:41:27 +02:00
parent 77ad3b93de
commit 1dac8b797c

View file

@ -4,7 +4,7 @@
<title>Journal</title> <title>Journal</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<style type="text/css"> <style type="text/css">
div#logs { div#divlogs {
font-family: monospace; font-family: monospace;
font-size: 8pt; font-size: 8pt;
background-color: #ffffff; background-color: #ffffff;
@ -21,22 +21,37 @@
font: message-box; font: message-box;
margin: 5em; margin: 5em;
} }
td.timestamp {
.log-error { text-align: right;
border-right: 1px dotted lightgrey;
padding-right: 5px;
}
td.process {
border-right: 1px dotted lightgrey;
padding-left: 5px;
padding-right: 5px;
}
td.message {
padding-left: 5px;
}
td.message-error {
padding-left: 5px;
color: red; color: red;
font-weight: bold; font-weight: bold;
} }
.log-highlight { td.message-highlight {
padding-left: 5px;
font-weight: bold; font-weight: bold;
} }
table#tablelogs {
border-collapse:collapse;
}
</style> </style>
</head> </head>
<body> <body>
<!-- TODO: <!-- TODO:
- seek to back properly
- handle seek before front properly
- show red lines for reboots - show red lines for reboots
- show contents of entries --> - show contents of entries -->
@ -49,7 +64,7 @@
<div id="usage"></div> <div id="usage"></div>
<div id="showing"></div> <div id="showing"></div>
<div id="logs"></div> <div id="divlogs"><table id="tablelogs"></table></div>
<form> <form>
<input id="head" type="button" value="|&lt;" onclick="entriesLoadHead();"/> <input id="head" type="button" value="|&lt;" onclick="entriesLoadHead();"/>
@ -196,8 +211,7 @@
(event.currentTarget.status != 200 && event.currentTarget.status != 0)) (event.currentTarget.status != 200 && event.currentTarget.status != 0))
return; return;
var logs = document.getElementById("logs"); var logs = document.getElementById("tablelogs");
logs.innerHTML = "";
var lc = null; var lc = null;
var fc = null; var fc = null;
@ -206,10 +220,12 @@
var l = event.currentTarget.responseText.split('\n'); var l = event.currentTarget.responseText.split('\n');
if (l.length <= 1) { if (l.length <= 1) {
logs.innerHTML = "<i>No further entries...</i>"; logs.innerHTML = '<tbody><tr><td colspan="3"><i>No further entries...</i></td></tr></tbody>';
return; return;
} }
var buf = '';
for (i in l) { for (i in l) {
if (l[i] == '') if (l[i] == '')
@ -230,34 +246,45 @@
priority = 6; priority = 6;
if (priority <= 3) if (priority <= 3)
clazz = "log-error"; clazz = "message-error";
else if (priority <= 5) else if (priority <= 5)
clazz = "log-highlight"; clazz = "message-highlight";
else else
clazz = "log-normal"; clazz = "message";
var line = '<div class="' + clazz + '">'; buf += '<tr><td class="timestamp">';
if (d.__REALTIME_TIMESTAMP != undefined) {
var timestamp = new Date(parseInt(d.__REALTIME_TIMESTAMP) / 1000);
buf += timestamp.toLocaleString();
}
buf += '</td><td class="process">';
if (d.SYSLOG_IDENTIFIER != undefined) if (d.SYSLOG_IDENTIFIER != undefined)
line += d.SYSLOG_IDENTIFIER; buf += d.SYSLOG_IDENTIFIER;
else if (d._COMM != undefined) else if (d._COMM != undefined)
line += d._COMM; buf += d._COMM;
if (d._PID != undefined) if (d._PID != undefined)
line += "[" + d._PID + "]"; buf += "[" + d._PID + "]";
else if (d.SYSLOG_PID != undefined) else if (d.SYSLOG_PID != undefined)
line += "[" + d.SYSLOG_PID + "]"; buf += "[" + d.SYSLOG_PID + "]";
buf += '</td><td class="' + clazz + '">';
if (d.MESSAGE == null) if (d.MESSAGE == null)
line += ": [blob data]</div>"; buf += "[blob data]";
else if (d.MESSAGE instanceof Array) else if (d.MESSAGE instanceof Array)
line += ": [" + formatBytes(d.MESSAGE.length) + " blob data]</div>"; buf += "[" + formatBytes(d.MESSAGE.length) + " blob data]";
else else
line += ": " + d.MESSAGE + "</div>"; buf += d.MESSAGE;
logs.innerHTML += line; buf += '</td></tr>';
} }
logs.innerHTML = buf + '</tbody>';
if (fc != null) if (fc != null)
first_cursor = fc; first_cursor = fc;
if (lc != null) if (lc != null)