mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-09 11:46:49 +00:00
The host pages lose their last inline scripts: the overview's charts (host_graphs.js), the New pool, New network and New interface dialogs (pool_dialog.js, network_dialog.js, interface_dialog.js), a network's and a network filter's XML editors and dialogs (network_page.js, nwfilter_page.js, nwfilters_page.js), the secrets page's labels (secrets_page.js, its texts from the view as usage_texts) and a pool's page with the ISO upload (storage_page.js). Their URLs and messages are data attributes of the elements they belong to; the upload reads its token and address from its form. No template has an inline script or an inline event handler any more.
76 lines
5.4 KiB
HTML
76 lines
5.4 KiB
HTML
{% load i18n %}
|
|
{% load django_bootstrap5 %}
|
|
{% load bootstrap_icons %}
|
|
{% if request.user.is_superuser %}
|
|
{% if state != 0 %}
|
|
{% if pool == "iso" %}
|
|
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#IsoUpload">
|
|
<span aria-hidden="true">{% bs_icon 'upload' %}</span> {% trans "Upload ISO" %}
|
|
</button>
|
|
|
|
<div class="modal fade" id="IsoUpload" tabindex="-1" role="dialog" aria-labelledby="IsoUploadLabel" aria-hidden="true">
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="IsoUploadLabel">{% trans "Upload ISO Image" %}</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{% trans "Close" %}"></button>
|
|
</div>
|
|
<form id="isoUploadForm" action="{% url 'storage' compute.id pool %}" enctype="multipart/form-data" method="post" aria-label="{% trans "Upload iso form" %}"
|
|
data-no-file="{% trans 'Please select a file to upload.' %}" data-not-iso="{% trans 'Only .iso files can be uploaded.' %}"
|
|
data-empty="{% trans 'The selected file is empty.' %}" data-starting="{% trans 'Starting upload...' %}"
|
|
data-uploading="{% trans 'Uploading; the job panel shows its progress. Stay on this page until it ends.' %}"
|
|
data-retrying="{% trans 'Retrying upload...' %}" data-failed="{% trans 'An error occurred during upload.' %}">{% csrf_token %}
|
|
<div class="modal-body">
|
|
<label for="id_file" class="form-label">{% trans "ISO file" %}</label>
|
|
<input type="file" name="file" id="id_file" class="form-control" accept=".iso" required aria-describedby="id_file_help">
|
|
<div class="form-text" id="id_file_help">{% trans "The browser sends it: keep the page open until the upload ends." %}</div>
|
|
<div id="upload-status" class="d-none align-items-center gap-2 text-primary mt-3" role="status" aria-live="polite">
|
|
<span class="spinner-border spinner-border-sm" aria-hidden="true"></span>
|
|
<span id="upload-status-text">{% trans "Starting upload..." %}</span>
|
|
</div>
|
|
<div id="upload-error-message" class="alert alert-danger mt-3 d-none" role="alert"></div>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<input type="hidden" name="iso_upload" value="true">
|
|
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
|
|
<button type="submit" class="btn btn-primary">{% trans "Upload" %}</button>
|
|
</div>
|
|
</form>
|
|
|
|
</div> <!-- /.modal-content -->
|
|
</div> <!-- /.modal-dialog -->
|
|
</div> <!-- /.modal -->
|
|
{% else %}
|
|
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#AddImage">
|
|
<span aria-hidden="true">{% bs_icon 'plus-lg' %}</span> {% trans "New volume" %}
|
|
</button>
|
|
|
|
<div class="modal fade" id="AddImage" tabindex="-1" role="dialog" aria-labelledby="AddImageLabel" aria-hidden="true"
|
|
{% if form.errors %}data-open{% endif %}>
|
|
<div class="modal-dialog">
|
|
<div class="modal-content">
|
|
<div class="modal-header">
|
|
<h5 class="modal-title" id="AddImageLabel">{% trans "New volume" %}</h5>
|
|
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{% trans "Close" %}"></button>
|
|
</div>
|
|
<div class="modal-body">
|
|
<form id="create-volume" method="post" aria-label="{% trans "Create volume to storage form" %}">
|
|
{% csrf_token %}
|
|
<div class="row">
|
|
<div class="col-12">{% bootstrap_field form.name %}</div>
|
|
<div class="col-sm-6">{% bootstrap_field form.size %}</div>
|
|
<div class="col-sm-6">{% bootstrap_field form.format %}</div>
|
|
<div class="col-12">{% bootstrap_field form.meta_prealloc %}</div>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
<div class="modal-footer">
|
|
<button type="button" class="btn btn-outline-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
|
|
<button type="submit" form="create-volume" class="btn btn-primary" name="create_volume">{% trans "Create" %}</button>
|
|
</div>
|
|
</div> <!-- /.modal-content -->
|
|
</div> <!-- /.modal-dialog -->
|
|
</div> <!-- /.modal -->
|
|
{% endif %}
|
|
{% endif %}
|
|
{% endif %}
|