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

@@ -4,7 +4,10 @@ import DriveFileThumbnail, { DriveFileThumbnailChunk } from '../../models/drive-
import config from '../../config';
import driveChart from '../../services/chart/drive';
import perUserDriveChart from '../../services/chart/per-user-drive';
import instanceChart from '../../services/chart/instance';
import DriveFileWebpublic, { DriveFileWebpublicChunk } from '../../models/drive-file-webpublic';
import Instance from '../../models/instance';
import { isRemoteUser } from '../../models/user';
export default async function(file: IDriveFile, isExpired = false) {
if (file.metadata.storage == 'minio') {
@@ -84,4 +87,13 @@ export default async function(file: IDriveFile, isExpired = false) {
// 統計を更新
driveChart.update(file, false);
perUserDriveChart.update(file, false);
if (isRemoteUser(file.metadata._user)) {
instanceChart.updateDrive(file, false);
Instance.update({ host: file.metadata._user.host }, {
$inc: {
driveUsage: -file.length,
driveFiles: -1
}
});
}
}