mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 11:46:49 +00:00
The console page is /console/<compute>/<uuid>/ with the view and display options in the query. It was /console/?token=<compute>-<uuid>, a "token" that was only the VM's address, parsed alongside a signed token that no link ever sent. The list's console button takes the VM's UUID from the database instead of asking libvirt for each row, and no longer defines a global function per row.
69 lines
4 KiB
HTML
69 lines
4 KiB
HTML
{% load i18n %}
|
|
{% load bootstrap_icons %}
|
|
{% load vm_states %}
|
|
{% vm_actions instance as actions %}
|
|
{% if actions %}
|
|
<div class="btn-group" role="group" aria-label="Instance actions">
|
|
{% if "clone" in actions %}
|
|
<a href="{% url 'instances:instance' instance.id %}#clone" class="btn btn-sm btn-secondary" title="{% trans "Clone" %}">
|
|
{% bs_icon 'copy' %}
|
|
</a>
|
|
{% elif "poweron" in actions %}
|
|
<form action="{% url 'instances:poweron' instance.id %}" method="post" style="display:inline;" onsubmit="showPleaseWaitDialog()">
|
|
{% csrf_token %}
|
|
<button type="submit" class="btn btn-sm btn-secondary" title="{% trans "Power On" %}">{% bs_icon 'play-fill' %}</button>
|
|
</form>
|
|
{% elif "resume" in actions %}
|
|
<form action="{% url 'instances:resume' instance.id %}" method="post" style="display:inline;">
|
|
{% csrf_token %}
|
|
<button type="submit" class="btn btn-sm btn-secondary" title="{% trans "Resume" %}">{% bs_icon 'play-fill' %}</button>
|
|
</form>
|
|
{% else %}
|
|
<button class="btn btn-sm btn-secondary disabled" title="{% trans "Power On" %}" disabled>{% bs_icon 'play-fill' %}</button>
|
|
{% endif %}
|
|
|
|
{% if "suspend" in actions %}
|
|
<form action="{% url 'instances:suspend' instance.id %}" method="post" style="display:inline;">
|
|
{% csrf_token %}
|
|
<button type="submit" class="btn btn-sm btn-secondary" title="{% trans "Suspend" %}">{% bs_icon 'pause-fill' %}</button>
|
|
</form>
|
|
{% else %}
|
|
<button class="btn btn-sm btn-secondary disabled" title="{% trans "Suspend" %}" disabled>{% bs_icon 'pause-fill' %}</button>
|
|
{% endif %}
|
|
|
|
{% if "poweroff" in actions %}
|
|
<form action="{% url 'instances:poweroff' instance.id %}" method="post" style="display:inline;">
|
|
{% csrf_token %}
|
|
<button type="submit" class="btn btn-sm btn-secondary" title="{% trans "Power Off" %}">{% bs_icon 'power' %}</button>
|
|
</form>
|
|
{% elif "force_off" in actions %}
|
|
<form action="{% url 'instances:force_off' instance.id %}" method="post" style="display:inline;">
|
|
{% csrf_token %}
|
|
<button type="submit" class="btn btn-sm btn-secondary" title="{% trans "Force Off" %}"
|
|
data-confirm="{% blocktrans with name=instance.name %}Force off {{ name }}? It stops at once, as after a power cut; what the guest has not written to disk is lost.{% endblocktrans %}"
|
|
onclick="return confirm(this.dataset.confirm)">{% bs_icon 'power' %}</button>
|
|
</form>
|
|
{% else %}
|
|
<button class="btn btn-sm btn-secondary disabled" title="{% trans "Power Off" %}" disabled>{% bs_icon 'power' %}</button>
|
|
{% endif %}
|
|
|
|
{% if "powercycle" in actions %}
|
|
<form action="{% url 'instances:powercycle' instance.id %}" method="post" style="display:inline;">
|
|
{% csrf_token %}
|
|
<button type="submit" class="btn btn-sm btn-secondary" title="{% trans "Power Cycle" %}"
|
|
data-confirm="{% blocktrans with name=instance.name %}Power cycle {{ name }}? It stops at once, as after a power cut, and starts again; what the guest has not written to disk is lost.{% endblocktrans %}"
|
|
onclick="return confirm(this.dataset.confirm)">{% bs_icon 'repeat' %}</button>
|
|
</form>
|
|
{% else %}
|
|
<button class="btn btn-sm btn-secondary disabled" title="{% trans "Power Cycle" %}" disabled>{% bs_icon 'repeat' %}</button>
|
|
{% endif %}
|
|
|
|
{% if "console" in actions %}
|
|
<button class="btn btn-sm btn-secondary" type="button" data-url="{% url 'console' instance.compute_id instance.uuid %}"
|
|
onclick="window.open(this.dataset.url, '', 'width=850,height=650')"
|
|
title="{% trans "Console" %}">{% bs_icon 'eye-fill' %}</button>
|
|
{% else %}
|
|
<button class="btn btn-sm btn-secondary disabled" title="{% trans "VNC Console" %}" disabled>{% bs_icon 'eye-fill' %}</button>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|