refactor: move analytics into services directory

This commit is contained in:
Justin Lin committed 2025-05-05 19:55:40 +08:00
1 parent e43cbe26ce
commit 740cbcecb4
31 files changed
+6 -5

No files matched your search

@@ -0,0 +1,37 @@
<h1 class='heading'>Commands</h1>
<div>
<h2 class='heading'>Error commands</h2>
<div class='sort'>
<a href='/commands?order=asc'><div class='btn'>
<h3>Ascending</h3>
</div></a>
<a href='/commands?order=desc'><div class='btn'>
<h3>Descending</h3>
</div></a>
</div>
<table class='data-table'>
<tr>
<th>Command</th>
<th>User</th>
<th>Quest</th>
<th>Session</th>
<th>Error</th>
<th>Created At</th>
</tr>
{{#each errorCommands}}
<tr>
<td>{{command}}</td>
<td>{{user}}</td>
<td>{{quest}}</td>
<td><a href='/sessions/{{session}}'>Detail</a></td>
<td>{{error}}</td>
<td>{{createdAt}}</td>
</tr>
{{/each}}
</table>
<div class='pagination sort'>
<a href='/commands?nextKey={{nextKey}}&order={{order}}'><div class='btn'>
<h3>Next</h3>
</div></a>
</div>
</div>
+27
View File
@@ -0,0 +1,27 @@
<body>
<div class='title'>
<img src='icon_totem.svg' class='styled-image' />
<h1>Welcome to {{title}}</h1>
</div>
<div class='container'>
<h2 class='heading'>Overview</h2>
<table class='data-table'>
<tr>
<th>Registered Users</th>
<td>{{userCount}}</td>
</tr>
<tr>
<th>Total Started Quests</th>
<td>{{totalQuests}}</td>
</tr>
<tr>
<th>Completed Quests</th>
<td>{{totalCompleted}}</td>
</tr>
<tr>
<th>Completed Rate</th>
<td>{{completedRate}}%</td>
</tr>
</table>
</div>
</body>
@@ -0,0 +1,16 @@
<html>
<head>
<title>{{title}}</title>
<link rel='stylesheet' href='/css/style.css' />
</head>
<body>
<nav class='nav'>
<div><a href='/'>Home</a></div>
<div><a href='/users'>Users</a></div>
<div><a href='/quests'>Quests</a></div>
<div><a href='/commands'>Commands</a></div>
<div><a href='/sessions'>Sessions</a></div>
</nav>
{{{body}}}
</body>
</html>
@@ -0,0 +1,20 @@
<h1 class='heading'>Quests</h1>
<div>
<table class='data-table'>
<tr>
<th>Id</th>
<th>Started</th>
<th>Completed</th>
<th>Failed</th>
<th>Completed Rate</th>
</tr>
{{#each quests}}
<tr>
<td>{{_id}}</td>
<td>{{started}}</td>
<td>{{completed}}</td>
<td>{{failed}}</td>
<td>{{completedRate}} %</td>
</tr>
{{/each}}
</table>
@@ -0,0 +1,58 @@
{{#with session}}<h1 class='heading'>Session {{_id}}</h1>
<div>
<table class='data-table'>
<tr>
<th>Quest</th>
<td>{{quest}}</td>
</tr>
<tr>
<th>User</th>
<td>{{user}}</td>
</tr>
<tr>
<th>Status</th>
<td>{{status}}</td>
</tr>
<tr>
<th>Created At</th>
<td>{{createdAt}}</td>
</tr>
<tr>
<th>Finished At</th>
<td>{{finishedAt}}</td>
</tr>
<tr>
<th>Used Time</th>
<td>{{usedTime}}</td>
</tr>
<tr>
<th>Command Count</th>
<td>{{commands.length}}</td>
</tr>
</table>
<h2 class='heading'>Commands</h2>
<table class='data-table'>
<tr>
<th>Stage</th>
<th>PWD</th>
<th>Input</th>
<th>Output</th>
<th>Error</th>
<th>Input Time</th>
</tr>
{{#each commands}}
<tr>
<td>{{stage}}</td>
<td>{{pwd}}</td>
<td>{{command}}</td>
<td>{{output}}</td>
<td>{{error}}</td>
<td>{{createdAt}}</td>
</tr>
{{/each}}
</table>
</div>{{/with}}
@@ -0,0 +1,40 @@
<h1 class='heading'>Sessions</h1>
<div class='sort'>
<a href='/sessions?order=asc'><div class='btn'>
<h3>Ascending</h3>
</div></a>
<a href='/sessions?order=desc'><div class='btn'>
<h3>Descending</h3>
</div></a>
</div>
<div>
<table class='data-table'>
<tr>
<th>User</th>
<th>Quest</th>
<th>Status</th>
<th>Created At</th>
<th>Finished At</th>
<th>Used Time</th>
<th>Command Count</th>
<th>Session</th>
</tr>
{{#each sessions}}
<tr>
<td>{{user}}</td>
<td>{{quest}}</td>
<td>{{status}}</td>
<td>{{createdAt}}</td>
<td>{{finishedAt}}</td>
<td>{{usedTime}}</td>
<td>{{commandCount}}</td>
<td><a href='/sessions/{{_id}}'>Detail</a></td>
</tr>
{{/each}}
</table>
</div>
<div class='pagination sort'>
<a href='/sessions?nextKey={{nextKey}}&order={{order}}'><div class='btn'>
<h3>Next</h3>
</div></a>
</div>
+36
View File
@@ -0,0 +1,36 @@
<h1 class='heading'>Users List</h1>
<div class='sort'>
<a href='/users?order=asc'><div class='btn'>
<h3>Ascending</h3>
</div></a>
<a href='/users?order=desc'><div class='btn'>
<h3>Descending</h3>
</div></a>
</div>
<div>
<table class='data-table'>
<tr>
<th>Username</th>
<th>Last Activity</th>
<th>Sessions Count</th>
<th>Email</th>
<th>Registration Time</th>
<th>Registration Method</th>
</tr>
{{#each users}}
<tr>
<td><a href='/users/{{_id}}'>{{username}}</a></td>
<td>{{lastActivityAt}}</td>
<td>{{sessionCount}}</td>
<td>{{email}}</td>
<td>{{createdAt}}</td>
<td>{{method}}</td>
</tr>
{{/each}}
</table>
</div>
<div class='pagination sort'>
<a href='/users?nextKey={{nextKey}}&order={{order}}'><div class='btn'>
<h3>Next</h3>
</div></a>
</div>
@@ -0,0 +1,21 @@
<h1 class='heading'>{{user}}'s Sessions History</h1>
<div>
<table class='data-table'>
<tr>
<th>Quest</th>
<th>Status</th>
<th>Created At</th>
<th>Used Time</th>
<th>Session</th>
</tr>
{{#each sessions}}
<tr>
<td>{{quest}}</td>
<td>{{status}}</td>
<td>{{createdAt}}</td>
<td>{{usedTime}}</td>
<td><a href='/sessions/{{_id}}'>Detail</a></td>
</tr>
{{/each}}
</table>
</div>