Skip to content

Commit 001df67

Browse files
committed
stats: module shortnames in table
update htmx
1 parent e3b1b30 commit 001df67

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

pgs/stats.php

+14-4
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,31 @@
4949
</table>
5050
</div>
5151
</div>
52-
<script src="https://unpkg.com/[email protected].11/dist/htmx.js"
53-
integrity="sha384-l9bYT9SL4CAW0Hl7pAOpfRc18mys1b0wK4U8UtGnWOxPVbVMgrOdB+jyz/WY8Jue"
52+
<script src="https://unpkg.com/[email protected].12"
53+
integrity="sha384-ujb1lZYygJmzgSwoxRggbCHcjc0rB2XoQrxeTUQyRjrOnlCoYta87iKBWq3EsdM2"
5454
crossorigin="anonymous"></script>
5555
<script>
56+
<?php
57+
echo " let mNames = " . json_encode($PageOptions['ShortNames']) . ";\n";
58+
?>
5659
clearTimeout(PageRefresh);
5760
graphModules();
5861

5962
function graphModules() {
60-
6163
let canvas = document.getElementById('mgraph');
64+
if (!canvas) {
65+
return;
66+
}
6267
let labels = [];
6368
let data = [];
6469
let tbody = document.getElementById('modules').querySelector('tbody');
6570
for (let i = 0; i < tbody.rows.length; i++) {
66-
labels.push(tbody.rows[i].cells[0].textContent);
71+
let m = tbody.rows[i].cells[0].textContent;
72+
let n = mNames[m].trim();
73+
if (n) {
74+
tbody.rows[i].cells[0].textContent = `${m}: ${n}`;
75+
}
76+
labels.push(m);
6777
data.push(parseInt(tbody.rows[i].cells[1].textContent, 10));
6878
}
6979
new Chart(canvas, {

0 commit comments

Comments
 (0)