2018-08-23 14:37:19 -06:00
|
|
|
<template>
|
2018-08-24 21:28:05 -06:00
|
|
|
<div class="gkgckalzgidaygcxnugepioremxvxvpt">
|
2018-08-23 14:37:19 -06:00
|
|
|
<header>
|
|
|
|
<b>%i18n:@title%:</b>
|
|
|
|
<select v-model="chartType">
|
2018-08-23 15:41:53 -06:00
|
|
|
<optgroup label="%i18n:@users%">
|
2018-08-23 23:55:58 -06:00
|
|
|
<option value="users">%i18n:@charts.users%</option>
|
|
|
|
<option value="users-total">%i18n:@charts.users-total%</option>
|
2018-08-23 15:41:53 -06:00
|
|
|
</optgroup>
|
|
|
|
<optgroup label="%i18n:@notes%">
|
2018-08-23 23:55:58 -06:00
|
|
|
<option value="notes">%i18n:@charts.notes%</option>
|
|
|
|
<option value="local-notes">%i18n:@charts.local-notes%</option>
|
|
|
|
<option value="remote-notes">%i18n:@charts.remote-notes%</option>
|
|
|
|
<option value="notes-total">%i18n:@charts.notes-total%</option>
|
2018-08-23 15:41:53 -06:00
|
|
|
</optgroup>
|
|
|
|
<optgroup label="%i18n:@drive%">
|
2018-08-23 23:55:58 -06:00
|
|
|
<option value="drive-files">%i18n:@charts.drive-files%</option>
|
|
|
|
<option value="drive-files-total">%i18n:@charts.drive-files-total%</option>
|
|
|
|
<option value="drive">%i18n:@charts.drive%</option>
|
|
|
|
<option value="drive-total">%i18n:@charts.drive-total%</option>
|
2018-08-23 15:41:53 -06:00
|
|
|
</optgroup>
|
2018-09-14 14:40:58 -06:00
|
|
|
<optgroup label="%i18n:@network%">
|
|
|
|
<option value="network-requests">%i18n:@charts.network-requests%</option>
|
|
|
|
<option value="network-time">%i18n:@charts.network-time%</option>
|
|
|
|
<option value="network-usage">%i18n:@charts.network-usage%</option>
|
|
|
|
</optgroup>
|
2018-08-23 14:37:19 -06:00
|
|
|
</select>
|
|
|
|
<div>
|
2018-08-23 23:55:58 -06:00
|
|
|
<span @click="span = 'day'" :class="{ active: span == 'day' }">%i18n:@per-day%</span> | <span @click="span = 'hour'" :class="{ active: span == 'hour' }">%i18n:@per-hour%</span>
|
2018-08-23 14:37:19 -06:00
|
|
|
</div>
|
|
|
|
</header>
|
2018-08-23 16:17:17 -06:00
|
|
|
<div>
|
|
|
|
<x-chart v-if="chart" :data="data[0]" :opts="data[1]"/>
|
|
|
|
</div>
|
2018-08-23 14:37:19 -06:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-08-24 21:28:05 -06:00
|
|
|
import XChart from './charts.chart.ts';
|
2018-08-23 14:37:19 -06:00
|
|
|
|
2018-08-25 00:25:16 -06:00
|
|
|
const colors = {
|
|
|
|
local: 'rgb(246, 88, 79)',
|
|
|
|
remote: 'rgb(65, 221, 222)',
|
|
|
|
|
|
|
|
localPlus: 'rgb(52, 178, 118)',
|
|
|
|
remotePlus: 'rgb(158, 255, 209)',
|
|
|
|
localMinus: 'rgb(255, 97, 74)',
|
2018-09-14 14:40:58 -06:00
|
|
|
remoteMinus: 'rgb(255, 149, 134)',
|
|
|
|
|
|
|
|
incoming: 'rgb(52, 178, 118)',
|
|
|
|
outgoing: 'rgb(255, 97, 74)',
|
2018-08-25 00:25:16 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
const rgba = (color: string): string => {
|
|
|
|
return color.replace('rgb', 'rgba').replace(')', ', 0.1)');
|
|
|
|
};
|
|
|
|
|
2018-10-20 19:24:56 -06:00
|
|
|
const limit = 35;
|
|
|
|
|
2018-10-22 01:51:45 -06:00
|
|
|
const sum = (...arr) => arr.reduce((r, a) => r.map((b, i) => a[i] + b));
|
|
|
|
const negate = arr => arr.map(x => -x);
|
|
|
|
|
2018-08-23 14:37:19 -06:00
|
|
|
export default Vue.extend({
|
|
|
|
components: {
|
|
|
|
XChart
|
|
|
|
},
|
2018-08-25 00:25:16 -06:00
|
|
|
|
2018-08-23 14:37:19 -06:00
|
|
|
data() {
|
|
|
|
return {
|
2018-10-20 19:24:56 -06:00
|
|
|
now: null,
|
2018-08-23 16:23:04 -06:00
|
|
|
chart: null,
|
2018-08-23 23:55:58 -06:00
|
|
|
chartType: 'notes',
|
2018-08-23 14:37:19 -06:00
|
|
|
span: 'hour'
|
|
|
|
};
|
|
|
|
},
|
2018-08-25 00:25:16 -06:00
|
|
|
|
2018-08-23 14:37:19 -06:00
|
|
|
computed: {
|
|
|
|
data(): any {
|
|
|
|
if (this.chart == null) return null;
|
|
|
|
switch (this.chartType) {
|
2018-08-23 23:55:58 -06:00
|
|
|
case 'users': return this.usersChart(false);
|
|
|
|
case 'users-total': return this.usersChart(true);
|
|
|
|
case 'notes': return this.notesChart('combined');
|
|
|
|
case 'local-notes': return this.notesChart('local');
|
|
|
|
case 'remote-notes': return this.notesChart('remote');
|
|
|
|
case 'notes-total': return this.notesTotalChart();
|
2018-08-24 17:35:41 -06:00
|
|
|
case 'drive': return this.driveChart();
|
|
|
|
case 'drive-total': return this.driveTotalChart();
|
|
|
|
case 'drive-files': return this.driveFilesChart();
|
|
|
|
case 'drive-files-total': return this.driveFilesTotalChart();
|
2018-09-14 14:40:58 -06:00
|
|
|
case 'network-requests': return this.networkRequestsChart();
|
|
|
|
case 'network-time': return this.networkTimeChart();
|
|
|
|
case 'network-usage': return this.networkUsageChart();
|
2018-08-23 14:37:19 -06:00
|
|
|
}
|
|
|
|
},
|
2018-08-25 00:25:16 -06:00
|
|
|
|
2018-08-23 14:37:19 -06:00
|
|
|
stats(): any[] {
|
2018-10-20 16:10:35 -06:00
|
|
|
const stats =
|
2018-08-23 14:37:19 -06:00
|
|
|
this.span == 'day' ? this.chart.perDay :
|
|
|
|
this.span == 'hour' ? this.chart.perHour :
|
2018-10-20 16:10:35 -06:00
|
|
|
null;
|
|
|
|
|
|
|
|
return stats;
|
2018-08-23 14:37:19 -06:00
|
|
|
}
|
|
|
|
},
|
2018-08-25 00:25:16 -06:00
|
|
|
|
2018-10-20 18:20:11 -06:00
|
|
|
async created() {
|
2018-10-20 19:24:56 -06:00
|
|
|
this.now = new Date();
|
2018-10-20 18:20:11 -06:00
|
|
|
|
|
|
|
const [perHour, perDay] = await Promise.all([Promise.all([
|
|
|
|
(this as any).api('charts/users', { limit: limit, span: 'hour' }),
|
|
|
|
(this as any).api('charts/notes', { limit: limit, span: 'hour' }),
|
|
|
|
(this as any).api('charts/drive', { limit: limit, span: 'hour' }),
|
|
|
|
(this as any).api('charts/network', { limit: limit, span: 'hour' })
|
|
|
|
]), Promise.all([
|
|
|
|
(this as any).api('charts/users', { limit: limit, span: 'day' }),
|
|
|
|
(this as any).api('charts/notes', { limit: limit, span: 'day' }),
|
|
|
|
(this as any).api('charts/drive', { limit: limit, span: 'day' }),
|
|
|
|
(this as any).api('charts/network', { limit: limit, span: 'day' })
|
|
|
|
])]);
|
|
|
|
|
|
|
|
const chart = {
|
2018-10-20 19:24:56 -06:00
|
|
|
perHour: {
|
|
|
|
users: perHour[0],
|
|
|
|
notes: perHour[1],
|
|
|
|
drive: perHour[2],
|
|
|
|
network: perHour[3]
|
|
|
|
},
|
|
|
|
perDay: {
|
|
|
|
users: perDay[0],
|
|
|
|
notes: perDay[1],
|
|
|
|
drive: perDay[2],
|
|
|
|
network: perDay[3]
|
|
|
|
}
|
2018-10-20 18:20:11 -06:00
|
|
|
};
|
|
|
|
|
|
|
|
this.chart = chart;
|
2018-08-23 16:23:04 -06:00
|
|
|
},
|
2018-08-25 00:25:16 -06:00
|
|
|
|
2018-08-23 14:37:19 -06:00
|
|
|
methods: {
|
2018-10-20 19:24:56 -06:00
|
|
|
getDate(i: number) {
|
|
|
|
const y = this.now.getFullYear();
|
|
|
|
const m = this.now.getMonth();
|
|
|
|
const d = this.now.getDate();
|
|
|
|
const h = this.now.getHours();
|
|
|
|
|
|
|
|
return (
|
|
|
|
this.span == 'day' ? new Date(y, m, d - i) :
|
|
|
|
this.span == 'hour' ? new Date(y, m, d, h - i) :
|
|
|
|
null
|
|
|
|
);
|
|
|
|
},
|
|
|
|
|
2018-10-22 01:51:45 -06:00
|
|
|
format(arr) {
|
|
|
|
return arr.map((v, i) => ({ t: this.getDate(i).getTime(), y: v }));
|
|
|
|
},
|
2018-08-23 14:37:19 -06:00
|
|
|
|
2018-10-22 01:51:45 -06:00
|
|
|
notesChart(type: string): any {
|
2018-08-23 14:37:19 -06:00
|
|
|
return [{
|
|
|
|
datasets: [{
|
2018-08-23 15:41:53 -06:00
|
|
|
label: 'All',
|
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
2018-08-23 18:39:16 -06:00
|
|
|
borderDash: [4, 4],
|
2018-08-23 15:41:53 -06:00
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(type == 'combined'
|
|
|
|
? sum(this.stats.notes.local.inc, negate(this.stats.notes.local.dec), this.stats.notes.remote.inc, negate(this.stats.notes.remote.dec))
|
|
|
|
: sum(this.stats.notes[type].inc, negate(this.stats.notes[type].dec))
|
|
|
|
)
|
2018-08-23 15:41:53 -06:00
|
|
|
}, {
|
2018-08-23 23:55:58 -06:00
|
|
|
label: 'Renotes',
|
2018-08-23 17:56:57 -06:00
|
|
|
fill: true,
|
2018-08-23 23:55:58 -06:00
|
|
|
backgroundColor: 'rgba(161, 222, 65, 0.1)',
|
|
|
|
borderColor: '#a1de41',
|
2018-08-23 14:37:19 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(type == 'combined'
|
|
|
|
? sum(this.stats.notes.local.diffs.renote, this.stats.notes.remote.diffs.renote)
|
|
|
|
: this.stats.notes[type].diffs.renote
|
|
|
|
)
|
2018-08-23 14:37:19 -06:00
|
|
|
}, {
|
|
|
|
label: 'Replies',
|
2018-08-23 17:56:57 -06:00
|
|
|
fill: true,
|
|
|
|
backgroundColor: 'rgba(247, 121, 108, 0.1)',
|
2018-08-23 14:37:19 -06:00
|
|
|
borderColor: '#f7796c',
|
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(type == 'combined'
|
|
|
|
? sum(this.stats.notes.local.diffs.reply, this.stats.notes.remote.diffs.reply)
|
|
|
|
: this.stats.notes[type].diffs.reply
|
|
|
|
)
|
2018-08-23 14:37:19 -06:00
|
|
|
}, {
|
2018-08-23 23:55:58 -06:00
|
|
|
label: 'Normal',
|
2018-08-23 17:56:57 -06:00
|
|
|
fill: true,
|
2018-08-23 23:55:58 -06:00
|
|
|
backgroundColor: 'rgba(65, 221, 222, 0.1)',
|
|
|
|
borderColor: '#41ddde',
|
2018-08-23 14:37:19 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(type == 'combined'
|
|
|
|
? sum(this.stats.notes.local.diffs.normal, this.stats.notes.remote.diffs.normal)
|
|
|
|
: this.stats.notes[type].diffs.normal
|
|
|
|
)
|
2018-08-23 14:37:19 -06:00
|
|
|
}]
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
callback: value => {
|
|
|
|
return Vue.filter('number')(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: (tooltipItem, data) => {
|
|
|
|
const label = data.datasets[tooltipItem.datasetIndex].label || '';
|
|
|
|
return `${label}: ${Vue.filter('number')(tooltipItem.yLabel)}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-08-23 14:37:19 -06:00
|
|
|
}];
|
|
|
|
},
|
2018-08-23 15:41:53 -06:00
|
|
|
|
2018-08-23 23:55:58 -06:00
|
|
|
notesTotalChart(): any {
|
2018-08-23 14:37:19 -06:00
|
|
|
return [{
|
|
|
|
datasets: [{
|
2018-08-24 17:35:41 -06:00
|
|
|
label: 'Combined',
|
2018-08-23 23:55:58 -06:00
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(sum(this.stats.notes.local.total, this.stats.notes.remote.total))
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Local',
|
2018-08-23 23:55:58 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.local),
|
|
|
|
borderColor: colors.local,
|
2018-08-23 23:55:58 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.notes.local.total)
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Remote',
|
2018-08-23 16:17:17 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.remote),
|
|
|
|
borderColor: colors.remote,
|
2018-08-23 14:37:19 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.notes.remote.total)
|
2018-08-23 14:37:19 -06:00
|
|
|
}]
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
callback: value => {
|
|
|
|
return Vue.filter('number')(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: (tooltipItem, data) => {
|
|
|
|
const label = data.datasets[tooltipItem.datasetIndex].label || '';
|
|
|
|
return `${label}: ${Vue.filter('number')(tooltipItem.yLabel)}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-08-23 14:37:19 -06:00
|
|
|
}];
|
|
|
|
},
|
2018-08-23 15:41:53 -06:00
|
|
|
|
2018-08-23 23:55:58 -06:00
|
|
|
usersChart(total: boolean): any {
|
2018-08-23 14:37:19 -06:00
|
|
|
return [{
|
|
|
|
datasets: [{
|
2018-08-24 17:35:41 -06:00
|
|
|
label: 'Combined',
|
2018-08-23 23:55:58 -06:00
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(total
|
|
|
|
? sum(this.stats.users.local.total, this.stats.users.remote.total)
|
|
|
|
: sum(this.stats.users.local.inc, negate(this.stats.users.local.dec), this.stats.users.remote.inc, negate(this.stats.users.remote.dec))
|
|
|
|
)
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Local',
|
2018-08-23 23:55:58 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.local),
|
|
|
|
borderColor: colors.local,
|
2018-08-23 23:55:58 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(total
|
|
|
|
? this.stats.users.local.total
|
|
|
|
: sum(this.stats.users.local.inc, negate(this.stats.users.local.dec))
|
|
|
|
)
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Remote',
|
2018-08-23 16:17:17 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.remote),
|
|
|
|
borderColor: colors.remote,
|
2018-08-23 14:37:19 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(total
|
|
|
|
? this.stats.users.remote.total
|
|
|
|
: sum(this.stats.users.remote.inc, negate(this.stats.users.remote.dec))
|
|
|
|
)
|
2018-08-23 14:37:19 -06:00
|
|
|
}]
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
callback: value => {
|
|
|
|
return Vue.filter('number')(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: (tooltipItem, data) => {
|
|
|
|
const label = data.datasets[tooltipItem.datasetIndex].label || '';
|
|
|
|
return `${label}: ${Vue.filter('number')(tooltipItem.yLabel)}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-08-23 14:37:19 -06:00
|
|
|
}];
|
|
|
|
},
|
2018-08-23 15:41:53 -06:00
|
|
|
|
2018-08-24 17:35:41 -06:00
|
|
|
driveChart(): any {
|
2018-08-23 14:37:19 -06:00
|
|
|
return [{
|
|
|
|
datasets: [{
|
2018-08-24 17:35:41 -06:00
|
|
|
label: 'All',
|
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(sum(this.stats.drive.local.incSize, negate(this.stats.drive.local.decSize), this.stats.drive.remote.incSize, negate(this.stats.drive.remote.decSize)))
|
2018-08-24 17:35:41 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Local +',
|
2018-08-24 17:35:41 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.localPlus),
|
|
|
|
borderColor: colors.localPlus,
|
2018-08-24 17:35:41 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.drive.local.incSize)
|
2018-08-24 17:35:41 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Local -',
|
2018-08-24 17:35:41 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.localMinus),
|
|
|
|
borderColor: colors.localMinus,
|
2018-08-24 17:35:41 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(negate(this.stats.drive.local.decSize))
|
2018-08-24 17:35:41 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Remote +',
|
2018-08-24 17:35:41 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.remotePlus),
|
|
|
|
borderColor: colors.remotePlus,
|
2018-08-24 17:35:41 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.drive.remote.incSize)
|
2018-08-24 17:35:41 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Remote -',
|
2018-08-24 17:35:41 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.remoteMinus),
|
|
|
|
borderColor: colors.remoteMinus,
|
2018-08-24 17:35:41 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(negate(this.stats.drive.remote.decSize))
|
2018-08-24 17:35:41 -06:00
|
|
|
}]
|
|
|
|
}, {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
callback: value => {
|
2018-08-24 21:14:36 -06:00
|
|
|
return Vue.filter('bytes')(value, 1);
|
2018-08-24 17:35:41 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: (tooltipItem, data) => {
|
|
|
|
const label = data.datasets[tooltipItem.datasetIndex].label || '';
|
2018-08-24 21:14:36 -06:00
|
|
|
return `${label}: ${Vue.filter('bytes')(tooltipItem.yLabel, 1)}`;
|
2018-08-24 17:35:41 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
},
|
|
|
|
|
|
|
|
driveTotalChart(): any {
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
|
|
|
label: 'Combined',
|
2018-08-23 23:55:58 -06:00
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(sum(this.stats.drive.local.totalSize, this.stats.drive.remote.totalSize))
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Local',
|
2018-08-23 23:55:58 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.local),
|
|
|
|
borderColor: colors.local,
|
2018-08-23 23:55:58 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.drive.local.totalSize)
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Remote',
|
2018-08-23 16:17:17 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.remote),
|
|
|
|
borderColor: colors.remote,
|
2018-08-23 14:37:19 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.drive.remote.totalSize)
|
2018-08-23 14:37:19 -06:00
|
|
|
}]
|
|
|
|
}, {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
2018-08-23 17:56:57 -06:00
|
|
|
callback: value => {
|
2018-08-25 04:34:54 -06:00
|
|
|
return Vue.filter('bytes')(value, 1);
|
2018-08-23 14:37:19 -06:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
2018-08-23 17:56:57 -06:00
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
2018-08-23 23:55:58 -06:00
|
|
|
label: (tooltipItem, data) => {
|
|
|
|
const label = data.datasets[tooltipItem.datasetIndex].label || '';
|
2018-08-25 04:34:54 -06:00
|
|
|
return `${label}: ${Vue.filter('bytes')(tooltipItem.yLabel, 1)}`;
|
2018-08-23 17:56:57 -06:00
|
|
|
}
|
|
|
|
}
|
2018-08-23 14:37:19 -06:00
|
|
|
}
|
|
|
|
}];
|
2018-08-23 15:41:53 -06:00
|
|
|
},
|
|
|
|
|
2018-08-24 17:35:41 -06:00
|
|
|
driveFilesChart(): any {
|
2018-08-23 15:41:53 -06:00
|
|
|
return [{
|
|
|
|
datasets: [{
|
2018-08-24 17:35:41 -06:00
|
|
|
label: 'All',
|
2018-08-23 23:55:58 -06:00
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(sum(this.stats.drive.local.incCount, negate(this.stats.drive.local.decCount), this.stats.drive.remote.incCount, negate(this.stats.drive.remote.decCount)))
|
2018-08-24 17:35:41 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Local +',
|
2018-08-24 17:35:41 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.localPlus),
|
|
|
|
borderColor: colors.localPlus,
|
2018-08-24 17:35:41 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.drive.local.incCount)
|
2018-08-24 17:35:41 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Local -',
|
2018-08-24 17:35:41 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.localMinus),
|
|
|
|
borderColor: colors.localMinus,
|
2018-08-24 17:35:41 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(negate(this.stats.drive.local.decCount))
|
2018-08-24 17:35:41 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Remote +',
|
2018-08-24 17:35:41 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.remotePlus),
|
|
|
|
borderColor: colors.remotePlus,
|
2018-08-24 17:35:41 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.drive.remote.incCount)
|
2018-08-24 17:35:41 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Remote -',
|
2018-08-24 17:35:41 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.remoteMinus),
|
|
|
|
borderColor: colors.remoteMinus,
|
2018-08-24 17:35:41 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(negate(this.stats.drive.remote.decCount))
|
2018-08-24 17:35:41 -06:00
|
|
|
}]
|
|
|
|
}, {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
callback: value => {
|
|
|
|
return Vue.filter('number')(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: (tooltipItem, data) => {
|
|
|
|
const label = data.datasets[tooltipItem.datasetIndex].label || '';
|
|
|
|
return `${label}: ${Vue.filter('number')(tooltipItem.yLabel)}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
},
|
|
|
|
|
|
|
|
driveFilesTotalChart(): any {
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
|
|
|
label: 'Combined',
|
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(sum(this.stats.drive.local.totalCount, this.stats.drive.remote.totalCount))
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Local',
|
2018-08-23 23:55:58 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.local),
|
|
|
|
borderColor: colors.local,
|
2018-08-23 23:55:58 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.drive.local.totalCount)
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
2018-08-25 00:25:16 -06:00
|
|
|
label: 'Remote',
|
2018-08-23 18:39:16 -06:00
|
|
|
fill: true,
|
2018-08-25 00:25:16 -06:00
|
|
|
backgroundColor: rgba(colors.remote),
|
|
|
|
borderColor: colors.remote,
|
2018-08-23 15:41:53 -06:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.drive.remote.totalCount)
|
2018-08-23 15:41:53 -06:00
|
|
|
}]
|
2018-08-23 23:55:58 -06:00
|
|
|
}, {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
callback: value => {
|
|
|
|
return Vue.filter('number')(value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: (tooltipItem, data) => {
|
|
|
|
const label = data.datasets[tooltipItem.datasetIndex].label || '';
|
|
|
|
return `${label}: ${Vue.filter('number')(tooltipItem.yLabel)}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2018-08-23 15:41:53 -06:00
|
|
|
}];
|
2018-09-14 14:40:58 -06:00
|
|
|
},
|
|
|
|
|
|
|
|
networkRequestsChart(): any {
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
2018-10-20 16:10:35 -06:00
|
|
|
label: 'Incoming',
|
2018-09-14 14:40:58 -06:00
|
|
|
fill: true,
|
|
|
|
backgroundColor: rgba(colors.localPlus),
|
|
|
|
borderColor: colors.localPlus,
|
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.network.incomingRequests)
|
2018-09-14 14:40:58 -06:00
|
|
|
}]
|
|
|
|
}];
|
|
|
|
},
|
|
|
|
|
|
|
|
networkTimeChart(): any {
|
2018-10-20 19:24:56 -06:00
|
|
|
const data = [];
|
|
|
|
|
|
|
|
for (let i = 0; i < limit; i++) {
|
2018-10-22 01:51:45 -06:00
|
|
|
data.push(this.stats.network.incomingRequests[i] != 0 ? (this.stats.network.totalTime[i] / this.stats.network.incomingRequests[i]) : 0);
|
2018-10-20 19:24:56 -06:00
|
|
|
}
|
2018-09-14 14:40:58 -06:00
|
|
|
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
|
|
|
label: 'Avg time (ms)',
|
|
|
|
fill: true,
|
|
|
|
backgroundColor: rgba(colors.localPlus),
|
|
|
|
borderColor: colors.localPlus,
|
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(data)
|
2018-09-14 14:40:58 -06:00
|
|
|
}]
|
|
|
|
}];
|
|
|
|
},
|
|
|
|
|
|
|
|
networkUsageChart(): any {
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
|
|
|
label: 'Incoming',
|
|
|
|
fill: true,
|
|
|
|
backgroundColor: rgba(colors.incoming),
|
|
|
|
borderColor: colors.incoming,
|
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.network.incomingBytes)
|
2018-09-14 14:40:58 -06:00
|
|
|
}, {
|
|
|
|
label: 'Outgoing',
|
|
|
|
fill: true,
|
|
|
|
backgroundColor: rgba(colors.outgoing),
|
|
|
|
borderColor: colors.outgoing,
|
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-10-22 01:51:45 -06:00
|
|
|
data: this.format(this.stats.network.outgoingBytes)
|
2018-09-14 14:40:58 -06:00
|
|
|
}]
|
|
|
|
}, {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
callback: value => {
|
|
|
|
return Vue.filter('bytes')(value, 1);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: (tooltipItem, data) => {
|
|
|
|
const label = data.datasets[tooltipItem.datasetIndex].label || '';
|
|
|
|
return `${label}: ${Vue.filter('bytes')(tooltipItem.yLabel, 1)}`;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
},
|
2018-08-23 14:37:19 -06:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
.gkgckalzgidaygcxnugepioremxvxvpt
|
2018-08-24 21:28:05 -06:00
|
|
|
padding 32px
|
|
|
|
background #fff
|
|
|
|
box-shadow 0 2px 8px rgba(#000, 0.1)
|
|
|
|
|
2018-08-23 17:56:57 -06:00
|
|
|
*
|
|
|
|
user-select none
|
|
|
|
|
2018-08-23 14:37:19 -06:00
|
|
|
> header
|
|
|
|
display flex
|
2018-08-24 21:28:05 -06:00
|
|
|
margin 0 0 1em 0
|
|
|
|
padding 0 0 8px 0
|
|
|
|
font-size 1em
|
|
|
|
color #555
|
|
|
|
border-bottom solid 1px #eee
|
2018-08-23 14:37:19 -06:00
|
|
|
|
|
|
|
> b
|
|
|
|
margin-right 8px
|
|
|
|
|
|
|
|
> *:last-child
|
|
|
|
margin-left auto
|
|
|
|
|
2018-08-23 23:55:58 -06:00
|
|
|
*
|
|
|
|
&:not(.active)
|
2018-09-26 05:19:35 -06:00
|
|
|
color var(--primary)
|
2018-08-23 23:55:58 -06:00
|
|
|
cursor pointer
|
|
|
|
|
2018-08-23 16:17:17 -06:00
|
|
|
> div
|
|
|
|
> *
|
|
|
|
display block
|
2018-09-16 11:56:57 -06:00
|
|
|
height 350px
|
2018-08-23 16:17:17 -06:00
|
|
|
|
2018-08-23 14:37:19 -06:00
|
|
|
</style>
|