1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-11-08 19:26:48 +00:00
webvirtcloud/instances/templates/add_instance_network_block.html
catborise 561937b31a refactor(instances): the VM page's scripts load from static files
The VM page's thirteen inline script blocks and its inline handlers move
to static files: instance_page.js (tabs, OS details, clone names and
MACs, Add disk dialog, boot order, host devices, migrate plan, console
window, switches that send their form), instance_stats.js (charts and
the Logs view) and instance_status.js (the reload when the VM's state
changes). Their values and messages come as data attributes of the
elements they belong to, page-wide ones on #vm-summary; a form marked
data-please-wait shows the please-wait dialog. Three blocks that did
nothing are dropped: popovers (the page has none), the video model
preselection (the server selects it) and the delete form's poll stop
(that form is on the destroy page). The HTML sink inventory now also
reads the app's own scripts.
2026-11-02 09:04:29 +03:00

61 lines
4 KiB
HTML

{% load i18n %}
{% load bootstrap_icons %}
{% if request.user.is_superuser %}
<button type="button" class="btn btn-sm btn-primary" data-bs-toggle="modal" data-bs-target="#addInstanceNetwork">{% bs_icon 'plus' %} {% trans "Add network device" %}</button>
<div class="modal fade" id="addInstanceNetwork" tabindex="-1" role="dialog" aria-labelledby="addInstanceNetworkLabel" aria-hidden="true">
<div class="modal-dialog">
<form class="modal-content" action="{% url 'instances:add_network' instance.id %}" method="post" aria-label="{% trans "Add instance network form" %}">{% csrf_token %}
<div class="modal-header">
<h5 class="modal-title" id="addInstanceNetworkLabel">{% trans "Add network device" %}</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{% trans "Close" %}"></button>
</div>
<div class="modal-body">
<div class="row g-3">
<div class="col-12">
<label class="form-label" for="add-net-network">{% trans "Source" %}</label>
<select class="form-select" id="add-net-network" name="add-net-network">
<optgroup label="{% trans "Networks" %}">
{% for c_net in networks_host %}
<option value="net:{{ c_net }}">{{ c_net }}</option>
{% endfor %}
</optgroup>
<optgroup label="{% trans "Interfaces" %}">
{% for c_iface in interfaces_host %}
<option value="iface:{{ c_iface }}">{{ c_iface }}</option>
{% endfor %}
</optgroup>
</select>
</div>
<div class="col-sm-6">
<label class="form-label" for="add-net-model">{% trans "Model" %}</label>
<select class="form-select" id="add-net-model" name="add-net-model">
{% for model in net_models_host %}
<option value="{{ model }}"{% if model == 'default' %} selected{% endif %}>{{ model }}</option>
{% endfor %}
</select>
</div>
<div class="col-sm-6">
<label class="form-label" for="add-net-nwfilter">{% trans "NWFilter" %}</label>
<select class="form-select" id="add-net-nwfilter" name="add-net-nwfilter">
<option value="">{% trans "None" %}</option>
{% for nwfilter in nwfilters_host %}
<option value="{{ nwfilter }}">{{ nwfilter }}</option>
{% endfor %}
</select>
</div>
<div class="col-12">
<label class="form-label" for="add-net-mac">{% trans "MAC" %}</label>
<input type="text" class="form-control font-monospace" id="add-net-mac" name="add-net-mac" aria-describedby="add-net-mac-help"{% if request.user.is_superuser %} data-new-mac{% endif %}>
<div class="form-text" id="add-net-mac-help">{% trans "A random address is filled in; empty: libvirt chooses one." %}</div>
</div>
</div>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
<button type="submit" class="btn btn-primary" name="add_network">{% trans "Add" %}</button>
</div>
</form>
</div>
</div>
{% endif %}