1
0
Fork 0

Fix review points

- Fix headers hierarchy
- Improve accessibility:
 	- set mouse pointer
	- make rows focusable
	- open on key press
	- add tooltip with "title"
	- add role and aria attributes
- Rename `ParsedLog` to `ParsedLogLine`
- Add docs to `ReversedFileReader`'s implementation of `Iterator`'s methods
- Add docs to `ParsedLogIterator`'s implementation of `Iterator`'s methods
- Remove unnecessary comment
- Add more test for parsing log lines and fix some edge cases
- Fix function name in snake-case to camelCase
- Remove `DIRECTORY_SEPARATOR`
This commit is contained in:
fabrixxm 2021-08-20 09:47:53 +02:00
commit 7f695197aa
10 changed files with 280 additions and 54 deletions

View file

@ -98,6 +98,13 @@ details summary {
display: list-item;
}
/**
* clickable table rows
*/
.table > tbody > td[role="button"] {
cursor: pointer;
}
/**
* mobile aside
*/

View file

@ -21,6 +21,12 @@ $(function(){
$(".log-event").on("click", function(ev) {
show_details_for_element(ev.currentTarget);
});
$(".log-event").on("keydown", function(ev) {
if (ev.keyCode == 13 || ev.keyCode == 32) {
show_details_for_element(ev.currentTarget);
}
});
$("[data-previous").on("click", function(ev){
var currentid = document.getElementById("logdetail").dataset.rowId;
@ -37,9 +43,15 @@ $(function(){
});
function show_details_for_element(element) {
var $modal = $("#logdetail");
const $modal = $("#logdetail");
$modal.on("hidden.bs.modal", function(ev){
document
.querySelectorAll('[aria-expanded="true"]')
.forEach(elm => elm.setAttribute("aria-expanded", false))
});
function show_details_for_element(element) {
$modal[0].dataset.rowId = element.id;
var tr = $modal.find(".main-data tbody tr")[0];
@ -64,6 +76,7 @@ $(function(){
$("[data-next").prop("disabled", $(element).next().length == 0);
$modal.modal({})
element.setAttribute("aria-expanded", true);
}
function recursive_details(s, data, lev=0) {

View file

@ -1,7 +1,7 @@
<div id="adminpage">
<h1>{{$title}} - {{$page}}</h1>
<h3>{{$logname}}</h3>
<h2>{{$logname}}</h2>
{{if $error }}
<div id="admin-error-message-wrapper" class="alert alert-warning">
<p>{{$error nofilter}}</p>
@ -59,7 +59,9 @@
</thead>
<tbody>
{{foreach $data as $row}}
<tr id="ev-{{$row->id}}" class="log-event"
<tr id="ev-{{$row->id}}" class="log-event"
role="button" tabIndex="0"
aria-label="View details" aria-haspopup="true" aria-expanded="false"
data-data="{{$row->data}}" data-source="{{$row->source}}">
<td>{{$row->date}}</td>
<td class="