aboutsummaryrefslogtreecommitdiff
path: root/src/html
diff options
context:
space:
mode:
authorMark Powers <markppowers0@gmail.com>2019-02-04 17:27:00 -0500
committerMark Powers <markppowers0@gmail.com>2019-02-04 17:27:00 -0500
commitf4b2eabe2da89abc33e4cbe21ca1560995b32eca (patch)
treed66bf7178aadf040aff19f2e57f5300780157458 /src/html
parentcf0a680fd9dc07ac7b2d95d1cd2bbca5431d4ab6 (diff)
Add log viewer in admin panel
Diffstat (limited to 'src/html')
-rw-r--r--src/html/admin.html41
-rw-r--r--[-rwxr-xr-x]src/html/snake.html0
2 files changed, 41 insertions, 0 deletions
diff --git a/src/html/admin.html b/src/html/admin.html
index d0d2e81..1ec7e15 100644
--- a/src/html/admin.html
+++ b/src/html/admin.html
@@ -7,6 +7,24 @@
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="stylesheet" type="text/css" href="/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="/css/styles.css">
+ <script src="https://cdn.jsdelivr.net/npm/vue"></script>
+ <!-- <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> -->
+ <script>
+ window.onload = function () {
+ var feed = new Vue({
+ el: '#stats',
+ data: {
+ stats: {ip: [], url: []},
+ showIpTable: true,
+ showUrlTable: true,
+ },
+ created() {
+ fetch(new Request('/admin/stats')).then(response => response.json())
+ .then(response => this.stats = response);
+ }
+ });
+ }
+ </script>
</head>
<body>
@@ -31,6 +49,29 @@
</form>
</div>
</div>
+ <div id="stats">
+ <h1>Stats</h1>
+ <div>
+ <input type="checkbox" id="showIp" v-model="showIpTable">
+ <label for="showIp">Show IP Stats</label>
+ </div>
+ <table class="table ip-table" v-if="showIpTable">
+ <tr><th>Host</th><th>Total Requests</th></tr>
+ <tr v-for="item in stats.ip">
+ <td>{{item.ip}}</td><td>{{item.c}}</td>
+ </tr>
+ </table>
+ <div>
+ <input type="checkbox" id="showUrl" v-model="showUrlTable">
+ <label for="showUrl">Show URL Stats</label>
+ </div>
+ <table class="table url-table" v-if="showUrlTable">
+ <tr><th>Method</th><th>Path</th><th>Total Requests</th></tr>
+ <tr v-for="item in stats.url">
+ <td>{{item.method}}</td><td>{{item.url}}</td><td>{{item.c}}</td>
+ </tr>
+ </table>
+ </div>
</body>
</html> \ No newline at end of file
diff --git a/src/html/snake.html b/src/html/snake.html
index e2158e5..e2158e5 100755..100644
--- a/src/html/snake.html
+++ b/src/html/snake.html