show server diagnostics in client
This commit is contained in:
+16
-1
@@ -2,6 +2,7 @@
|
|||||||
let serverAddress = 'http://127.0.0.1:8787';
|
let serverAddress = 'http://127.0.0.1:8787';
|
||||||
let connectionState = 'OFFLINE';
|
let connectionState = 'OFFLINE';
|
||||||
let serverVersion = '—';
|
let serverVersion = '—';
|
||||||
|
let diagnostics: { status: string; database: string; twitch_identity_count: number; unseen_notification_count: number; realtime: string } | undefined;
|
||||||
let activeView = 'Live dashboard';
|
let activeView = 'Live dashboard';
|
||||||
let sessionToken = '';
|
let sessionToken = '';
|
||||||
let authenticated = false;
|
let authenticated = false;
|
||||||
@@ -92,6 +93,7 @@
|
|||||||
connectionState = 'CONNECTED';
|
connectionState = 'CONNECTED';
|
||||||
await loadActivity();
|
await loadActivity();
|
||||||
await loadNotifications();
|
await loadNotifications();
|
||||||
|
await loadDiagnostics();
|
||||||
await loadStreamInfo();
|
await loadStreamInfo();
|
||||||
connectRealtime();
|
connectRealtime();
|
||||||
if (!mustReplaceCredentials) password = '';
|
if (!mustReplaceCredentials) password = '';
|
||||||
@@ -141,6 +143,7 @@
|
|||||||
oauthLink = '';
|
oauthLink = '';
|
||||||
notifications = [];
|
notifications = [];
|
||||||
showNotifications = false;
|
showNotifications = false;
|
||||||
|
diagnostics = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
function connectRealtime() {
|
function connectRealtime() {
|
||||||
@@ -199,6 +202,18 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async function loadDiagnostics() {
|
||||||
|
try {
|
||||||
|
const response = await fetch(`${serverAddress}/api/v1/server/diagnostics`, {
|
||||||
|
headers: { authorization: `Bearer ${sessionToken}` },
|
||||||
|
});
|
||||||
|
if (!response.ok) return;
|
||||||
|
diagnostics = await response.json();
|
||||||
|
} catch {
|
||||||
|
diagnostics = undefined;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
async function markNotificationSeen(notificationId: string) {
|
async function markNotificationSeen(notificationId: string) {
|
||||||
const response = await fetch(`${serverAddress}/api/v1/admin/notifications/${notificationId}/seen`, {
|
const response = await fetch(`${serverAddress}/api/v1/admin/notifications/${notificationId}/seen`, {
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
@@ -412,7 +427,7 @@
|
|||||||
<div class="empty-row">Sign in as administrator to connect accounts.</div>
|
<div class="empty-row">Sign in as administrator to connect accounts.</div>
|
||||||
{/if}
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
<div class="side-section side-footer"><div class="micro">REALTIME</div><div class="mono">{realtimeState}</div><div class="micro version-label">SERVER VERSION</div><div class="mono">{serverVersion}</div></div>
|
<div class="side-section side-footer"><div class="micro">REALTIME</div><div class="mono">{realtimeState}</div>{#if diagnostics}<div class="micro version-label">DATABASE</div><div class="mono">{diagnostics.database.toUpperCase()}</div><div class="micro version-label">TWITCH IDENTITIES</div><div class="mono">{diagnostics.twitch_identity_count}</div>{/if}<div class="micro version-label">SERVER VERSION</div><div class="mono">{serverVersion}</div></div>
|
||||||
</aside>
|
</aside>
|
||||||
|
|
||||||
<section class="content-area">
|
<section class="content-area">
|
||||||
|
|||||||
Reference in New Issue
Block a user