2018-08-23 15:37:19 -05:00
|
|
|
<template>
|
2018-08-24 22:28:05 -05:00
|
|
|
<div class="gkgckalzgidaygcxnugepioremxvxvpt">
|
2018-08-23 15:37:19 -05:00
|
|
|
<header>
|
|
|
|
<b>%i18n:@title%:</b>
|
|
|
|
<select v-model="chartType">
|
2018-08-23 16:41:53 -05:00
|
|
|
<optgroup label="%i18n:@users%">
|
2018-08-24 00:55:58 -05:00
|
|
|
<option value="users">%i18n:@charts.users%</option>
|
|
|
|
<option value="users-total">%i18n:@charts.users-total%</option>
|
2018-08-23 16:41:53 -05:00
|
|
|
</optgroup>
|
|
|
|
<optgroup label="%i18n:@notes%">
|
2018-08-24 00:55:58 -05: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 16:41:53 -05:00
|
|
|
</optgroup>
|
|
|
|
<optgroup label="%i18n:@drive%">
|
2018-08-24 00:55:58 -05: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 16:41:53 -05:00
|
|
|
</optgroup>
|
2018-08-23 15:37:19 -05:00
|
|
|
</select>
|
|
|
|
<div>
|
2018-08-24 00:55:58 -05: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 15:37:19 -05:00
|
|
|
</div>
|
|
|
|
</header>
|
2018-08-23 17:17:17 -05:00
|
|
|
<div>
|
|
|
|
<x-chart v-if="chart" :data="data[0]" :opts="data[1]"/>
|
|
|
|
</div>
|
2018-08-23 15:37:19 -05:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts">
|
|
|
|
import Vue from 'vue';
|
2018-08-24 22:28:05 -05:00
|
|
|
import XChart from './charts.chart.ts';
|
2018-08-23 15:37:19 -05:00
|
|
|
|
2018-08-25 01:25:16 -05: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)',
|
|
|
|
remoteMinus: 'rgb(255, 149, 134)'
|
|
|
|
};
|
|
|
|
|
|
|
|
const rgba = (color: string): string => {
|
|
|
|
return color.replace('rgb', 'rgba').replace(')', ', 0.1)');
|
|
|
|
};
|
|
|
|
|
2018-08-23 15:37:19 -05:00
|
|
|
export default Vue.extend({
|
|
|
|
components: {
|
|
|
|
XChart
|
|
|
|
},
|
2018-08-25 01:25:16 -05:00
|
|
|
|
2018-08-23 15:37:19 -05:00
|
|
|
data() {
|
|
|
|
return {
|
2018-08-23 17:23:04 -05:00
|
|
|
chart: null,
|
2018-08-24 00:55:58 -05:00
|
|
|
chartType: 'notes',
|
2018-08-23 15:37:19 -05:00
|
|
|
span: 'hour'
|
|
|
|
};
|
|
|
|
},
|
2018-08-25 01:25:16 -05:00
|
|
|
|
2018-08-23 15:37:19 -05:00
|
|
|
computed: {
|
|
|
|
data(): any {
|
|
|
|
if (this.chart == null) return null;
|
|
|
|
switch (this.chartType) {
|
2018-08-24 00:55:58 -05: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 18:35:41 -05: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-08-23 15:37:19 -05:00
|
|
|
}
|
|
|
|
},
|
2018-08-25 01:25:16 -05:00
|
|
|
|
2018-08-23 15:37:19 -05:00
|
|
|
stats(): any[] {
|
|
|
|
return (
|
|
|
|
this.span == 'day' ? this.chart.perDay :
|
|
|
|
this.span == 'hour' ? this.chart.perHour :
|
|
|
|
null
|
|
|
|
);
|
|
|
|
}
|
|
|
|
},
|
2018-08-25 01:25:16 -05:00
|
|
|
|
2018-08-23 17:23:04 -05:00
|
|
|
created() {
|
|
|
|
(this as any).api('chart').then(chart => {
|
|
|
|
this.chart = chart;
|
|
|
|
});
|
|
|
|
},
|
2018-08-25 01:25:16 -05:00
|
|
|
|
2018-08-23 15:37:19 -05:00
|
|
|
methods: {
|
2018-08-24 00:55:58 -05:00
|
|
|
notesChart(type: string): any {
|
2018-08-23 15:37:19 -05:00
|
|
|
const data = this.stats.slice().reverse().map(x => ({
|
|
|
|
date: new Date(x.date),
|
2018-08-24 00:55:58 -05:00
|
|
|
normal: type == 'local' ? x.notes.local.diffs.normal : type == 'remote' ? x.notes.remote.diffs.normal : x.notes.local.diffs.normal + x.notes.remote.diffs.normal,
|
|
|
|
reply: type == 'local' ? x.notes.local.diffs.reply : type == 'remote' ? x.notes.remote.diffs.reply : x.notes.local.diffs.reply + x.notes.remote.diffs.reply,
|
|
|
|
renote: type == 'local' ? x.notes.local.diffs.renote : type == 'remote' ? x.notes.remote.diffs.renote : x.notes.local.diffs.renote + x.notes.remote.diffs.renote,
|
2018-08-24 18:35:41 -05:00
|
|
|
all: type == 'local' ? (x.notes.local.inc + -x.notes.local.dec) : type == 'remote' ? (x.notes.remote.inc + -x.notes.remote.dec) : (x.notes.local.inc + -x.notes.local.dec) + (x.notes.remote.inc + -x.notes.remote.dec)
|
2018-08-23 15:37:19 -05:00
|
|
|
}));
|
|
|
|
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
2018-08-23 16:41:53 -05:00
|
|
|
label: 'All',
|
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
2018-08-23 19:39:16 -05:00
|
|
|
borderDash: [4, 4],
|
2018-08-23 16:41:53 -05:00
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
|
|
|
data: data.map(x => ({ t: x.date, y: x.all }))
|
|
|
|
}, {
|
2018-08-24 00:55:58 -05:00
|
|
|
label: 'Renotes',
|
2018-08-23 18:56:57 -05:00
|
|
|
fill: true,
|
2018-08-24 00:55:58 -05:00
|
|
|
backgroundColor: 'rgba(161, 222, 65, 0.1)',
|
|
|
|
borderColor: '#a1de41',
|
2018-08-23 15:37:19 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-24 00:55:58 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.renote }))
|
2018-08-23 15:37:19 -05:00
|
|
|
}, {
|
|
|
|
label: 'Replies',
|
2018-08-23 18:56:57 -05:00
|
|
|
fill: true,
|
|
|
|
backgroundColor: 'rgba(247, 121, 108, 0.1)',
|
2018-08-23 15:37:19 -05:00
|
|
|
borderColor: '#f7796c',
|
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
|
|
|
data: data.map(x => ({ t: x.date, y: x.reply }))
|
|
|
|
}, {
|
2018-08-24 00:55:58 -05:00
|
|
|
label: 'Normal',
|
2018-08-23 18:56:57 -05:00
|
|
|
fill: true,
|
2018-08-24 00:55:58 -05:00
|
|
|
backgroundColor: 'rgba(65, 221, 222, 0.1)',
|
|
|
|
borderColor: '#41ddde',
|
2018-08-23 15:37:19 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-24 00:55:58 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.normal }))
|
2018-08-23 15:37:19 -05:00
|
|
|
}]
|
2018-08-24 00:55:58 -05: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:37:19 -05:00
|
|
|
}];
|
|
|
|
},
|
2018-08-23 16:41:53 -05:00
|
|
|
|
2018-08-24 00:55:58 -05:00
|
|
|
notesTotalChart(): any {
|
2018-08-23 15:37:19 -05:00
|
|
|
const data = this.stats.slice().reverse().map(x => ({
|
|
|
|
date: new Date(x.date),
|
2018-08-24 00:55:58 -05:00
|
|
|
localCount: x.notes.local.total,
|
|
|
|
remoteCount: x.notes.remote.total
|
2018-08-23 15:37:19 -05:00
|
|
|
}));
|
|
|
|
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
2018-08-24 18:35:41 -05:00
|
|
|
label: 'Combined',
|
2018-08-24 00:55:58 -05:00
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
|
|
|
data: data.map(x => ({ t: x.date, y: x.remoteCount + x.localCount }))
|
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Local',
|
2018-08-24 00:55:58 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.local),
|
|
|
|
borderColor: colors.local,
|
2018-08-24 00:55:58 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.localCount }))
|
2018-08-24 00:55:58 -05:00
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Remote',
|
2018-08-23 17:17:17 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.remote),
|
|
|
|
borderColor: colors.remote,
|
2018-08-23 15:37:19 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.remoteCount }))
|
2018-08-23 15:37:19 -05:00
|
|
|
}]
|
2018-08-24 00:55:58 -05: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:37:19 -05:00
|
|
|
}];
|
|
|
|
},
|
2018-08-23 16:41:53 -05:00
|
|
|
|
2018-08-24 00:55:58 -05:00
|
|
|
usersChart(total: boolean): any {
|
2018-08-23 15:37:19 -05:00
|
|
|
const data = this.stats.slice().reverse().map(x => ({
|
|
|
|
date: new Date(x.date),
|
2018-08-24 18:35:41 -05:00
|
|
|
localCount: total ? x.users.local.total : (x.users.local.inc + -x.users.local.dec),
|
|
|
|
remoteCount: total ? x.users.remote.total : (x.users.remote.inc + -x.users.remote.dec)
|
2018-08-23 15:37:19 -05:00
|
|
|
}));
|
|
|
|
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
2018-08-24 18:35:41 -05:00
|
|
|
label: 'Combined',
|
2018-08-24 00:55:58 -05:00
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
|
|
|
data: data.map(x => ({ t: x.date, y: x.remoteCount + x.localCount }))
|
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Local',
|
2018-08-24 00:55:58 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.local),
|
|
|
|
borderColor: colors.local,
|
2018-08-24 00:55:58 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.localCount }))
|
2018-08-24 00:55:58 -05:00
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Remote',
|
2018-08-23 17:17:17 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.remote),
|
|
|
|
borderColor: colors.remote,
|
2018-08-23 15:37:19 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.remoteCount }))
|
2018-08-23 15:37:19 -05:00
|
|
|
}]
|
2018-08-24 00:55:58 -05: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:37:19 -05:00
|
|
|
}];
|
|
|
|
},
|
2018-08-23 16:41:53 -05:00
|
|
|
|
2018-08-24 18:35:41 -05:00
|
|
|
driveChart(): any {
|
2018-08-23 15:37:19 -05:00
|
|
|
const data = this.stats.slice().reverse().map(x => ({
|
|
|
|
date: new Date(x.date),
|
2018-08-24 18:35:41 -05:00
|
|
|
localInc: x.drive.local.incSize,
|
|
|
|
localDec: -x.drive.local.decSize,
|
|
|
|
remoteInc: x.drive.remote.incSize,
|
|
|
|
remoteDec: -x.drive.remote.decSize,
|
2018-08-23 15:37:19 -05:00
|
|
|
}));
|
|
|
|
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
2018-08-24 18:35:41 -05:00
|
|
|
label: 'All',
|
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
|
|
|
data: data.map(x => ({ t: x.date, y: x.localInc + x.localDec + x.remoteInc + x.remoteDec }))
|
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Local +',
|
2018-08-24 18:35:41 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.localPlus),
|
|
|
|
borderColor: colors.localPlus,
|
2018-08-24 18:35:41 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.localInc }))
|
2018-08-24 18:35:41 -05:00
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Local -',
|
2018-08-24 18:35:41 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.localMinus),
|
|
|
|
borderColor: colors.localMinus,
|
2018-08-24 18:35:41 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.localDec }))
|
2018-08-24 18:35:41 -05:00
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Remote +',
|
2018-08-24 18:35:41 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.remotePlus),
|
|
|
|
borderColor: colors.remotePlus,
|
2018-08-24 18:35:41 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.remoteInc }))
|
2018-08-24 18:35:41 -05:00
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Remote -',
|
2018-08-24 18:35:41 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.remoteMinus),
|
|
|
|
borderColor: colors.remoteMinus,
|
2018-08-24 18:35:41 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.remoteDec }))
|
2018-08-24 18:35:41 -05:00
|
|
|
}]
|
|
|
|
}, {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
|
|
|
callback: value => {
|
2018-08-24 22:14:36 -05:00
|
|
|
return Vue.filter('bytes')(value, 1);
|
2018-08-24 18:35:41 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
|
|
|
label: (tooltipItem, data) => {
|
|
|
|
const label = data.datasets[tooltipItem.datasetIndex].label || '';
|
2018-08-24 22:14:36 -05:00
|
|
|
return `${label}: ${Vue.filter('bytes')(tooltipItem.yLabel, 1)}`;
|
2018-08-24 18:35:41 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
},
|
|
|
|
|
|
|
|
driveTotalChart(): any {
|
|
|
|
const data = this.stats.slice().reverse().map(x => ({
|
|
|
|
date: new Date(x.date),
|
|
|
|
localSize: x.drive.local.totalSize,
|
|
|
|
remoteSize: x.drive.remote.totalSize
|
|
|
|
}));
|
|
|
|
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
|
|
|
label: 'Combined',
|
2018-08-24 00:55:58 -05:00
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
|
|
|
data: data.map(x => ({ t: x.date, y: x.remoteSize + x.localSize }))
|
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Local',
|
2018-08-24 00:55:58 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.local),
|
|
|
|
borderColor: colors.local,
|
2018-08-24 00:55:58 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.localSize }))
|
2018-08-24 00:55:58 -05:00
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Remote',
|
2018-08-23 17:17:17 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.remote),
|
|
|
|
borderColor: colors.remote,
|
2018-08-23 15:37:19 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.remoteSize }))
|
2018-08-23 15:37:19 -05:00
|
|
|
}]
|
|
|
|
}, {
|
|
|
|
scales: {
|
|
|
|
yAxes: [{
|
|
|
|
ticks: {
|
2018-08-23 18:56:57 -05:00
|
|
|
callback: value => {
|
2018-08-25 05:34:54 -05:00
|
|
|
return Vue.filter('bytes')(value, 1);
|
2018-08-23 15:37:19 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}]
|
2018-08-23 18:56:57 -05:00
|
|
|
},
|
|
|
|
tooltips: {
|
|
|
|
callbacks: {
|
2018-08-24 00:55:58 -05:00
|
|
|
label: (tooltipItem, data) => {
|
|
|
|
const label = data.datasets[tooltipItem.datasetIndex].label || '';
|
2018-08-25 05:34:54 -05:00
|
|
|
return `${label}: ${Vue.filter('bytes')(tooltipItem.yLabel, 1)}`;
|
2018-08-23 18:56:57 -05:00
|
|
|
}
|
|
|
|
}
|
2018-08-23 15:37:19 -05:00
|
|
|
}
|
|
|
|
}];
|
2018-08-23 16:41:53 -05:00
|
|
|
},
|
|
|
|
|
2018-08-24 18:35:41 -05:00
|
|
|
driveFilesChart(): any {
|
2018-08-23 16:41:53 -05:00
|
|
|
const data = this.stats.slice().reverse().map(x => ({
|
|
|
|
date: new Date(x.date),
|
2018-08-24 18:35:41 -05:00
|
|
|
localInc: x.drive.local.incCount,
|
|
|
|
localDec: -x.drive.local.decCount,
|
|
|
|
remoteInc: x.drive.remote.incCount,
|
|
|
|
remoteDec: -x.drive.remote.decCount
|
2018-08-23 16:41:53 -05:00
|
|
|
}));
|
|
|
|
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
2018-08-24 18:35:41 -05:00
|
|
|
label: 'All',
|
2018-08-24 00:55:58 -05:00
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-24 18:35:41 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.localInc + x.localDec + x.remoteInc + x.remoteDec }))
|
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Local +',
|
2018-08-24 18:35:41 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.localPlus),
|
|
|
|
borderColor: colors.localPlus,
|
2018-08-24 18:35:41 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.localInc }))
|
2018-08-24 18:35:41 -05:00
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Local -',
|
2018-08-24 18:35:41 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.localMinus),
|
|
|
|
borderColor: colors.localMinus,
|
2018-08-24 18:35:41 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.localDec }))
|
2018-08-24 18:35:41 -05:00
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Remote +',
|
2018-08-24 18:35:41 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.remotePlus),
|
|
|
|
borderColor: colors.remotePlus,
|
2018-08-24 18:35:41 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.remoteInc }))
|
2018-08-24 18:35:41 -05:00
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Remote -',
|
2018-08-24 18:35:41 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.remoteMinus),
|
|
|
|
borderColor: colors.remoteMinus,
|
2018-08-24 18:35:41 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.remoteDec }))
|
2018-08-24 18:35:41 -05: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 {
|
|
|
|
const data = this.stats.slice().reverse().map(x => ({
|
|
|
|
date: new Date(x.date),
|
|
|
|
localCount: x.drive.local.totalCount,
|
|
|
|
remoteCount: x.drive.remote.totalCount,
|
|
|
|
}));
|
|
|
|
|
|
|
|
return [{
|
|
|
|
datasets: [{
|
|
|
|
label: 'Combined',
|
|
|
|
fill: false,
|
|
|
|
borderColor: '#555',
|
|
|
|
borderWidth: 2,
|
|
|
|
borderDash: [4, 4],
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
|
|
|
data: data.map(x => ({ t: x.date, y: x.localCount + x.remoteCount }))
|
2018-08-24 00:55:58 -05:00
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Local',
|
2018-08-24 00:55:58 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.local),
|
|
|
|
borderColor: colors.local,
|
2018-08-24 00:55:58 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.localCount }))
|
2018-08-24 00:55:58 -05:00
|
|
|
}, {
|
2018-08-25 01:25:16 -05:00
|
|
|
label: 'Remote',
|
2018-08-23 19:39:16 -05:00
|
|
|
fill: true,
|
2018-08-25 01:25:16 -05:00
|
|
|
backgroundColor: rgba(colors.remote),
|
|
|
|
borderColor: colors.remote,
|
2018-08-23 16:41:53 -05:00
|
|
|
borderWidth: 2,
|
|
|
|
pointBackgroundColor: '#fff',
|
|
|
|
lineTension: 0,
|
2018-08-25 01:25:16 -05:00
|
|
|
data: data.map(x => ({ t: x.date, y: x.remoteCount }))
|
2018-08-23 16:41:53 -05:00
|
|
|
}]
|
2018-08-24 00:55:58 -05: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 16:41:53 -05:00
|
|
|
}];
|
2018-08-24 00:55:58 -05:00
|
|
|
}
|
2018-08-23 15:37:19 -05:00
|
|
|
}
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="stylus" scoped>
|
|
|
|
@import '~const.styl'
|
|
|
|
|
|
|
|
.gkgckalzgidaygcxnugepioremxvxvpt
|
2018-08-24 22:28:05 -05:00
|
|
|
padding 32px
|
|
|
|
background #fff
|
|
|
|
box-shadow 0 2px 8px rgba(#000, 0.1)
|
|
|
|
|
2018-08-23 18:56:57 -05:00
|
|
|
*
|
|
|
|
user-select none
|
|
|
|
|
2018-08-23 15:37:19 -05:00
|
|
|
> header
|
|
|
|
display flex
|
2018-08-24 22:28:05 -05:00
|
|
|
margin 0 0 1em 0
|
|
|
|
padding 0 0 8px 0
|
|
|
|
font-size 1em
|
|
|
|
color #555
|
|
|
|
border-bottom solid 1px #eee
|
2018-08-23 15:37:19 -05:00
|
|
|
|
|
|
|
> b
|
|
|
|
margin-right 8px
|
|
|
|
|
|
|
|
> *:last-child
|
|
|
|
margin-left auto
|
|
|
|
|
2018-08-24 00:55:58 -05:00
|
|
|
*
|
|
|
|
&:not(.active)
|
|
|
|
color $theme-color
|
|
|
|
cursor pointer
|
|
|
|
|
2018-08-23 17:17:17 -05:00
|
|
|
> div
|
|
|
|
> *
|
|
|
|
display block
|
|
|
|
height 300px
|
|
|
|
|
2018-08-23 15:37:19 -05:00
|
|
|
</style>
|