Introduce per-instance chart (#4183)

* Introduce per-instance chart

* Implement chart view in client

* Handle note deleting

* More chart srcs

* Add drive stats

* Improve drive stats

* Fix bug

* Add icon
This commit is contained in:
syuilo
2019-02-08 16:58:57 +09:00
committed by GitHub
parent f35688bab8
commit 56275bcfcb
17 changed files with 746 additions and 13 deletions

View File

@ -0,0 +1,42 @@
import $ from 'cafy';
import define from '../../define';
import instanceChart from '../../../../services/chart/instance';
export const meta = {
stability: 'stable',
desc: {
'ja-JP': 'インスタンスごとのチャートを取得します。'
},
params: {
span: {
validator: $.str.or(['day', 'hour']),
desc: {
'ja-JP': '集計のスパン (day または hour)'
}
},
limit: {
validator: $.num.optional.range(1, 500),
default: 30,
desc: {
'ja-JP': '最大数。例えば 30 を指定したとすると、スパンが"day"の場合は30日分のデータが、スパンが"hour"の場合は30時間分のデータが返ります。'
}
},
host: {
validator: $.str,
desc: {
'ja-JP': '対象のインスタンスのホスト',
'en-US': 'Target instance host'
}
}
}
};
export default define(meta, (ps) => new Promise(async (res, rej) => {
const stats = await instanceChart.getChart(ps.span as any, ps.limit, ps.host);
res(stats);
}));

View File

@ -70,6 +70,22 @@ export default define(meta, (ps, me) => new Promise(async (res, rej) => {
sort = {
caughtAt: 1
};
} else if (ps.sort == '+driveUsage') {
sort = {
driveUsage: -1
};
} else if (ps.sort == '-driveUsage') {
sort = {
driveUsage: 1
};
} else if (ps.sort == '+driveFiles') {
sort = {
driveFiles: -1
};
} else if (ps.sort == '-driveFiles') {
sort = {
driveFiles: 1
};
}
} else {
sort = {