mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
fix(storages): the pool page measures its pool fresh, shares one clone dialog and says what it cannot show
- The page lists the volumes first: that refreshes the pool, and libvirt measures a pool's space only when it is refreshed, so the size and usage shown were as of the previous refresh. - A space that cannot be read says so instead of 0 bytes, and the pool's status, read from the same pool info, no longer fails the page after it; a stopped pool says its space and volumes are unavailable until it is started, instead of 0 bytes and nothing. - The API's pool is measured after the same refresh, and a stopped pool lists no volumes there instead of failing. - A clone the job refuses (a name in use, a volume gone) is a message on the page, not a server error. - An ISO image is recognised by its name (storages.jobs.is_iso): libvirt calls its format raw, so the template's "iso" check never disabled its Clone button. The clone job refuses one too; the upload uses the same rule. - One clone dialog serves every volume, filled and reset by the button that opens it, instead of one dialog per volume in the page; its fields have labels and its title names the dialog. - Volume rows are searched by name only (data-search), with a message when none matches, in a live region for screen readers; names show in full. The search script loads only with the volume table: on a stopped pool's page it failed for want of a search box. An empty pool says "This pool has no volumes". - The unused wvmStorage.get_volumes_details goes: update_volumes is the same.
This commit is contained in:
parent
3aac8f51f2
commit
fa5a8c4d6e
7 changed files with 239 additions and 139 deletions
|
|
@ -49,15 +49,20 @@ class StorageViewSet(viewsets.ViewSet):
|
|||
compute.hostname, compute.login, compute.password, compute.type, pk
|
||||
)
|
||||
|
||||
state = conn.is_active()
|
||||
# first: it refreshes the pool, and libvirt measures a pool's space only then;
|
||||
# a stopped pool lists none
|
||||
volumes = conn.update_volumes() if state else None
|
||||
size, free = conn.get_size()
|
||||
infoset = {
|
||||
"state": conn.is_active(),
|
||||
"size": conn.get_size()[0],
|
||||
"free": conn.get_size()[1],
|
||||
"state": state,
|
||||
"size": size,
|
||||
"free": free,
|
||||
"status": conn.get_status(),
|
||||
"path": conn.get_target_path(),
|
||||
"type": conn.get_type(),
|
||||
"autostart": conn.get_autostart(),
|
||||
"volumes": conn.update_volumes(),
|
||||
"volumes": volumes,
|
||||
}
|
||||
|
||||
serializer = StorageSerializer(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue