admin ui fixes

This commit is contained in:
2020-05-25 18:09:29 +02:00
parent 5b6addfccb
commit 4bb9ac7285
2 changed files with 6 additions and 11 deletions

View File

@@ -83,11 +83,7 @@ DirectoryElement.prototype.addFile = function(icon, name, href, type, size, size
} }
DirectoryElement.prototype.renderFiles = function() { DirectoryElement.prototype.renderFiles = function() {
this.visibleFiles = [] this.search(this.lastSearchTerm)
for (let i in this.allFiles) {
this.visibleFiles.push(i)
}
this.sortBy("")
} }
// search filters the allFiles array on a search term. All files which match the // search filters the allFiles array on a search term. All files which match the
@@ -129,7 +125,7 @@ DirectoryElement.prototype.sortBy = function(field) {
this.currentSortAscending = true this.currentSortAscending = true
this.currentSortField = field this.currentSortField = field
} else if (this.currentSortField === field) { } else if (this.currentSortField === field) {
// If it is the same field as before re reverse the sort order // If it is the same field as before we reverse the sort order
this.currentSortAscending = !this.currentSortAscending this.currentSortAscending = !this.currentSortAscending
} }
} }

View File

@@ -150,15 +150,13 @@
<thead> <thead>
<tr> <tr>
<td onclick="getStats('query_name')">Query</td> <td onclick="getStats('query_name')">Query</td>
<td onclick="getStats('events')">Events</td> <td onclick="getStats('calls')">Calls</td>
<td onclick="getStats('average_duration')">Average Duration</td> <td onclick="getStats('average_duration')">Average Duration</td>
<td onclick="getStats('total_duration')">Total Duration</td> <td onclick="getStats('total_duration')">Total Duration</td>
<td>Callers</td> <td>Callers</td>
</tr> </tr>
</thead> </thead>
<tbody id="tstat_body"> <tbody id="tstat_body"></tbody>
</tbody>
</table> </table>
<script> <script>
function getStats(order) { function getStats(order) {
@@ -180,6 +178,7 @@
resp.query_statistics.forEach((v) => { resp.query_statistics.forEach((v) => {
let callers = "" let callers = ""
v.callers.sort((a, b) => b.count - a.count)
v.callers.forEach((v1) => { v.callers.forEach((v1) => {
callers += `${v1.count}x ${v1.name}<br/>` callers += `${v1.count}x ${v1.name}<br/>`
}) })
@@ -187,7 +186,7 @@
let row = document.createElement("tr") let row = document.createElement("tr")
row.innerHTML = `\ row.innerHTML = `\
<td>${v.query_name}</td> <td>${v.query_name}</td>
<td>${v.events}</td> <td>${v.calls}</td>
<td>${v.average_duration}ms</td> <td>${v.average_duration}ms</td>
<td>${v.total_duration}ms</td> <td>${v.total_duration}ms</td>
<td>${callers}</td>` <td>${callers}</td>`