Update stats display

This commit is contained in:
Fred Boniface 2023-05-23 12:03:48 +01:00
parent 3e26bc5268
commit bdc2d83bd2
10 changed files with 92 additions and 121 deletions

View File

@ -43,7 +43,7 @@
</div>
<!-- Footer -->
<footer>
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - <span id="ver_str"></span></p>
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - <a href="./stats.html"><span id="ver_str">???</span></a></p>
</footer>
</body>
</html>

View File

@ -66,7 +66,7 @@
</div>
<!-- Footer -->
<footer>
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - <span id="ver_str"></span></p>
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - <a href="./stats.html"><span id="ver_str">???</span></a></p>
</footer>
</body>
</html>

View File

@ -1,6 +1,6 @@
/* eslint-disable no-unused-vars */
/* All Page Init */
const version = '2023.5.3'
const version = '2023.5.4'
/* Feature Detectors */

View File

@ -2,7 +2,8 @@ init()
async function init() { // The page init function
versionDisplay()
display(await get())
await display(await get())
hideLoading()
}
async function get() { // Fetch data from API
@ -20,7 +21,7 @@ async function display(data) { // Parses and displays data from API
document.getElementById('time').textContent = await convertUnixLocal(dat.since)
document.getElementById('ldbws').textContent = dat.ldbws || '0'
document.getElementById('ldbsvws').textContent = dat.ldbsvws || '0'
document.getElementById('apicorpus').textContent = dat.corpus_api || '0'
document.getElementById('corpus_api').textContent = dat.corpus_api || '0'
document.getElementById('corpus').textContent = dat.corpus || '0'
document.getElementById('stations').textContent = dat.stations || '0'
document.getElementById('users').textContent = dat.user || '0'

View File

@ -71,7 +71,7 @@
<button type="reset" id="reset" class="lookup-button" onclick="reset()">Reset</button>
<!-- Footer -->
<footer>
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - <span id="ver_str"></span></p>
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - <a href="./stats.html"><span id="ver_str">???</span></a></p>
</footer>
</body>
</html>

View File

@ -37,8 +37,8 @@
<div id="top_button" class="hide_micro">
<a href="/">
<picture class="sidebar_control">
<source srcset="/images/nav/back.svg" type="image/svg+xml">
<img aria-label="Home" src="back-40.png" alt="Home">
<source srcset="./images/nav/back.svg" type="image/svg+xml">
<img aria-label="Home" src="./images/nav/back-40.png" alt="Home">
</picture>
</a>
</div>

112
stat.html
View File

@ -1,112 +0,0 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="robots" content="none">
<title>OwlBoard - Statistics</title>
<script src="./js/lib.main.js" defer></script>
<script src="./js/stat.js" defer></script>
</head>
<body style="text-align:center">
<h1>OwlBoard Server Stats</h1>
<h2>Data from: <span id="server_host"></span></h2>
<p>Server Mode: <span id="server_mode"></span></p>
<p>Counters Reset - <span id="time"></span></p>
<table style="margin:auto;text-align:center;">
<tr>
<th>Resource</th>
<th>Hit Count</th>
</tr>
<tr>
<td>Upstream API-LDBWS</td>
<td id="ldbws"></td>
</tr>
<tr>
<td>Upstream API-LDBSVWS</td>
<td id="ldbsvws"></td>
</tr>
<tr>
<td>Upstream API-CORPUS</td>
<td id="apicorpus"></td>
</tr>
<tr>
<td>DB-CORPUS</td>
<td id="corpus"></td>
</tr>
<tr>
<td>DB-stations</td>
<td id="stations"></td>
</tr>
<tr>
<td>DB-users</td>
<td id="users"></td>
</tr>
<tr>
<td>DB-meta</td>
<td id="meta"></td>
</tr>
<tr>
<td>DB-pis</td>
<td id="pis"></td>
</tr>
</table>
<table style="margin:auto;text-align:center;">
<tr>
<th>Database</th>
<th>Entry Count</th>
</tr>
<tr>
<td>Users</td>
<td id="user_count"></td>
</tr>
<tr>
<td>Pending Registrations</td>
<td id="reg_count"></td>
</tr>
<tr>
<td>PIS Codes</td>
<td id="pis_count"></td>
</tr>
<tr>
<td>CORPUS Entries</td>
<td id="corpus_count"></td>
</tr>
<tr>
<td>Station Codes</td>
<td id="stations_count"></td>
</tr>
</table>
<br><br>
<table style="margin:auto;text-align:center;">
<tr>
<th>Software</th>
<th>Version</th>
</tr>
<tr>
<td>
<a href="https://git.fjla.uk/OwlBoard/backend">
backend
</a>
</td>
<td id="ver-bkend"></td>
</tr>
<tr>
<td>
<a href="https://git.fjla.uk/OwlBoard/db-manager">
db-manager
</a>
</td>
<td id="ver-dbman"></td>
</tr>
<tr>
<td>
<a href="https://git.fjla.uk/OwlBoard/web">
web-frontend
</a>
</td>
<td id="ver_str">Unknown</td>
</tr>
</table>
<p>The statistics represent hits &amp; queries from all instances in the stack.</p>
</body>
</html>

74
stats.html Normal file
View File

@ -0,0 +1,74 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="description" content="OwlBoard - Personalise your OwlBoard.">
<meta name="robots" content="noindex">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="application-name" content="OwlBoard">
<meta name="author" content="Frederick Boniface">
<meta name="theme-color" content="#00b7b7">
<link rel="apple-touch-icon" href="/images/app-icons/any/apple-192.png">
<link rel="stylesheet" type="text/css" href="./styles/main.css">
<link rel="stylesheet" type="text/css" href="./styles/stats.css">
<link rel="icon" type="image/svg+xml" href="./images/icon.svg">
<link rel="manifest" type="application/json" href="./manifest.json">
<title>OwlBoard - Statistics</title>
<script src="./js/lib.main.js" defer></script>
<script src="./js/stats.js" defer></script>
</head>
<body>
<div id="loading">
<div class="spinner">
</div>
<p>Loading</p>
</div>
<div id="top_button" class="hide_micro">
<a href="/">
<picture class="sidebar_control">
<source srcset="./images/nav/back.svg" type="image/svg+xml">
<img aria-label="Home" src="./images/nav/back-40.png" alt="Home">
</picture>
</a>
</div>
<picture>
<source srcset="./images/logo/wide_logo.svg" type="image/svg+xml">
<source media="(max-height: 739px)" srcset="/images/logo/logo-full-200.png" type="image/png">
<source srcset="./images/logo/logo-full-250.png" type="image/png">
<img class="titleimg" src="./images/logo/logo-full-250.png" alt="OwlBoard Logo">
</picture>
<h2>Statistics</h2>
<p class="stat_desc">Server hostname: <span class="stat_result" id="server_host"></span><br>
Runtime Mode: <span class="stat_result" id="server_mode"></span><br>
Statistics Reset: <span class="stat_result" id="time"></span>
</p>
<h3>Component Versions</h3>
<p class="stat_desc">OwlBoard Web: <span class="stat_result" id="ver_str"></span><br>
OwlBoard Backend: <span class="stat_result" id="ver-bkend"></span><br>
OwlBoard DBManager: <span class="stat_result" id="ver-dbman"></span>
</p>
<h3>Usage Statistics</h3>
<p class="stat_desc">Public Board Lookups: <span class="stat_result" id="ldbws"></span><br>
Staff Board Lookups: <span class="stat_result" id="ldbsvws"></span><br>
CORPUS Data Refreshes: <span class="stat_result" id="corpus_api"></span><br>
COSPUS Lookups: <span class="stat_result" id="corpus"></span><br>
Station code Lookups: <span class="stat_result" id="stations"></span><br>
PIS Lookups: <span class="stat_result" id="pis"></span><br>
User Lookups: <span class="stat_result" id="users"></span><br>
Meta Lookups: <span class="stat_result" id="meta"></span>
</p>
<h3>Counts</h3>
<p class="stat_desc">Registered Users: <span class="stat_result" id="user_count"></span><br>
Pending Registrations: <span class="stat_result" id="reg_count"></span><br>
Available PIS Codes: <span class="stat_result" id="pis_count"></span><br>
Available CORPUS Entries: <span class="stat_result" id="corpus_count"></span><br>
Available Station Entries: <span class="stat_result" id="stations_count"></span></p>
<!-- Footer -->
<footer>
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a></p>
</footer>
</body>
</html>

8
styles/stats.css Normal file
View File

@ -0,0 +1,8 @@
.stat_desc {
color: var(--second-text-color);
}
.stat_result {
font-weight: bold;
color: var(--second-text-color);
}

2
sw.js
View File

@ -1,6 +1,6 @@
/* Service Worker */
const swVersion = '2023.5.3-002'
const swVersion = '2023.5.4-001'
const cacheName = `owlboard-${swVersion}`
const cacheIDs = [cacheName]
let staticCache = [