diff options
Diffstat (limited to 'static')
-rw-r--r-- | static/table.html | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/static/table.html b/static/table.html index c9fd8f6..84dc81d 100644 --- a/static/table.html +++ b/static/table.html @@ -102,7 +102,7 @@ var app = new Vue({ data: { rawData: {}, serverMap: {}, - timespan: 120, + maxTimespan: 120, firstTimestamp: undefined, peak: false, ports: false, @@ -128,7 +128,10 @@ var app = new Vue({ return servers }, timespanStartTime () { - return Math.min(this.firstTimestamp, this.rawData.timestamp - this.timespan * 1000) + return Math.max(this.firstTimestamp, this.rawData.timestamp - this.maxTimespan * 1000) + }, + timespan () { + return (this.rawData.timestamp - this.timespanStartTime) / 1000 } }, watch: { @@ -221,10 +224,9 @@ var app = new Vue({ objData.peakDownloadSpeed = Math.max(...obj.log.map(x => x.downloadSpeed || 0)) // Calculate average speeds - time = (this.rawData.timestamp - this.timespanStartTime) / 1000 a = obj.log[0] - objData.avgUploadSpeed = (b.bytesSent - a.bytesSent) / time - objData.avgDownloadSpeed = (b.bytesReceived - a.bytesReceived) / time + objData.avgUploadSpeed = (b.bytesSent - a.bytesSent) / this.timespan + objData.avgDownloadSpeed = (b.bytesReceived - a.bytesReceived) / this.timespan Object.assign(obj, objData) }, @@ -267,7 +269,7 @@ var app = new Vue({ }, created () { const urlParams = new URLSearchParams(window.location.search) - this.timespan = parseInt(urlParams.get('timespan')) || 120 + this.maxTimespan = parseInt(urlParams.get('timespan')) || 120 this.peak = urlParams.get('peak') === 'true' || urlParams.get('peak') === '' this.ports = urlParams.get('ports') === 'true' || urlParams.get('ports') === '' this.updateData() |