Compare commits

...

17 Commits

Author SHA1 Message Date
syuilo 5ba36efcd2 Merge pull request #2446 from syuilo/develop
8.7.0
2018-08-24 09:39:57 +09:00
syuilo fd497ef105 8.7.0 2018-08-24 09:39:37 +09:00
syuilo 9c4a7bf94c Improve chart 2018-08-24 09:39:16 +09:00
syuilo 91f8adc138 Merge pull request #2445 from syuilo/develop
8.6.0
2018-08-24 08:57:54 +09:00
syuilo 69fa2373cb 8.6.0 2018-08-24 08:57:31 +09:00
syuilo 8b37fc4772 Improve chart 2018-08-24 08:56:57 +09:00
syuilo 81e4ed9591 Merge pull request #2444 from syuilo/develop
8.5.1
2018-08-24 08:36:01 +09:00
syuilo 9cda89ec04 8.5.1 2018-08-24 08:35:38 +09:00
syuilo fc180f030f Fix bug 2018-08-24 08:35:01 +09:00
syuilo a827b6028d Merge pull request #2442 from syuilo/develop
8.5.0
2018-08-24 07:24:08 +09:00
syuilo 4517bf7342 8.5.0 2018-08-24 07:23:42 +09:00
syuilo b21287262e チャート取得APIを誰でも利用できるようにするなど 2018-08-24 07:23:04 +09:00
syuilo c1b47a2119 Add missing changelog 2018-08-24 07:20:26 +09:00
syuilo caf625afee Merge pull request #2441 from syuilo/develop
8.4.0
2018-08-24 07:18:00 +09:00
syuilo 2bad3865a3 8.4.0 2018-08-24 07:17:40 +09:00
syuilo 3f7d248684 Improve chart 2018-08-24 07:17:17 +09:00
syuilo 6e179e7cde Fix 2018-08-24 07:06:25 +09:00
9 changed files with 85 additions and 48 deletions
+10
View File
@@ -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
----- -----
+18 -18
View File
@@ -941,27 +941,27 @@ 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: "ローカルの投稿" local-notes: "ローカルの投稿の増減"
remote-notes: "リモートの投稿" remote-notes: "リモートの投稿の増減"
local-notes-total: "ローカルの投稿 (累計)" local-notes-total: "ローカルの投稿累計"
remote-notes-total: "リモートの投稿 (累計)" remote-notes-total: "リモートの投稿累計"
local-users: "ローカルのユーザー" local-users: "ローカルのユーザーの増減"
remote-users: "リモートのユーザー" remote-users: "リモートのユーザーの増減"
local-users-total: "ローカルのユーザー (累計)" local-users-total: "ローカルのユーザー累計"
remote-users-total: "リモートのユーザー (累計)" remote-users-total: "リモートのユーザー累計"
local-drive: "ローカルのドライブ使用量" local-drive: "ローカルのドライブ使用量の増減"
remote-drive: "リモートのドライブ使用量" remote-drive: "リモートのドライブ使用量の増減"
local-drive-total: "ローカルのドライブ使用量 (累計)" local-drive-total: "ローカルのドライブ使用量累計"
remote-drive-total: "リモートのドライブ使用量 (累計)" remote-drive-total: "リモートのドライブ使用量累計"
local-drive-files: "ローカルのドライブのファイル数" local-drive-files: "ローカルのドライブのファイル数の増減"
remote-drive-files: "リモートのドライブのファイル数" remote-drive-files: "リモートのドライブのファイル数の増減"
local-drive-files-total: "ローカルのドライブのファイル数 (累計)" local-drive-files-total: "ローカルのドライブのファイル数累計"
remote-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: "メディア投稿のみ"
+2 -2
View File
@@ -1,8 +1,8 @@
{ {
"name": "misskey", "name": "misskey",
"author": "syuilo <i@syuilo.com>", "author": "syuilo <i@syuilo.com>",
"version": "8.3.1", "version": "8.7.0",
"clientVersion": "1.0.8828", "clientVersion": "1.0.8840",
"codename": "nighthike", "codename": "nighthike",
"main": "./built/index.js", "main": "./built/index.js",
"private": true, "private": true,
+5 -3
View File
@@ -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];
}); });
@@ -23,12 +23,18 @@ export default Vue.extend({
methods: { methods: {
render() { render() {
this.renderChart(this.data, mergeOptions({ 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 || {}));
} }
@@ -30,7 +30,9 @@
<a @click="span = 'day'">%i18n:@per-day%</a> | <a @click="span = 'hour'">%i18n:@per-hour%</a> <a @click="span = 'day'">%i18n:@per-day%</a> | <a @click="span = 'hour'">%i18n:@per-hour%</a>
</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,13 +44,9 @@ export default Vue.extend({
components: { components: {
XChart XChart
}, },
props: {
chart: {
required: true
}
},
data() { data() {
return { return {
chart: null,
chartType: 'local-notes', chartType: 'local-notes',
span: 'hour' span: 'hour'
}; };
@@ -83,6 +81,11 @@ export default Vue.extend({
); );
} }
}, },
created() {
(this as any).api('chart').then(chart => {
this.chart = chart;
});
},
methods: { methods: {
notesChart(local: boolean): any { notesChart(local: boolean): any {
const data = this.stats.slice().reverse().map(x => ({ const data = this.stats.slice().reverse().map(x => ({
@@ -99,12 +102,14 @@ 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: 'Normal',
fill: false, fill: true,
backgroundColor: 'rgba(65, 221, 222, 0.1)',
borderColor: '#41ddde', borderColor: '#41ddde',
borderWidth: 2, borderWidth: 2,
pointBackgroundColor: '#fff', pointBackgroundColor: '#fff',
@@ -112,7 +117,8 @@ export default Vue.extend({
data: data.map(x => ({ t: x.date, y: x.normal })) data: data.map(x => ({ t: x.date, y: x.normal }))
}, { }, {
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',
@@ -120,7 +126,8 @@ export default Vue.extend({
data: data.map(x => ({ t: x.date, y: x.reply })) data: data.map(x => ({ t: x.date, y: x.reply }))
}, { }, {
label: 'Renotes', label: 'Renotes',
fill: false, fill: true,
backgroundColor: 'rgba(161, 222, 65, 0.1)',
borderColor: '#a1de41', borderColor: '#a1de41',
borderWidth: 2, borderWidth: 2,
pointBackgroundColor: '#fff', pointBackgroundColor: '#fff',
@@ -139,7 +146,8 @@ export default Vue.extend({
return [{ return [{
datasets: [{ datasets: [{
label: local ? 'Local Notes' : 'Remote Notes', label: local ? 'Local Notes' : 'Remote Notes',
fill: false, fill: true,
backgroundColor: 'rgba(246, 88, 79, 0.1)',
borderColor: '#f6584f', borderColor: '#f6584f',
borderWidth: 2, borderWidth: 2,
pointBackgroundColor: '#fff', pointBackgroundColor: '#fff',
@@ -160,7 +168,8 @@ export default Vue.extend({
return [{ return [{
datasets: [{ datasets: [{
label: local ? 'Local Users' : 'Remote Users', label: local ? 'Local Users' : 'Remote Users',
fill: false, fill: true,
backgroundColor: 'rgba(246, 88, 79, 0.1)',
borderColor: '#f6584f', borderColor: '#f6584f',
borderWidth: 2, borderWidth: 2,
pointBackgroundColor: '#fff', pointBackgroundColor: '#fff',
@@ -181,7 +190,8 @@ export default Vue.extend({
return [{ return [{
datasets: [{ datasets: [{
label: local ? 'Local Drive Usage' : 'Remote Drive Usage', label: local ? 'Local Drive Usage' : 'Remote Drive Usage',
fill: false, fill: true,
backgroundColor: 'rgba(246, 88, 79, 0.1)',
borderColor: '#f6584f', borderColor: '#f6584f',
borderWidth: 2, borderWidth: 2,
pointBackgroundColor: '#fff', pointBackgroundColor: '#fff',
@@ -192,11 +202,18 @@ export default Vue.extend({
scales: { scales: {
yAxes: [{ yAxes: [{
ticks: { ticks: {
callback: (value) => { callback: value => {
return Vue.filter('bytes')(value); return Vue.filter('bytes')(value);
} }
} }
}] }]
},
tooltips: {
callbacks: {
label: tooltipItem => {
return Vue.filter('bytes')(tooltipItem.yLabel);
}
}
} }
}]; }];
}, },
@@ -212,7 +229,8 @@ export default Vue.extend({
return [{ return [{
datasets: [{ datasets: [{
label: local ? 'Local Drive Files' : 'Remote Drive Files', label: local ? 'Local Drive Files' : 'Remote Drive Files',
fill: false, fill: true,
backgroundColor: 'rgba(246, 88, 79, 0.1)',
borderColor: '#f6584f', borderColor: '#f6584f',
borderWidth: 2, borderWidth: 2,
pointBackgroundColor: '#fff', pointBackgroundColor: '#fff',
@@ -229,6 +247,9 @@ export default Vue.extend({
@import '~const.styl' @import '~const.styl'
.gkgckalzgidaygcxnugepioremxvxvpt .gkgckalzgidaygcxnugepioremxvxvpt
*
user-select none
> header > header
display flex display flex
@@ -238,4 +259,9 @@ export default Vue.extend({
> *:last-child > *:last-child
margin-left auto margin-left auto
> 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,10 +1,8 @@
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) => {
+1 -1
View File
@@ -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,