2023-05-06 21:53:43 +01:00
|
|
|
init()
|
2023-02-09 20:29:07 +00:00
|
|
|
|
2023-05-06 21:53:43 +01:00
|
|
|
async function init() { // The page init function
|
|
|
|
versionDisplay()
|
2023-05-23 12:03:48 +01:00
|
|
|
await display(await get())
|
|
|
|
hideLoading()
|
2023-02-09 20:29:07 +00:00
|
|
|
}
|
|
|
|
|
2023-05-06 21:53:43 +01:00
|
|
|
async function get() { // Fetch data from API
|
2023-07-01 22:17:07 +01:00
|
|
|
var url = `${apiEndpoint}/api/v1/stats`
|
2023-05-06 21:53:43 +01:00
|
|
|
var resp = await fetch(url)
|
|
|
|
return await resp.json()
|
2023-02-09 20:29:07 +00:00
|
|
|
}
|
|
|
|
|
2023-05-06 21:53:43 +01:00
|
|
|
async function display(data) { // Parses and displays data from API
|
|
|
|
document.getElementById('server_host').textContent = data.host
|
|
|
|
document.getElementById('server_mode').textContent = data.mode || 'Unknown'
|
|
|
|
document.getElementById('ver-bkend').textContent = data.verBkend || 'Unknown'
|
|
|
|
let dat = data.dat[0]
|
|
|
|
let ver = data.ver[0]
|
|
|
|
document.getElementById('time').textContent = await convertUnixLocal(dat.since)
|
|
|
|
document.getElementById('ldbws').textContent = dat.ldbws || '0'
|
|
|
|
document.getElementById('ldbsvws').textContent = dat.ldbsvws || '0'
|
2023-05-23 12:03:48 +01:00
|
|
|
document.getElementById('corpus_api').textContent = dat.corpus_api || '0'
|
2023-05-06 21:53:43 +01:00
|
|
|
document.getElementById('corpus').textContent = dat.corpus || '0'
|
|
|
|
document.getElementById('stations').textContent = dat.stations || '0'
|
2023-05-23 23:52:55 +01:00
|
|
|
document.getElementById('users').textContent = dat.users || '0'
|
2023-05-06 21:53:43 +01:00
|
|
|
document.getElementById('meta').textContent = dat.meta || '0'
|
2023-05-24 09:33:37 +01:00
|
|
|
document.getElementById('pis').textContent = dat.pis || '0'
|
|
|
|
document.getElementById('timetable_count').textContent = data.count.timetable || '0'
|
2023-05-06 21:53:43 +01:00
|
|
|
document.getElementById('ver-dbman').textContent = ver.dbmanager || 'Unknown'
|
2023-05-07 21:18:04 +01:00
|
|
|
document.getElementById('user_count').textContent = data.count.users || 'Unknown'
|
|
|
|
document.getElementById('reg_count').textContent = data.count.reg || '0'
|
|
|
|
document.getElementById('pis_count').textContent = data.count.pis || 'Unknown'
|
|
|
|
document.getElementById('corpus_count').textContent = data.count.corpus || 'Unknown'
|
|
|
|
document.getElementById('stations_count').textContent = data.count.stations || 'Unknown'
|
2023-02-09 20:29:07 +00:00
|
|
|
}
|