Commit 2daaed68 authored by Heinz N. Gies's avatar Heinz N. Gies

Improve display

parent 9693a4a7
...@@ -38,7 +38,7 @@ ...@@ -38,7 +38,7 @@
<form id="queryfrom" action="/events" method="get"> <form id="queryfrom" action="/events" method="get">
<div class="row"> <div class="row">
<div class="large-4 columns"> <div class="large-4 columns">
<input type="text" id="bucket" name="bucket" value="" placeholder="Bucket"/> <input type="text" id="bucket" name="bucket" value="" placeholderb="Bucket"/>
</div> </div>
<div class="large-4 columns"> <div class="large-4 columns">
<input type="text" id="start" name="start" value="" placeholder="Start date"/> <input type="text" id="start" name="start" value="" placeholder="Start date"/>
...@@ -47,7 +47,6 @@ ...@@ -47,7 +47,6 @@
<input type="text" id="end" name="end" value="" placeholder="End date"/> <input type="text" id="end" name="end" value="" placeholder="End date"/>
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<div class="large-10 columns"> <div class="large-10 columns">
<input type="text" id="filter" name="filter" value="" placeholder="Filter"/> <input type="text" id="filter" name="filter" value="" placeholder="Filter"/>
...@@ -57,6 +56,11 @@ ...@@ -57,6 +56,11 @@
</div> </div>
</div> </div>
</form> </form>
<div class="row">
<div class="large-12 columns">
Returned <span id="count"></span> events in <span id="time"></span>.
</div>
</div>
<div class="row"> <div class="row">
<div class="large-12 columns"> <div class="large-12 columns">
<table> <table>
......
...@@ -16,10 +16,15 @@ $(function() { ...@@ -16,10 +16,15 @@ $(function() {
msgpack.download( msgpack.download(
"", {header: {accept:"application/x-msgpack"}}, "", {header: {accept:"application/x-msgpack"}},
function(d) { function(d) {
d.forEach(function(e) { $("#time").text((d.t / 1000) + "ms");
$("#count").text(d.e.length);
d.e.forEach(function(e) {
var date = new Date(e.timestamp/1000/1000); var date = new Date(e.timestamp/1000/1000);
$("#events").append("<tr><td>" + date + var row = "<tr>" +
"</td><td>" + JSON.stringify(e.event) + "</td></tr>") "<td>" + date + "</td>" +
"<td><pre>" + JSON.stringify(e.event, null, 2) + "</pre></td>" + +
"</tr>";
$("#events").append(row)
}) })
}) })
}) })
...@@ -52,9 +52,14 @@ handle(Req, State) -> ...@@ -52,9 +52,14 @@ handle(Req, State) ->
Start = erlang:convert_time_unit(StartSec, seconds, nano_seconds), Start = erlang:convert_time_unit(StartSec, seconds, nano_seconds),
EndSec = qdate:to_unixtime(EndS), EndSec = qdate:to_unixtime(EndS),
End = erlang:convert_time_unit(EndSec, seconds, nano_seconds), End = erlang:convert_time_unit(EndSec, seconds, nano_seconds),
{ok, Es} = ddb_connection:read_events(Bucket, Start, End, Filter), {QT, {ok, Es}} =
Es1 = [[{<<"timestamp">>, T}, {<<"event">>, E}] || timer:tc(ddb_connection, read_events,
{T, E} <- Es], [Bucket, Start, End, Filter]),
Es1 = #{
t => QT,
e => [#{timestamp => T, event => E} ||
{T, E} <- Es]
},
dalmatiner_idx_handler:send(ContentType, Es1, Req4, State) dalmatiner_idx_handler:send(ContentType, Es1, Req4, State)
end. end.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment