diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2018-08-24 20:39:37 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2018-08-24 20:39:37 +0200 |
| commit | e02ac807a0ff5dd10cd97b56b2b5eb1ce69fd88d (patch) | |
| tree | fa36dbcedc87f4d41e3c2a18c7ac01f950fdc97d | |
| parent | 8ec5fc8d3c2c38c9e1f17ff6005b7b888705163d (diff) | |
dashboard/app: show recent crashes first after time sorting
| -rw-r--r-- | dashboard/app/bug.html | 2 | ||||
| -rw-r--r-- | dashboard/app/static/common.js | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/dashboard/app/bug.html b/dashboard/app/bug.html index 2cdfc8d78..056699fae 100644 --- a/dashboard/app/bug.html +++ b/dashboard/app/bug.html @@ -38,7 +38,7 @@ Page with details about a single bug. <caption>All crashes ({{.Bug.NumCrashes}}):</caption> <tr> <th><a onclick="return sortTable(this, 'Manager', textSort)" href="#">Manager</a></th> - <th><a onclick="return sortTable(this, 'Time', textSort)" href="#">Time</a></th> + <th><a onclick="return sortTable(this, 'Time', textSort, true)" href="#">Time</a></th> <th><a onclick="return sortTable(this, 'Kernel', textSort)" href="#">Kernel</a></th> <th><a onclick="return sortTable(this, 'Commit', textSort)" href="#">Commit</a></th> <th><a onclick="return sortTable(this, 'Syzkaller', textSort)" href="#">Syzkaller</a></th> diff --git a/dashboard/app/static/common.js b/dashboard/app/static/common.js index f2c2a8c4a..5a146f3bd 100644 --- a/dashboard/app/static/common.js +++ b/dashboard/app/static/common.js @@ -1,14 +1,17 @@ // Copyright 2018 syzkaller project authors. All rights reserved. // Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file. -function sortTable(item, colName, conv) { +function sortTable(item, colName, conv, desc = false) { table = item.parentNode.parentNode.parentNode; rows = table.getElementsByTagName("tr"); col = findColumnByName(rows[0].getElementsByTagName("th"), colName); values = new Array; for (i = 1; i < rows.length; i++) values[i] = conv(rows[i].getElementsByTagName("td")[col].textContent); - desc = isSorted(values); + if (desc) + desc = !isSorted(values.slice().reverse()) + else + desc = isSorted(values); do { changed = false; for (i = 1; i < values.length - 1; i++) { |
