From 94590852e026ebb39dba93972da6ccf18f547a83 Mon Sep 17 00:00:00 2001 From: Lars-Dominik Braun Date: Fri, 24 May 2019 17:12:44 +0300 Subject: dashboard: Add global bot stats --- contrib/dashboard.html | 3 ++- contrib/dashboard.js | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 2 deletions(-) (limited to 'contrib') diff --git a/contrib/dashboard.html b/contrib/dashboard.html index cc09d50..4468786 100644 --- a/contrib/dashboard.html +++ b/contrib/dashboard.html @@ -4,7 +4,7 @@ chromebot dashboard - + @@ -13,6 +13,7 @@

chromebot dashboard

+
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: '{{ fvalue }}', computed: { fvalue: function () { return formatSize (this.value); } } }); +Vue.component('bot-status', { + props: ['jobs'], + template: '', + 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', -- cgit v1.2.3