mirror of
https://gh.wpcy.net/https://github.com/discourse/discourse.git
synced 2026-05-24 23:20:39 +08:00
`discourse-common` was created in the past to share logic between the 'wizard' app and the main 'discourse' app. Since then, the wizard has been consolidated into the main app, so the separation of `discourse-common` is no longer useful. This commit moves `discourse-common/(lib|utils)/*` into `discourse/lib/*`, adds shims for the imports, and updates existing uses in core.
45 lines
1.2 KiB
JavaScript
Vendored
45 lines
1.2 KiB
JavaScript
Vendored
import Component from "@ember/component";
|
|
import { alias } from "@ember/object/computed";
|
|
import { classNames } from "@ember-decorators/component";
|
|
import { setting } from "discourse/lib/computed";
|
|
import discourseComputed from "discourse/lib/decorators";
|
|
import I18n, { i18n } from "discourse-i18n";
|
|
|
|
@classNames("admin-report-storage-stats")
|
|
export default class AdminReportStorageStats extends Component {
|
|
@setting("backup_location") backupLocation;
|
|
|
|
@alias("model.data.backups") backupStats;
|
|
|
|
@alias("model.data.uploads") uploadStats;
|
|
|
|
@discourseComputed("backupStats")
|
|
showBackupStats(stats) {
|
|
return stats && this.currentUser.admin;
|
|
}
|
|
|
|
@discourseComputed("backupLocation")
|
|
backupLocationName(backupLocation) {
|
|
return i18n(`admin.backups.location.${backupLocation}`);
|
|
}
|
|
|
|
@discourseComputed("backupStats.used_bytes")
|
|
usedBackupSpace(bytes) {
|
|
return I18n.toHumanSize(bytes);
|
|
}
|
|
|
|
@discourseComputed("backupStats.free_bytes")
|
|
freeBackupSpace(bytes) {
|
|
return I18n.toHumanSize(bytes);
|
|
}
|
|
|
|
@discourseComputed("uploadStats.used_bytes")
|
|
usedUploadSpace(bytes) {
|
|
return I18n.toHumanSize(bytes);
|
|
}
|
|
|
|
@discourseComputed("uploadStats.free_bytes")
|
|
freeUploadSpace(bytes) {
|
|
return I18n.toHumanSize(bytes);
|
|
}
|
|
}
|