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