Compare commits
24 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
806dabe58b | ||
|
|
b70e22c150 | ||
|
|
13624ea7c2 | ||
|
|
5ba36efcd2 | ||
|
|
fd497ef105 | ||
|
|
9c4a7bf94c | ||
|
|
91f8adc138 | ||
|
|
69fa2373cb | ||
|
|
8b37fc4772 | ||
|
|
81e4ed9591 | ||
|
|
9cda89ec04 | ||
|
|
fc180f030f | ||
|
|
a827b6028d | ||
|
|
4517bf7342 | ||
|
|
b21287262e | ||
|
|
c1b47a2119 | ||
|
|
caf625afee | ||
|
|
2bad3865a3 | ||
|
|
3f7d248684 | ||
|
|
6e179e7cde | ||
|
|
87f248b8ec | ||
|
|
027140eccc | ||
|
|
92cf205c66 | ||
|
|
fa3299840f |
10
CHANGELOG.md
10
CHANGELOG.md
@@ -5,6 +5,16 @@ ChangeLog
|
|||||||
|
|
||||||
This document describes breaking changes only.
|
This document describes breaking changes only.
|
||||||
|
|
||||||
|
8.0.0
|
||||||
|
-----
|
||||||
|
|
||||||
|
### Migration
|
||||||
|
|
||||||
|
起動する前に、`node cli/migration/8.0.0`してください。
|
||||||
|
|
||||||
|
Please run `node cli/migration/8.0.0` before launch.
|
||||||
|
|
||||||
|
|
||||||
7.0.0
|
7.0.0
|
||||||
-----
|
-----
|
||||||
|
|
||||||
|
|||||||
@@ -941,27 +941,22 @@ desktop/views/pages/admin/admin.unverify-user.vue:
|
|||||||
|
|
||||||
desktop/views/pages/admin/admin.chart.vue:
|
desktop/views/pages/admin/admin.chart.vue:
|
||||||
title: "チャート"
|
title: "チャート"
|
||||||
per-day: "1時間ごと"
|
per-day: "1日ごと"
|
||||||
per-hour: "1日ごと"
|
per-hour: "1時間ごと"
|
||||||
notes: "投稿"
|
notes: "投稿"
|
||||||
users: "ユーザー"
|
users: "ユーザー"
|
||||||
drive: "ドライブ"
|
drive: "ドライブ"
|
||||||
local-notes: "ローカルの投稿"
|
charts:
|
||||||
remote-notes: "リモートの投稿"
|
notes: "投稿の増減 (統合)"
|
||||||
local-notes-total: "ローカルの投稿 (累計)"
|
local-notes: "投稿の増減 (ローカル)"
|
||||||
remote-notes-total: "リモートの投稿 (累計)"
|
remote-notes: "投稿の増減 (リモート)"
|
||||||
local-users: "ローカルのユーザー"
|
notes-total: "投稿の累計"
|
||||||
remote-users: "リモートのユーザー"
|
users: "ユーザーの増減"
|
||||||
local-users-total: "ローカルのユーザー (累計)"
|
users-total: "ユーザーの累計"
|
||||||
remote-users-total: "リモートのユーザー (累計)"
|
drive: "ドライブ使用量の増減"
|
||||||
local-drive: "ローカルのドライブ使用量"
|
drive-total: "ドライブ使用量の累計"
|
||||||
remote-drive: "リモートのドライブ使用量"
|
drive-files: "ドライブのファイル数の増減"
|
||||||
local-drive-total: "ローカルのドライブ使用量 (累計)"
|
drive-files-total: "ドライブのファイル数の累計"
|
||||||
remote-drive-total: "リモートのドライブ使用量 (累計)"
|
|
||||||
local-drive-files: "ローカルのドライブのファイル数"
|
|
||||||
remote-drive-files: "リモートのドライブのファイル数"
|
|
||||||
local-drive-files-total: "ローカルのドライブのファイル数 (累計)"
|
|
||||||
remote-drive-files-total: "リモートのドライブのファイル数 (累計)"
|
|
||||||
|
|
||||||
desktop/views/pages/deck/deck.tl-column.vue:
|
desktop/views/pages/deck/deck.tl-column.vue:
|
||||||
is-media-only: "メディア投稿のみ"
|
is-media-only: "メディア投稿のみ"
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
{
|
{
|
||||||
"name": "misskey",
|
"name": "misskey",
|
||||||
"author": "syuilo <i@syuilo.com>",
|
"author": "syuilo <i@syuilo.com>",
|
||||||
"version": "8.3.0",
|
"version": "8.8.0",
|
||||||
"clientVersion": "1.0.8825",
|
"clientVersion": "1.0.8842",
|
||||||
"codename": "nighthike",
|
"codename": "nighthike",
|
||||||
"main": "./built/index.js",
|
"main": "./built/index.js",
|
||||||
"private": true,
|
"private": true,
|
||||||
@@ -150,6 +150,7 @@
|
|||||||
"loader-utils": "1.1.0",
|
"loader-utils": "1.1.0",
|
||||||
"lodash.assign": "4.2.0",
|
"lodash.assign": "4.2.0",
|
||||||
"mecab-async": "0.1.2",
|
"mecab-async": "0.1.2",
|
||||||
|
"merge-options": "1.0.1",
|
||||||
"minio": "7.0.0",
|
"minio": "7.0.0",
|
||||||
"mkdirp": "0.5.1",
|
"mkdirp": "0.5.1",
|
||||||
"mocha": "5.2.0",
|
"mocha": "5.2.0",
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
|
|
||||||
Vue.filter('bytes', (v, digits = 0) => {
|
Vue.filter('bytes', (v, digits = 0) => {
|
||||||
const sizes = ['Bytes', 'KB', 'MB', 'GB', 'TB'];
|
const sizes = ['B', 'KB', 'MB', 'GB', 'TB'];
|
||||||
if (v == 0) return '0Byte';
|
if (v == 0) return '0';
|
||||||
|
const isMinus = v < 0;
|
||||||
|
if (isMinus) v = -v;
|
||||||
const i = Math.floor(Math.log(v) / Math.log(1024));
|
const i = Math.floor(Math.log(v) / Math.log(1024));
|
||||||
return (v / Math.pow(1024, i)).toFixed(digits).replace(/\.0+$/, '') + sizes[i];
|
return (isMinus ? '-' : '') + (v / Math.pow(1024, i)).toFixed(digits).replace(/\.0+$/, '') + sizes[i];
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
import Vue from 'vue';
|
import Vue from 'vue';
|
||||||
import { Line } from 'vue-chartjs';
|
import { Line } from 'vue-chartjs';
|
||||||
|
import * as mergeOptions from 'merge-options';
|
||||||
|
|
||||||
export default Vue.extend({
|
export default Vue.extend({
|
||||||
extends: Line,
|
extends: Line,
|
||||||
@@ -21,13 +22,19 @@ export default Vue.extend({
|
|||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
render() {
|
render() {
|
||||||
this.renderChart(this.data, Object.assign({
|
this.renderChart(this.data, mergeOptions({
|
||||||
responsive: false,
|
responsive: true,
|
||||||
|
maintainAspectRatio: false,
|
||||||
scales: {
|
scales: {
|
||||||
xAxes: [{
|
xAxes: [{
|
||||||
type: 'time',
|
type: 'time',
|
||||||
distribution: 'series'
|
distribution: 'series'
|
||||||
}]
|
}]
|
||||||
|
},
|
||||||
|
tooltips: {
|
||||||
|
intersect: false,
|
||||||
|
mode: 'x',
|
||||||
|
position: 'nearest'
|
||||||
}
|
}
|
||||||
}, this.opts || {}));
|
}, this.opts || {}));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,33 +4,29 @@
|
|||||||
<b>%i18n:@title%:</b>
|
<b>%i18n:@title%:</b>
|
||||||
<select v-model="chartType">
|
<select v-model="chartType">
|
||||||
<optgroup label="%i18n:@users%">
|
<optgroup label="%i18n:@users%">
|
||||||
<option value="local-users">%i18n:@local-users%</option>
|
<option value="users">%i18n:@charts.users%</option>
|
||||||
<option value="remote-users">%i18n:@remote-users%</option>
|
<option value="users-total">%i18n:@charts.users-total%</option>
|
||||||
<option value="local-users-total">%i18n:@local-users-total%</option>
|
|
||||||
<option value="remote-users-total">%i18n:@remote-users-total%</option>
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
<optgroup label="%i18n:@notes%">
|
<optgroup label="%i18n:@notes%">
|
||||||
<option value="local-notes">%i18n:@local-notes%</option>
|
<option value="notes">%i18n:@charts.notes%</option>
|
||||||
<option value="remote-notes">%i18n:@remote-notes%</option>
|
<option value="local-notes">%i18n:@charts.local-notes%</option>
|
||||||
<option value="local-notes-total">%i18n:@local-notes-total%</option>
|
<option value="remote-notes">%i18n:@charts.remote-notes%</option>
|
||||||
<option value="remote-notes-total">%i18n:@remote-notes-total%</option>
|
<option value="notes-total">%i18n:@charts.notes-total%</option>
|
||||||
</optgroup>
|
</optgroup>
|
||||||
<optgroup label="%i18n:@drive%">
|
<optgroup label="%i18n:@drive%">
|
||||||
<option value="local-drive-files">%i18n:@local-drive-files%</option>
|
<option value="drive-files">%i18n:@charts.drive-files%</option>
|
||||||
<option value="remote-drive-files">%i18n:@remote-drive-files%</option>
|
<option value="drive-files-total">%i18n:@charts.drive-files-total%</option>
|
||||||
<option value="local-drive-files-total">%i18n:@local-drive-files-total%</option>
|
<option value="drive">%i18n:@charts.drive%</option>
|
||||||
<option value="remote-drive-files-total">%i18n:@remote-drive-files-total%</option>
|
<option value="drive-total">%i18n:@charts.drive-total%</option>
|
||||||
<option value="local-drive">%i18n:@local-drive%</option>
|
|
||||||
<option value="remote-drive">%i18n:@remote-drive%</option>
|
|
||||||
<option value="local-drive-total">%i18n:@local-drive-total%</option>
|
|
||||||
<option value="remote-drive-total">%i18n:@remote-drive-total%</option>
|
|
||||||
</optgroup>
|
</optgroup>
|
||||||
</select>
|
</select>
|
||||||
<div>
|
<div>
|
||||||
<a @click="span = 'day'">%i18n:@per-day%</a> | <a @click="span = 'hour'">%i18n:@per-hour%</a>
|
<span @click="span = 'day'" :class="{ active: span == 'day' }">%i18n:@per-day%</span> | <span @click="span = 'hour'" :class="{ active: span == 'hour' }">%i18n:@per-hour%</span>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
<x-chart v-if="chart" :data="data[0]" :opts="data[1]" :width="720" :height="300"/>
|
<div>
|
||||||
|
<x-chart v-if="chart" :data="data[0]" :opts="data[1]"/>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
@@ -42,14 +38,10 @@ export default Vue.extend({
|
|||||||
components: {
|
components: {
|
||||||
XChart
|
XChart
|
||||||
},
|
},
|
||||||
props: {
|
|
||||||
chart: {
|
|
||||||
required: true
|
|
||||||
}
|
|
||||||
},
|
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
chartType: 'local-notes',
|
chart: null,
|
||||||
|
chartType: 'notes',
|
||||||
span: 'hour'
|
span: 'hour'
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
@@ -57,22 +49,16 @@ export default Vue.extend({
|
|||||||
data(): any {
|
data(): any {
|
||||||
if (this.chart == null) return null;
|
if (this.chart == null) return null;
|
||||||
switch (this.chartType) {
|
switch (this.chartType) {
|
||||||
case 'local-users': return this.usersChart(true, false);
|
case 'users': return this.usersChart(false);
|
||||||
case 'remote-users': return this.usersChart(false, false);
|
case 'users-total': return this.usersChart(true);
|
||||||
case 'local-users-total': return this.usersChart(true, true);
|
case 'notes': return this.notesChart('combined');
|
||||||
case 'remote-users-total': return this.usersChart(false, true);
|
case 'local-notes': return this.notesChart('local');
|
||||||
case 'local-notes': return this.notesChart(true);
|
case 'remote-notes': return this.notesChart('remote');
|
||||||
case 'remote-notes': return this.notesChart(false);
|
case 'notes-total': return this.notesTotalChart();
|
||||||
case 'local-notes-total': return this.notesTotalChart(true);
|
case 'drive': return this.driveChart(false);
|
||||||
case 'remote-notes-total': return this.notesTotalChart(false);
|
case 'drive-total': return this.driveChart(true);
|
||||||
case 'local-drive': return this.driveChart(true, false);
|
case 'drive-files': return this.driveFilesChart(false);
|
||||||
case 'remote-drive': return this.driveChart(false, false);
|
case 'drive-files-total': return this.driveFilesChart(true);
|
||||||
case 'local-drive-total': return this.driveChart(true, true);
|
|
||||||
case 'remote-drive-total': return this.driveChart(false, true);
|
|
||||||
case 'local-drive-files': return this.driveFilesChart(true, false);
|
|
||||||
case 'remote-drive-files': return this.driveFilesChart(false, false);
|
|
||||||
case 'local-drive-files-total': return this.driveFilesChart(true, true);
|
|
||||||
case 'remote-drive-files-total': return this.driveFilesChart(false, true);
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
stats(): any[] {
|
stats(): any[] {
|
||||||
@@ -83,14 +69,19 @@ export default Vue.extend({
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
created() {
|
||||||
|
(this as any).api('chart').then(chart => {
|
||||||
|
this.chart = chart;
|
||||||
|
});
|
||||||
|
},
|
||||||
methods: {
|
methods: {
|
||||||
notesChart(local: boolean): any {
|
notesChart(type: string): any {
|
||||||
const data = this.stats.slice().reverse().map(x => ({
|
const data = this.stats.slice().reverse().map(x => ({
|
||||||
date: new Date(x.date),
|
date: new Date(x.date),
|
||||||
normal: local ? x.notes.local.diffs.normal : x.notes.remote.diffs.normal,
|
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: local ? x.notes.local.diffs.reply : x.notes.remote.diffs.reply,
|
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: local ? x.notes.local.diffs.renote : x.notes.remote.diffs.renote,
|
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,
|
||||||
all: local ? x.notes.local.diff : x.notes.remote.diff
|
all: type == 'local' ? x.notes.local.diff : type == 'remote' ? x.notes.remote.diff : x.notes.local.diff + x.notes.remote.diff
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
@@ -99,128 +90,286 @@ export default Vue.extend({
|
|||||||
fill: false,
|
fill: false,
|
||||||
borderColor: '#555',
|
borderColor: '#555',
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
|
borderDash: [4, 4],
|
||||||
pointBackgroundColor: '#fff',
|
pointBackgroundColor: '#fff',
|
||||||
lineTension: 0,
|
lineTension: 0,
|
||||||
data: data.map(x => ({ t: x.date, y: x.all }))
|
data: data.map(x => ({ t: x.date, y: x.all }))
|
||||||
}, {
|
}, {
|
||||||
label: 'Normal',
|
label: 'Renotes',
|
||||||
fill: false,
|
fill: true,
|
||||||
borderColor: '#41ddde',
|
backgroundColor: 'rgba(161, 222, 65, 0.1)',
|
||||||
|
borderColor: '#a1de41',
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
pointBackgroundColor: '#fff',
|
pointBackgroundColor: '#fff',
|
||||||
lineTension: 0,
|
lineTension: 0,
|
||||||
data: data.map(x => ({ t: x.date, y: x.normal }))
|
data: data.map(x => ({ t: x.date, y: x.renote }))
|
||||||
}, {
|
}, {
|
||||||
label: 'Replies',
|
label: 'Replies',
|
||||||
fill: false,
|
fill: true,
|
||||||
|
backgroundColor: 'rgba(247, 121, 108, 0.1)',
|
||||||
borderColor: '#f7796c',
|
borderColor: '#f7796c',
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
pointBackgroundColor: '#fff',
|
pointBackgroundColor: '#fff',
|
||||||
lineTension: 0,
|
lineTension: 0,
|
||||||
data: data.map(x => ({ t: x.date, y: x.reply }))
|
data: data.map(x => ({ t: x.date, y: x.reply }))
|
||||||
}, {
|
}, {
|
||||||
label: 'Renotes',
|
label: 'Normal',
|
||||||
fill: false,
|
fill: true,
|
||||||
borderColor: '#a1de41',
|
backgroundColor: 'rgba(65, 221, 222, 0.1)',
|
||||||
|
borderColor: '#41ddde',
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
pointBackgroundColor: '#fff',
|
pointBackgroundColor: '#fff',
|
||||||
lineTension: 0,
|
lineTension: 0,
|
||||||
data: data.map(x => ({ t: x.date, y: x.renote }))
|
data: data.map(x => ({ t: x.date, y: x.normal }))
|
||||||
}]
|
|
||||||
}];
|
|
||||||
},
|
|
||||||
|
|
||||||
notesTotalChart(local: boolean): any {
|
|
||||||
const data = this.stats.slice().reverse().map(x => ({
|
|
||||||
date: new Date(x.date),
|
|
||||||
count: local ? x.notes.local.total : x.notes.remote.total,
|
|
||||||
}));
|
|
||||||
|
|
||||||
return [{
|
|
||||||
datasets: [{
|
|
||||||
label: local ? 'Local Notes' : 'Remote Notes',
|
|
||||||
fill: false,
|
|
||||||
borderColor: '#f6584f',
|
|
||||||
borderWidth: 2,
|
|
||||||
pointBackgroundColor: '#fff',
|
|
||||||
lineTension: 0,
|
|
||||||
data: data.map(x => ({ t: x.date, y: x.count }))
|
|
||||||
}]
|
|
||||||
}];
|
|
||||||
},
|
|
||||||
|
|
||||||
usersChart(local: boolean, total: boolean): any {
|
|
||||||
const data = this.stats.slice().reverse().map(x => ({
|
|
||||||
date: new Date(x.date),
|
|
||||||
count: local ?
|
|
||||||
total ? x.users.local.total : x.users.local.diff :
|
|
||||||
total ? x.users.remote.total : x.users.remote.diff
|
|
||||||
}));
|
|
||||||
|
|
||||||
return [{
|
|
||||||
datasets: [{
|
|
||||||
label: local ? 'Local Users' : 'Remote Users',
|
|
||||||
fill: false,
|
|
||||||
borderColor: '#f6584f',
|
|
||||||
borderWidth: 2,
|
|
||||||
pointBackgroundColor: '#fff',
|
|
||||||
lineTension: 0,
|
|
||||||
data: data.map(x => ({ t: x.date, y: x.count }))
|
|
||||||
}]
|
|
||||||
}];
|
|
||||||
},
|
|
||||||
|
|
||||||
driveChart(local: boolean, total: boolean): any {
|
|
||||||
const data = this.stats.slice().reverse().map(x => ({
|
|
||||||
date: new Date(x.date),
|
|
||||||
count: local ?
|
|
||||||
total ? x.drive.local.totalSize : x.drive.local.diffSize :
|
|
||||||
total ? x.drive.remote.totalSize : x.drive.remote.diffSize
|
|
||||||
}));
|
|
||||||
|
|
||||||
return [{
|
|
||||||
datasets: [{
|
|
||||||
label: local ? 'Local Drive Usage' : 'Remote Drive Usage',
|
|
||||||
fill: false,
|
|
||||||
borderColor: '#f6584f',
|
|
||||||
borderWidth: 2,
|
|
||||||
pointBackgroundColor: '#fff',
|
|
||||||
lineTension: 0,
|
|
||||||
data: data.map(x => ({ t: x.date, y: x.count }))
|
|
||||||
}]
|
}]
|
||||||
}, {
|
}, {
|
||||||
scales: {
|
scales: {
|
||||||
yAxes: [{
|
yAxes: [{
|
||||||
ticks: {
|
ticks: {
|
||||||
callback: (value) => {
|
callback: value => {
|
||||||
return Vue.filter('bytes')(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)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
||||||
driveFilesChart(local: boolean, total: boolean): any {
|
notesTotalChart(): any {
|
||||||
const data = this.stats.slice().reverse().map(x => ({
|
const data = this.stats.slice().reverse().map(x => ({
|
||||||
date: new Date(x.date),
|
date: new Date(x.date),
|
||||||
count: local ?
|
localCount: x.notes.local.total,
|
||||||
total ? x.drive.local.totalCount : x.drive.local.diffCount :
|
remoteCount: x.notes.remote.total
|
||||||
total ? x.drive.remote.totalCount : x.drive.remote.diffCount
|
|
||||||
}));
|
}));
|
||||||
|
|
||||||
return [{
|
return [{
|
||||||
datasets: [{
|
datasets: [{
|
||||||
label: local ? 'Local Drive Files' : 'Remote Drive Files',
|
label: 'Notes',
|
||||||
fill: false,
|
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 }))
|
||||||
|
}, {
|
||||||
|
label: 'Remote Notes',
|
||||||
|
fill: true,
|
||||||
|
backgroundColor: 'rgba(65, 221, 222, 0.1)',
|
||||||
|
borderColor: '#41ddde',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.remoteCount }))
|
||||||
|
}, {
|
||||||
|
label: 'Local Notes',
|
||||||
|
fill: true,
|
||||||
|
backgroundColor: 'rgba(246, 88, 79, 0.1)',
|
||||||
borderColor: '#f6584f',
|
borderColor: '#f6584f',
|
||||||
borderWidth: 2,
|
borderWidth: 2,
|
||||||
pointBackgroundColor: '#fff',
|
pointBackgroundColor: '#fff',
|
||||||
lineTension: 0,
|
lineTension: 0,
|
||||||
data: data.map(x => ({ t: x.date, y: x.count }))
|
data: data.map(x => ({ t: x.date, y: x.localCount }))
|
||||||
}]
|
}]
|
||||||
|
}, {
|
||||||
|
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)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}];
|
}];
|
||||||
},
|
},
|
||||||
|
|
||||||
|
usersChart(total: boolean): any {
|
||||||
|
const data = this.stats.slice().reverse().map(x => ({
|
||||||
|
date: new Date(x.date),
|
||||||
|
localCount: total ? x.users.local.total : x.users.local.diff,
|
||||||
|
remoteCount: total ? x.users.remote.total : x.users.remote.diff
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [{
|
||||||
|
datasets: [{
|
||||||
|
label: 'Users',
|
||||||
|
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 }))
|
||||||
|
}, {
|
||||||
|
label: 'Remote Users',
|
||||||
|
fill: true,
|
||||||
|
backgroundColor: 'rgba(65, 221, 222, 0.1)',
|
||||||
|
borderColor: '#41ddde',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.remoteCount }))
|
||||||
|
}, {
|
||||||
|
label: 'Local Users',
|
||||||
|
fill: true,
|
||||||
|
backgroundColor: 'rgba(246, 88, 79, 0.1)',
|
||||||
|
borderColor: '#f6584f',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.localCount }))
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
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)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
},
|
||||||
|
|
||||||
|
driveChart(total: boolean): any {
|
||||||
|
const data = this.stats.slice().reverse().map(x => ({
|
||||||
|
date: new Date(x.date),
|
||||||
|
localSize: total ? x.drive.local.totalSize : x.drive.local.diffSize,
|
||||||
|
remoteSize: total ? x.drive.remote.totalSize : x.drive.remote.diffSize
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [{
|
||||||
|
datasets: [{
|
||||||
|
label: 'Drive Usage',
|
||||||
|
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 }))
|
||||||
|
}, {
|
||||||
|
label: 'Remote Drive Usage',
|
||||||
|
fill: true,
|
||||||
|
backgroundColor: 'rgba(65, 221, 222, 0.1)',
|
||||||
|
borderColor: '#41ddde',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.remoteSize }))
|
||||||
|
}, {
|
||||||
|
label: 'Local Drive Usage',
|
||||||
|
fill: true,
|
||||||
|
backgroundColor: 'rgba(246, 88, 79, 0.1)',
|
||||||
|
borderColor: '#f6584f',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.localSize }))
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
scales: {
|
||||||
|
yAxes: [{
|
||||||
|
ticks: {
|
||||||
|
callback: value => {
|
||||||
|
return Vue.filter('bytes')(value);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
},
|
||||||
|
tooltips: {
|
||||||
|
callbacks: {
|
||||||
|
label: (tooltipItem, data) => {
|
||||||
|
const label = data.datasets[tooltipItem.datasetIndex].label || '';
|
||||||
|
return `${label}: ${Vue.filter('bytes')(tooltipItem.yLabel)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
},
|
||||||
|
|
||||||
|
driveFilesChart(total: boolean): any {
|
||||||
|
const data = this.stats.slice().reverse().map(x => ({
|
||||||
|
date: new Date(x.date),
|
||||||
|
localCount: total ? x.drive.local.totalCount : x.drive.local.diffCount,
|
||||||
|
remoteCount: total ? x.drive.remote.totalCount : x.drive.remote.diffCount
|
||||||
|
}));
|
||||||
|
|
||||||
|
return [{
|
||||||
|
datasets: [{
|
||||||
|
label: 'Drive Files',
|
||||||
|
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 }))
|
||||||
|
}, {
|
||||||
|
label: 'Remote Drive Files',
|
||||||
|
fill: true,
|
||||||
|
backgroundColor: 'rgba(65, 221, 222, 0.1)',
|
||||||
|
borderColor: '#41ddde',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.remoteCount }))
|
||||||
|
}, {
|
||||||
|
label: 'Local Drive Files',
|
||||||
|
fill: true,
|
||||||
|
backgroundColor: 'rgba(246, 88, 79, 0.1)',
|
||||||
|
borderColor: '#f6584f',
|
||||||
|
borderWidth: 2,
|
||||||
|
pointBackgroundColor: '#fff',
|
||||||
|
lineTension: 0,
|
||||||
|
data: data.map(x => ({ t: x.date, y: x.localCount }))
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
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)}`;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
@@ -229,6 +378,9 @@ export default Vue.extend({
|
|||||||
@import '~const.styl'
|
@import '~const.styl'
|
||||||
|
|
||||||
.gkgckalzgidaygcxnugepioremxvxvpt
|
.gkgckalzgidaygcxnugepioremxvxvpt
|
||||||
|
*
|
||||||
|
user-select none
|
||||||
|
|
||||||
> header
|
> header
|
||||||
display flex
|
display flex
|
||||||
|
|
||||||
@@ -238,4 +390,14 @@ export default Vue.extend({
|
|||||||
> *:last-child
|
> *:last-child
|
||||||
margin-left auto
|
margin-left auto
|
||||||
|
|
||||||
|
*
|
||||||
|
&:not(.active)
|
||||||
|
color $theme-color
|
||||||
|
cursor pointer
|
||||||
|
|
||||||
|
> div
|
||||||
|
> *
|
||||||
|
display block
|
||||||
|
height 300px
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<main>
|
<main>
|
||||||
<div v-show="page == 'dashboard'">
|
<div v-show="page == 'dashboard'">
|
||||||
<x-dashboard/>
|
<x-dashboard/>
|
||||||
<x-chart :chart="chart"/>
|
<x-chart/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="page == 'users'">
|
<div v-if="page == 'users'">
|
||||||
<x-suspend-user/>
|
<x-suspend-user/>
|
||||||
@@ -49,11 +49,6 @@ export default Vue.extend({
|
|||||||
chart: null
|
chart: null
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
created() {
|
|
||||||
(this as any).api('admin/chart').then(chart => {
|
|
||||||
this.chart = chart;
|
|
||||||
});
|
|
||||||
},
|
|
||||||
methods: {
|
methods: {
|
||||||
nav(page: string) {
|
nav(page: string) {
|
||||||
this.page = page;
|
this.page = page;
|
||||||
|
|||||||
@@ -1,15 +1,13 @@
|
|||||||
import Stats, { IStats } from '../../../../models/stats';
|
import Stats, { IStats } from '../../../models/stats';
|
||||||
|
|
||||||
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
|
||||||
|
|
||||||
export const meta = {
|
export const meta = {
|
||||||
requireCredential: true,
|
|
||||||
requireAdmin: true
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export default (params: any) => new Promise(async (res, rej) => {
|
export default (params: any) => new Promise(async (res, rej) => {
|
||||||
const daysRange = 90;
|
const daysRange = 30;
|
||||||
const hoursRange = 24;
|
const hoursRange = 30;
|
||||||
|
|
||||||
const now = new Date();
|
const now = new Date();
|
||||||
const y = now.getFullYear();
|
const y = now.getFullYear();
|
||||||
@@ -67,9 +65,53 @@ export default (params: any) => new Promise(async (res, rej) => {
|
|||||||
} else { // 隙間埋め
|
} else { // 隙間埋め
|
||||||
const mostRecent = src.find(s => s.date.getTime() < current.getTime());
|
const mostRecent = src.find(s => s.date.getTime() < current.getTime());
|
||||||
if (mostRecent) {
|
if (mostRecent) {
|
||||||
chart.unshift(Object.assign({}, mostRecent, {
|
chart.unshift({
|
||||||
date: current
|
date: current,
|
||||||
}));
|
users: {
|
||||||
|
local: {
|
||||||
|
total: mostRecent.users.local.total,
|
||||||
|
diff: 0
|
||||||
|
},
|
||||||
|
remote: {
|
||||||
|
total: mostRecent.users.remote.total,
|
||||||
|
diff: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
notes: {
|
||||||
|
local: {
|
||||||
|
total: mostRecent.notes.local.total,
|
||||||
|
diff: 0,
|
||||||
|
diffs: {
|
||||||
|
normal: 0,
|
||||||
|
reply: 0,
|
||||||
|
renote: 0
|
||||||
|
}
|
||||||
|
},
|
||||||
|
remote: {
|
||||||
|
total: mostRecent.notes.remote.total,
|
||||||
|
diff: 0,
|
||||||
|
diffs: {
|
||||||
|
normal: 0,
|
||||||
|
reply: 0,
|
||||||
|
renote: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
drive: {
|
||||||
|
local: {
|
||||||
|
totalCount: mostRecent.drive.local.totalCount,
|
||||||
|
totalSize: mostRecent.drive.local.totalSize,
|
||||||
|
diffCount: 0,
|
||||||
|
diffSize: 0
|
||||||
|
},
|
||||||
|
remote: {
|
||||||
|
totalCount: mostRecent.drive.remote.totalCount,
|
||||||
|
totalSize: mostRecent.drive.remote.totalSize,
|
||||||
|
diffCount: 0,
|
||||||
|
diffSize: 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
} else {
|
} else {
|
||||||
chart.unshift({
|
chart.unshift({
|
||||||
date: current,
|
date: current,
|
||||||
@@ -40,7 +40,7 @@ async function save(path: string, name: string, type: string, hash: string, size
|
|||||||
const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}/${name}.thumbnail.jpg`;
|
const thumbnailKey = `${config.drive.prefix}/${uuid.v4()}/${name}.thumbnail.jpg`;
|
||||||
|
|
||||||
const baseUrl = config.drive.baseUrl
|
const baseUrl = config.drive.baseUrl
|
||||||
|| `${ config.drive.config.secure ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? ':' + config.drive.config.port : '' }/${ config.drive.bucket }`;
|
|| `${ config.drive.config.useSSL ? 'https' : 'http' }://${ config.drive.config.endPoint }${ config.drive.config.port ? ':' + config.drive.config.port : '' }/${ config.drive.bucket }`;
|
||||||
|
|
||||||
await minio.putObject(config.drive.bucket, key, fs.createReadStream(path), size, {
|
await minio.putObject(config.drive.bucket, key, fs.createReadStream(path), size, {
|
||||||
'Content-Type': type,
|
'Content-Type': type,
|
||||||
|
|||||||
Reference in New Issue
Block a user