summaryrefslogtreecommitdiff
path: root/contrib/dashboard.js
diff options
context:
space:
mode:
authorLars-Dominik Braun <lars@6xq.net>2019-05-24 17:12:44 +0300
committerLars-Dominik Braun <lars@6xq.net>2019-05-24 17:16:14 +0300
commit94590852e026ebb39dba93972da6ccf18f547a83 (patch)
tree40c745e6db35b5b87f182c565cda1a2f8c42c8f3 /contrib/dashboard.js
parentcbaebbca928836cdd6ecf57a9f25e60d2bc52f42 (diff)
downloadcrocoite-94590852e026ebb39dba93972da6ccf18f547a83.tar.gz
crocoite-94590852e026ebb39dba93972da6ccf18f547a83.tar.bz2
crocoite-94590852e026ebb39dba93972da6ccf18f547a83.zip
dashboard: Add global bot stats
Diffstat (limited to 'contrib/dashboard.js')
-rw-r--r--contrib/dashboard.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/contrib/dashboard.js b/contrib/dashboard.js
index eb34d43..e07f8e3 100644
--- a/contrib/dashboard.js
+++ b/contrib/dashboard.js
@@ -1,5 +1,5 @@
/* configuration */
-let socket = "ws://localhost:6789/",
+let socket = "wss://localhost:6789/",
urllogMax = 100;
function formatSize (bytes) {
@@ -117,6 +117,21 @@ Vue.component('filesize', {
template: '<span class="filesize">{{ fvalue }}</span>',
computed: { fvalue: function () { return formatSize (this.value); } }
});
+Vue.component('bot-status', {
+ props: ['jobs'],
+ template: '<nav class="level"><div class="level-item has-text-centered"><div><p class="heading">Pending</p><p class="title">{{ stats.pending }}</p></div></div><div class="level-item has-text-centered"><div><p class="heading">Running</p><p class="title">{{ stats.running }}</p></div></div><div class="level-item has-text-centered"><div><p class="heading">Finished</p><p class="title">{{ stats.finished+stats.aborted }}</p></div></div><div class="level-item has-text-centered"><div><p class="heading">Transferred</p><p class="title"><filesize v-bind:value="stats.totalBytes"></filesize></p></div></div></nav>',
+ computed: {
+ stats: function () {
+ let s = {pending: 0, running: 0, finished: 0, aborted: 0, totalBytes: 0};
+ for (let k in this.jobs) {
+ let j = this.jobs[k];
+ s[j.status]++;
+ s.totalBytes += j.stats.bytesRcv;
+ }
+ return s;
+ }
+ }
+});
let app = new Vue({
el: '#app',