diff --git a/frontend/vue/components/Admin/StorageLocations.vue b/frontend/vue/components/Admin/StorageLocations.vue
index 9abaeafd1..cf051b555 100644
--- a/frontend/vue/components/Admin/StorageLocations.vue
+++ b/frontend/vue/components/Admin/StorageLocations.vue
@@ -34,6 +34,18 @@
{{ getAdapterName(row.item.adapter) }}
{{ row.item.uri }}
+
+
+
+
+
+ {{ getSpaceUsed(row.item) }}
+
+
+ {{ getSpaceUsed(row.item) }}
+
+
{{ row.item.stations.join(', ') }}
@@ -59,9 +71,10 @@ export default {
return {
activeType: 'station_media',
fields: [
- { key: 'actions', label: this.$gettext('Actions'), sortable: false },
- { key: 'adapter', label: this.$gettext('Adapter'), sortable: false },
- { key: 'stations', label: this.$gettext('Station(s)'), sortable: false }
+ {key: 'actions', label: this.$gettext('Actions'), sortable: false},
+ {key: 'adapter', label: this.$gettext('Adapter'), sortable: false},
+ {key: 'space', label: this.$gettext('Space Used'), class: 'text-nowrap', sortable: false},
+ {key: 'stations', label: this.$gettext('Station(s)'), sortable: false}
]
};
},
@@ -99,16 +112,30 @@ export default {
return this.$gettext('Remote: Dropbox');
}
},
- relist () {
+ getSpaceUsed(item) {
+ return (item.storageAvailable)
+ ? item.storageUsed + ' / ' + item.storageAvailable
+ : item.storageUsed;
+ },
+ getProgressVariant(percent) {
+ if (percent > 85) {
+ return 'danger';
+ } else if (percent > 65) {
+ return 'warning';
+ } else {
+ return 'default';
+ }
+ },
+ relist() {
this.$refs.datatable.refresh();
},
- doCreate () {
+ doCreate() {
this.$refs.editModal.create();
},
- doEdit (url) {
+ doEdit(url) {
this.$refs.editModal.edit(url);
},
- doModify (url) {
+ doModify(url) {
this.$notify(this.$gettext('Applying changes...'), {
variant: 'warning'
});
diff --git a/src/Controller/Api/Admin/StorageLocationsController.php b/src/Controller/Api/Admin/StorageLocationsController.php
index 197990d66..b4cdd156e 100644
--- a/src/Controller/Api/Admin/StorageLocationsController.php
+++ b/src/Controller/Api/Admin/StorageLocationsController.php
@@ -132,11 +132,19 @@ class StorageLocationsController extends AbstractAdminApiCrudController
/** @inheritDoc */
protected function viewRecord(object $record, ServerRequest $request): object
{
+ /** @var Entity\StorageLocation $record */
$original = parent::viewRecord($record, $request);
$return = new Entity\Api\Admin\StorageLocation();
$return->fromParentObject($original);
+ $return->storageQuotaBytes = (string)($record->getStorageQuotaBytes() ?? '');
+ $return->storageUsedBytes = (string)$record->getStorageUsedBytes();
+ $return->storageUsedPercent = $record->getStorageUsePercentage();
+ $return->storageAvailable = $record->getStorageAvailable();
+ $return->storageAvailableBytes = (string)($record->getStorageAvailableBytes() ?? '');
+ $return->isFull = $record->isStorageFull();
+
$return->uri = $record->getUri();
$stationsRaw = $this->storageLocationRepo->getStationsUsingLocation($record);
diff --git a/src/Entity/Api/Admin/StorageLocation.php b/src/Entity/Api/Admin/StorageLocation.php
index a010d2fb8..9500b9434 100644
--- a/src/Entity/Api/Admin/StorageLocation.php
+++ b/src/Entity/Api/Admin/StorageLocation.php
@@ -82,12 +82,48 @@ class StorageLocation
*/
public ?string $storageQuota = null;
+ /**
+ * @OA\Property(example="120000")
+ * @var string|null
+ */
+ public ?string $storageQuotaBytes = null;
+
/**
* @OA\Property(example="1 GB")
* @var string|null
*/
public ?string $storageUsed = null;
+ /**
+ * @OA\Property(example="60000")
+ * @var string|null
+ */
+ public ?string $storageUsedBytes = null;
+
+ /**
+ * @OA\Property(example="1 GB")
+ * @var string|null
+ */
+ public ?string $storageAvailable = null;
+
+ /**
+ * @OA\Property(example="120000")
+ * @var string|null
+ */
+ public ?string $storageAvailableBytes = null;
+
+ /**
+ * @OA\Property(example="75")
+ * @var int|null
+ */
+ public ?int $storageUsedPercent = null;
+
+ /**
+ * @OA\Property(example="true")
+ * @var bool
+ */
+ public bool $isFull = true;
+
/**
* The URI associated with the storage location.
*
diff --git a/src/Entity/StorageLocation.php b/src/Entity/StorageLocation.php
index d4b0631a3..8d2d16a04 100644
--- a/src/Entity/StorageLocation.php
+++ b/src/Entity/StorageLocation.php
@@ -92,16 +92,10 @@ class StorageLocation implements Stringable, IdentifiableEntityInterface
#[ORM\Column(name: 'storage_quota', type: 'bigint', nullable: true)]
protected ?string $storageQuota = null;
- // Used for API generation.
- protected ?string $storageQuotaBytes = null;
-
#[ORM\Column(name: 'storage_used', type: 'bigint', nullable: true)]
#[Attributes\AuditIgnore]
protected ?string $storageUsed = null;
- // Used for API generation.
- protected ?string $storageUsedBytes = null;
-
#[ORM\OneToMany(mappedBy: 'storage_location', targetEntity: StationMedia::class)]
protected Collection $media;