From c6511e859c35b12de4e6fb5f58d7258d9de3b8f2 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 10 Oct 2012 22:39:45 +0200 Subject: journal: when browsing the journal via browse.html allow clicking on entries to show their details --- src/journal/browse.html | 77 ++++++++++++++++++++++++++++++++++++++++++++----- 1 file changed, 69 insertions(+), 8 deletions(-) (limited to 'src/journal/browse.html') diff --git a/src/journal/browse.html b/src/journal/browse.html index 5ceca26a5d..068b296da1 100644 --- a/src/journal/browse.html +++ b/src/journal/browse.html @@ -4,7 +4,7 @@ Journal @@ -65,6 +95,8 @@
+ +
@@ -271,7 +303,7 @@ else if (d.SYSLOG_PID != undefined) buf += "[" + d.SYSLOG_PID + "]"; - buf += ''; + buf += ''; if (d.MESSAGE == null) buf += "[blob data]"; @@ -280,10 +312,10 @@ else buf += d.MESSAGE; - buf += ''; + buf += ''; } - logs.innerHTML = buf + ''; + logs.innerHTML = '' + buf + ''; if (fc != null) first_cursor = fc; @@ -293,12 +325,41 @@ function entriesMore() { setNEntries(getNEntries() + 10); - entriesLoad(""); + entriesLoad(first_cursor); } function entriesLess() { setNEntries(getNEntries() - 10); - entriesLoad(""); + entriesLoad(first_cursor); + } + + function onResultMessageClick(event) { + if ((event.currentTarget.readyState != 4) || + (event.currentTarget.status != 200 && event.currentTarget.status != 0)) + return; + + var d = JSON.parse(event.currentTarget.responseText); + + document.getElementById("diventry").style.display = "block"; + + entry = document.getElementById("tableentry"); + + var buf = ""; + + for (var key in d){ + buf += '' + key + '' + d[key] + ''; + } + + entry.innerHTML = '' + buf + ''; + } + + function onMessageClick(t) { + var request = new XMLHttpRequest(); + request.open("GET", "/entries?discrete"); + request.onreadystatechange = onResultMessageClick; + request.setRequestHeader("Accept", "application/json"); + request.setRequestHeader("Range", "entries=" + t + ":0:1"); + request.send(null); } machineLoad(); -- cgit v1.2.3-54-g00ecf