diff --git a/view/theme/frio/js/module/admin/logs/view.js b/view/theme/frio/js/module/admin/logs/view.js index fc19af28a2..149d019e90 100644 --- a/view/theme/frio/js/module/admin/logs/view.js +++ b/view/theme/frio/js/module/admin/logs/view.js @@ -1,10 +1,51 @@ $(function(){ - $(".log-event").on("click", function(ev) { - var $modal = $("#logdetail"); - var tr = $modal.find(".main-data tbody tr")[0]; - tr.innerHTML = ev.currentTarget.innerHTML; - var data = JSON.parse(ev.currentTarget.dataset.source); + /* column filter */ + $("a[data-filter]").on("click", function(ev) { + var filter = this.dataset.filter; + var value = this.dataset.filterValue; + var re = RegExp(filter+"=[a-z]*"); + var newhref = location.href; + if (!location.href.indexOf("?") < 0) { + newhref = location.href + "?" + filter + "=" + value; + } else if (location.href.match(re)) { + newhref = location.href.replace(RegExp(filter+"=[a-z]*"), filter+"="+value); + } else { + newhref = location.href + "&" + filter + "=" + value; + } + location.href = newhref; + return false; + }); + + /* log details dialog */ + $(".log-event").on("click", function(ev) { + show_details_for_element(ev.currentTarget); + }); + + $("[data-previous").on("click", function(ev){ + var currentid = document.getElementById("logdetail").dataset.rowId; + var $elm = $("#" + currentid).prev(); + if ($elm.length == 0) return; + show_details_for_element($elm[0]); + }); + + $("[data-next").on("click", function(ev){ + var currentid = document.getElementById("logdetail").dataset.rowId; + var $elm = $("#" + currentid).next(); + if ($elm.length == 0) return; + show_details_for_element($elm[0]); + }); + + + function show_details_for_element(element) { + var $modal = $("#logdetail"); + + $modal[0].dataset.rowId = element.id; + + var tr = $modal.find(".main-data tbody tr")[0]; + tr.innerHTML = element.innerHTML; + + var data = JSON.parse(element.dataset.source); $modal.find(".source-data td").each(function(i,elm){ var k = elm.dataset.value; elm.innerText = data[k]; @@ -12,15 +53,18 @@ $(function(){ var elm = $modal.find(".event-data")[0]; elm.innerHTML = ""; - var data = ev.currentTarget.dataset.data; + var data = element.dataset.data; if (data !== "") { elm.innerHTML = "
{{$error nofilter}}
Date | -Level | -Context | ++ + Level {{if $filters.level}}({{$filters.level}}){{/if}} + + + | ++ + Context {{if $filters.context}}({{$filters.context}}){{/if}} + + + | Message | {{$row->context}} | {{$row->message}} | {{/foreach}}
---|