mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
feat(computes): a host's Instances page is the VM list of its VMs
A host's Instances page had a table of its own, older than the VM list: no state filter, no tag filter, no bulk bar, a two-line Name/Description head and a round green button for a new VM. It now shows the VM list itself, of that host's VMs and without a host column, beside the host's tabs, Bulk Migrate and New VM. The bulk bar sends back to the list it was used on.
This commit is contained in:
parent
59db1f5515
commit
383cbe89a6
16 changed files with 192 additions and 247 deletions
|
|
@ -40,86 +40,7 @@
|
|||
</div>
|
||||
{% endif %}
|
||||
<div class="col-lg-12">
|
||||
{% if instances %}
|
||||
{# the state filter: table_filter.js counts each state's VMs the search finds #}
|
||||
<input type="hidden" id="state-filter" value="">
|
||||
<nav class="mb-2" aria-label="{% trans "VM states" %}">
|
||||
<div class="nav nav-pills flex-wrap gap-1" id="state-pills">
|
||||
<button type="button" class="nav-link active py-1 px-2" data-pill="" aria-pressed="true">
|
||||
{% trans "All" %} <span class="badge text-bg-light ms-1" data-count-state=""></span>
|
||||
</button>
|
||||
{% for state in states %}
|
||||
<button type="button" class="nav-link py-1 px-2" data-pill="{{ state }}" aria-pressed="false" hidden>
|
||||
{{ state }} <span class="badge text-bg-light ms-1" data-count-state="{{ state }}"></span>
|
||||
</button>
|
||||
{% endfor %}
|
||||
</div>
|
||||
</nav>
|
||||
{% include 'common/tag_filter.html' %}
|
||||
{% if powerable %}
|
||||
{# the VMs chosen in the list (bulk_power_box.html), a job each (instances.jobs.POWER); bulk_power.js counts those on screen #}
|
||||
{# and shows this bar at the foot of the window while any is chosen #}
|
||||
<form id="bulk-power" class="fixed-bottom bg-body border-top shadow-lg py-2" action="{% url 'instances:bulk_power' %}" method="post"
|
||||
aria-label="{% trans "The chosen VMs" %}" hidden>{% csrf_token %}{% submission_key %}
|
||||
<div class="container d-flex flex-wrap align-items-center gap-2">
|
||||
<span class="fw-semibold me-2" id="bulk-power-count" data-text="{% trans "%(count)s chosen" %}"
|
||||
data-too-many="{% blocktrans with max=bulk_max %}%(count)s chosen: at most {{ max }} at once{% endblocktrans %}" data-max="{{ bulk_max }}" aria-live="polite"></span>
|
||||
<div class="btn-group btn-group-sm" role="group" aria-label="{% trans "Power the chosen VMs" %}">
|
||||
<button type="submit" class="btn btn-outline-primary" name="action" value="start">{% trans "Start" %}</button>
|
||||
<button type="submit" class="btn btn-outline-primary" name="action" value="shutdown"
|
||||
data-confirm="{% trans "Shut down the chosen VMs? Their guests are asked to power off." %}">{% trans "Shut down" %}</button>
|
||||
<button type="submit" class="btn btn-outline-danger" name="action" value="force_off"
|
||||
data-confirm="{% trans "Force off the chosen VMs? They stop at once, as if unplugged, and may lose unsaved data." %}">{% trans "Force off" %}</button>
|
||||
</div>
|
||||
{% if snapshotable %}
|
||||
{# external, without memory and without freezing file systems: the VM's Snapshots tab has those choices #}
|
||||
<div class="dropup">
|
||||
<button type="button" class="btn btn-sm btn-outline-primary dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside"
|
||||
aria-expanded="false">{% trans "Snapshot" %}</button>
|
||||
<div class="dropdown-menu p-3" style="width: 20rem">
|
||||
<label class="form-label" for="bulk-snapshot-name">{% trans "Snapshot name" %}</label>
|
||||
<div class="input-group input-group-sm">
|
||||
<input class="form-control" type="text" name="snapshot_name" id="bulk-snapshot-name" maxlength="64" aria-describedby="bulk-snapshot-help">
|
||||
<button type="submit" class="btn btn-primary" name="action" value="snapshot" formaction="{% url 'instances:bulk_snapshot' %}">{% trans "Take snapshots" %}</button>
|
||||
</div>
|
||||
<div class="form-text" id="bulk-snapshot-help">{% trans "An external snapshot of each chosen VM, without memory and without freezing its file systems" %}</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
{# tags are a superuser's, as on the VM's Settings tab #}
|
||||
<div class="dropup">
|
||||
<button type="button" class="btn btn-sm btn-outline-primary dropdown-toggle" data-bs-toggle="dropdown" data-bs-auto-close="outside"
|
||||
aria-expanded="false">{% trans "Tag" %}</button>
|
||||
<div class="dropdown-menu p-3" style="width: 20rem">
|
||||
<label class="form-label" for="bulk-tag">{% trans "Tag" %}</label>
|
||||
<input class="form-control form-control-sm mb-2" type="text" name="tag" id="bulk-tag" list="bulk-tag-names">
|
||||
<datalist id="bulk-tag-names">{% for tag in tag_names %}<option value="{{ tag }}">{% endfor %}</datalist>
|
||||
<button type="submit" class="btn btn-sm btn-primary" name="action" value="tag_add" formaction="{% url 'instances:bulk_tag' %}">{% trans "Add tag" %}</button>
|
||||
<button type="submit" class="btn btn-sm btn-outline-secondary" name="action" value="tag_remove" formaction="{% url 'instances:bulk_tag' %}">{% trans "Remove tag" %}</button>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<button type="button" class="btn btn-sm btn-link ms-auto" id="bulk-power-clear">{% trans "Clear the choice" %}</button>
|
||||
</div>
|
||||
</form>
|
||||
{% endif %}
|
||||
<div id="filter-status" class="visually-hidden" role="status" data-text="{% trans "%(shown)s of %(all)s VMs match" %}"></div>
|
||||
{% endif %}
|
||||
{% if not instances %}
|
||||
<p class="text-center text-body-secondary py-4">{% trans "There are no VMs here yet." %}</p>
|
||||
{% elif app_settings.VIEW_INSTANCES_LIST_STYLE == 'grouped' and request.user.is_superuser %}
|
||||
{% include 'allinstances_index_grouped.html' %}
|
||||
{% else %}
|
||||
{% include 'allinstances_index_nongrouped.html' %}
|
||||
{% endif %}
|
||||
{% if instances %}
|
||||
{# table_filter.js shows it while no row matches #}
|
||||
<div id="no-match" class="text-center text-body-secondary py-4" hidden>
|
||||
{% trans "No VM matches the filters." %}
|
||||
<button type="button" class="btn btn-link" id="clear-filters">{% trans "Clear the filters" %}</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% include 'instances/vm_list.html' %}
|
||||
</div>
|
||||
<div class="modal fade" id="find-address" tabindex="-1" aria-labelledby="find-address-title" aria-hidden="true"
|
||||
data-url="{% url 'instances:find_address' %}" data-failed="{% trans "The search did not go through. Try again." %}"
|
||||
|
|
@ -168,15 +89,8 @@
|
|||
</div>
|
||||
{% endblock content %}
|
||||
{% block script %}
|
||||
<script src="{% static 'js/poll.js' %}"></script>
|
||||
{% include "instances/vm_states_poll.html" %}
|
||||
<script src="{% static 'js/table_filter.js' %}"></script>
|
||||
{% include 'instances/vm_list_scripts.html' %}
|
||||
<script src="{% static 'js/find_address.js' %}"></script>
|
||||
{% if app_settings.VIEW_INSTANCES_LIST_STYLE == 'grouped' and request.user.is_superuser %}
|
||||
<script src="{% static 'js/host_groups.js' %}"></script>
|
||||
{% endif %}
|
||||
{# after host_groups.js: the hosts it collapses are off screen #}
|
||||
{% if powerable %}<script src="{% static 'js/bulk_power.js' %}"></script>{% endif %}
|
||||
{% if request.user.is_superuser %}
|
||||
<script src="{% static 'js/new_vm_dialog.js' %}"></script>
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue