fix
parent
bb14adb8bc
commit
79bc2668e1
|
@ -7,6 +7,7 @@ from selfprivacy_api.services import get_service_by_id, get_services_by_location
|
||||||
from selfprivacy_api.services import Service as ServiceInterface
|
from selfprivacy_api.services import Service as ServiceInterface
|
||||||
from selfprivacy_api.utils.block_devices import BlockDevices
|
from selfprivacy_api.utils.block_devices import BlockDevices
|
||||||
|
|
||||||
|
|
||||||
def get_usages(root: "StorageVolume") -> list["StorageUsageInterface"]:
|
def get_usages(root: "StorageVolume") -> list["StorageUsageInterface"]:
|
||||||
"""Get usages of a volume"""
|
"""Get usages of a volume"""
|
||||||
return [
|
return [
|
||||||
|
@ -19,6 +20,7 @@ def get_usages(root: "StorageVolume") -> list["StorageUsageInterface"]:
|
||||||
for service in get_services_by_location(root.name)
|
for service in get_services_by_location(root.name)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
@strawberry.type
|
@strawberry.type
|
||||||
class StorageVolume:
|
class StorageVolume:
|
||||||
"""Stats and basic info about a volume or a system disk."""
|
"""Stats and basic info about a volume or a system disk."""
|
||||||
|
@ -34,7 +36,6 @@ class StorageVolume:
|
||||||
usages: list["StorageUsageInterface"] = strawberry.field(resolver=get_usages)
|
usages: list["StorageUsageInterface"] = strawberry.field(resolver=get_usages)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@strawberry.interface
|
@strawberry.interface
|
||||||
class StorageUsageInterface:
|
class StorageUsageInterface:
|
||||||
used_space: str
|
used_space: str
|
||||||
|
@ -132,13 +133,4 @@ def get_volume_by_id(volume_id: str) -> typing.Optional[StorageVolume]:
|
||||||
model=volume.model,
|
model=volume.model,
|
||||||
serial=volume.serial,
|
serial=volume.serial,
|
||||||
type=volume.type,
|
type=volume.type,
|
||||||
usages=[
|
|
||||||
ServiceStorageUsage(
|
|
||||||
service=service_to_graphql_service(service),
|
|
||||||
title=service.get_display_name(),
|
|
||||||
used_space=str(service.get_storage_usage()),
|
|
||||||
volume=get_volume_by_id(service.get_location()),
|
|
||||||
)
|
|
||||||
for service in get_services_by_location(volume.name)
|
|
||||||
],
|
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue