2019-11-08 05:38:28 +08:00
|
|
|
import discourseComputed from "discourse-common/utils/decorators";
|
2019-10-31 04:28:29 +08:00
|
|
|
import { alias } from "@ember/object/computed";
|
2019-10-24 00:30:52 +08:00
|
|
|
import Component from "@ember/component";
|
2018-12-15 06:14:46 +08:00
|
|
|
import { setting } from "discourse/lib/computed";
|
|
|
|
|
2019-10-24 00:30:52 +08:00
|
|
|
export default Component.extend({
|
2018-12-15 06:14:46 +08:00
|
|
|
classNames: ["admin-report-storage-stats"],
|
|
|
|
|
|
|
|
backupLocation: setting("backup_location"),
|
2019-10-31 04:28:29 +08:00
|
|
|
backupStats: alias("model.data.backups"),
|
|
|
|
uploadStats: alias("model.data.uploads"),
|
2018-12-15 06:14:46 +08:00
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("backupStats")
|
2018-12-15 06:14:46 +08:00
|
|
|
showBackupStats(stats) {
|
|
|
|
return stats && this.currentUser.admin;
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("backupLocation")
|
2018-12-15 06:14:46 +08:00
|
|
|
backupLocationName(backupLocation) {
|
|
|
|
return I18n.t(`admin.backups.location.${backupLocation}`);
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("backupStats.used_bytes")
|
2018-12-15 06:14:46 +08:00
|
|
|
usedBackupSpace(bytes) {
|
|
|
|
return I18n.toHumanSize(bytes);
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("backupStats.free_bytes")
|
2018-12-15 06:14:46 +08:00
|
|
|
freeBackupSpace(bytes) {
|
|
|
|
return I18n.toHumanSize(bytes);
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("uploadStats.used_bytes")
|
2018-12-15 06:14:46 +08:00
|
|
|
usedUploadSpace(bytes) {
|
|
|
|
return I18n.toHumanSize(bytes);
|
|
|
|
},
|
|
|
|
|
2019-11-08 05:38:28 +08:00
|
|
|
@discourseComputed("uploadStats.free_bytes")
|
2018-12-15 06:14:46 +08:00
|
|
|
freeUploadSpace(bytes) {
|
|
|
|
return I18n.toHumanSize(bytes);
|
|
|
|
}
|
|
|
|
});
|