From dbc0115c06dddc262b065a355bd234d42fb95cb5 Mon Sep 17 00:00:00 2001 From: catborise Date: Sun, 1 Nov 2026 22:57:02 +0300 Subject: [PATCH] feat(instances): a template's page is a template's A template's page was a VM's: it opened on Power, with only a note there that a template is not started, while its clone form waited in a section of Settings, next to a console, access, snapshots and stats that a VM that never runs has no use for. A template's page now carries a Template badge and a Clone button, opens on the clone form, and leaves out Power, Access, Snapshot, Stats, the console settings, host devices and the guest agent and address lines; Resize, Settings and Destroy stay for whoever may change it. A page that no section opens shows its first. --- instances/templates/instance.html | 31 +++++++++++++++++++++--- instances/tests/test_page_controls.py | 35 +++++++++++++++++---------- instances/views.py | 6 +++-- 3 files changed, 53 insertions(+), 19 deletions(-) diff --git a/instances/templates/instance.html b/instances/templates/instance.html index 4b3df9ad..7cca6f16 100644 --- a/instances/templates/instance.html +++ b/instances/templates/instance.html @@ -20,17 +20,22 @@

{{ instance.name }}

{% vm_state instance.status as state %} {{ state.0 }} + {% if instance.is_template %}{% trans "Template" %}{% endif %} {% if instance.title %}

{{ instance.title }}

{% endif %} {% include 'instances/host_link.html' %}
+ {% if instance.is_template and can_clone %} + + {% endif %} {% if instance.guest_agent_ready %} {% endif %} {% bs_icon 'arrow-clockwise' %} {% trans "Refresh" %}
+ {% if not instance.is_template %}
{% if not instance.guest_agent %} {% bs_icon 'dash-circle' %} {% trans "Guest agent off" %} @@ -41,6 +46,7 @@ {% endif %} {% bs_icon 'camera' %} {% blocktrans count counter=instance.snapshots|length %}{{ counter }} snapshot{% plural %}{{ counter }} snapshots{% endblocktrans %}
+ {% endif %}
{% trans "CPU" %}
@@ -54,24 +60,29 @@
{% trans "Disks" %}
{% for disk in instance.disks %}{{ disk.dev }} {{ disk.size|filesizeformat }}{% if not forloop.last %} · {% endif %}{% empty %}{% trans "None" %}{% endfor %}
+ {% if not instance.is_template %}
{% trans "IPv4" %}
{{ ipv4_addresses|join:", "|default:"—" }}
+ {% endif %}