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 = "

Data

"; data = JSON.parse(data); elm.innerHTML += recursive_details("", data); } + $("[data-previous").prop("disabled", $(element).prev().length == 0); + $("[data-next").prop("disabled", $(element).next().length == 0); + $modal.modal({}) - }) + } function recursive_details(s, data, lev=0) { for(var k in data) { diff --git a/view/theme/frio/templates/admin/logs/view.tpl b/view/theme/frio/templates/admin/logs/view.tpl index 99a96befd5..1bc0269160 100755 --- a/view/theme/frio/templates/admin/logs/view.tpl +++ b/view/theme/frio/templates/admin/logs/view.tpl @@ -6,13 +6,54 @@

{{$error nofilter}}

- {{else}} + {{else}} +
+
+ +
+
+ Show all +
+
+ - - + + @@ -28,14 +69,14 @@ {{elseif $row->level == "NOTICE"}}bg-info {{elseif $row->level == "DEBUG"}}text-muted {{/if}} - ">{{$row->level}} + ">{{$row->level}} {{/foreach}}
DateLevelContext + + + + + + Message
{{$row->context}} {{$row->message}}
- {{/if}} + {{/if}}