1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00

feat(instances): the Power tab shows the VM's state and where each action takes it

The tab put Power Off and Suspend, then Power Cycle and Force Off, in
joined button groups with a paragraph under each, so which sentence
told which button was left to the reader, and the two power cuts
looked like one control as large as the rest.

Now the tab shows the three states a VM moves between, Active,
Suspended and Off, the current one marked, and under each the action
that takes the VM there with one line on what it does. The power cuts
are small outlined buttons on a line of their own with one warning;
their confirmations stay. A state outside the three (shutting down,
crashed) is named above them. The test of the tab now finds the
outlined power-cut buttons, which its class match missed.
This commit is contained in:
catborise 2026-11-03 19:15:43 +03:00
parent ed4ebd26df
commit 8e722a376b
9 changed files with 694 additions and 759 deletions

View file

@ -67,7 +67,7 @@ from . import addresses, report, utils
from .api.serializers import DestroyOptionsSerializer
from .forms import ConsoleForm, FlavorForm, NewVMForm
from .models import Flavor
from .states import STATES, UNKNOWN, allowed_actions, state_label
from .states import POWER_STATES, STATES, UNKNOWN, allowed_actions, state_label
# the VM page waits this long (seconds) for the compute's drbdadm status
DRBD_STATUS_TIMEOUT = 10
@ -295,6 +295,7 @@ def _instance_page(request, pk, instance, compute):
can_open_console = utils.can_open_console(request.user, instance)
can_power = request.user.is_superuser or userinstance is not None
power_actions = allowed_actions(request.user, instance, instance.status)
power_states = POWER_STATES # the power tab names any other state above its strip
# a remote viewer on the user's computer reaches a VNC or SPICE console that listens beyond the host's loopback
vdi_reachable = instance.console_type in ("vnc", "spice") and not util.is_loopback(instance.console_listener_address)
# root's password and keys change in a shut-off VM's disk (gstfsd on the host), or through a running VM's agent