mirror of
https://github.com/retspen/webvirtcloud
synced 2026-11-11 12:46:49 +00:00
feat(virtsecrets): the secrets page on Bootstrap's cards, tables and dialogs
- One searchable card: each secret's type, usage and UUID, whether it is kept on disk or in memory and private, and the VMs and pools that use it, linked. A row menu sets its value or deletes it; Delete is disabled while the secret is in use, and its confirmation says what is not checked. - One Set value dialog for every secret; its label and help follow the type (Ceph key, CHAP password, passphrase), and it says a new passphrase does not encrypt anew what the old one encrypted. - New secret dialog: the usage's and value's labels and help follow the type; the value is optional; Private and Ephemeral are switches with help.
This commit is contained in:
parent
a95ec40f69
commit
2a773f6ec0
5 changed files with 249 additions and 138 deletions
|
|
@ -1,57 +1,54 @@
|
|||
{% load i18n %}
|
||||
{% load bootstrap_icons %}
|
||||
{% if request.user.is_superuser %}
|
||||
<a href="#AddSecret" type="button" class="btn btn-success float-end" title="{% trans "Create New Secret" %}" data-bs-toggle="modal">
|
||||
<span aria-hidden="true">{% bs_icon 'plus-circle-fill' %} </span>
|
||||
</a>
|
||||
<button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#AddSecret">
|
||||
<span aria-hidden="true">{% bs_icon 'plus-lg' %}</span> {% trans "New secret" %}
|
||||
</button>
|
||||
|
||||
<!-- Modal Secret -->
|
||||
<div class="modal fade" id="AddSecret" tabindex="-1" role="dialog" aria-labelledby="AddSecret" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<h5 class="modal-title">{% trans "Create New Secret" %}</h5>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
|
||||
</div>
|
||||
<form method="post" action="" role="form" aria-label="Create Secret form">{% csrf_token %}
|
||||
<div class="modal fade" id="AddSecret" tabindex="-1" aria-labelledby="AddSecretLabel" aria-hidden="true">
|
||||
<div class="modal-dialog">
|
||||
<form method="post" class="modal-content">{% csrf_token %}
|
||||
<div class="modal-header">
|
||||
<div>
|
||||
<h5 class="modal-title" id="AddSecretLabel">{% trans "New secret" %}</h5>
|
||||
<div class="small text-body-secondary">{% blocktrans with host=compute.name %}On {{ host }}{% endblocktrans %}</div>
|
||||
</div>
|
||||
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="{% trans "Close" %}"></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<label for="secret_usage_type" class="col-sm-3 col-form-label">{% trans "Usage" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<select id="secret_usage_type" name="usage_type" class="form-control">
|
||||
{% for value, label in usage_choices %}
|
||||
<option value="{{ value }}">{{ label }}</option>
|
||||
{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="secret_usage_type" class="form-label">{% trans "Used for" %}</label>
|
||||
<select id="secret_usage_type" name="usage_type" class="form-select">
|
||||
{% for value, label in usage_choices %}<option value="{{ value }}">{{ label }}</option>{% endfor %}
|
||||
</select>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="secret_usage" class="col-sm-3 col-form-label">{% trans "Data" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input id="secret_usage" type="text" name="usage" class="form-control" required>
|
||||
</div>
|
||||
{# the usage's label and help, and the value's, follow the type: see the script below #}
|
||||
<div class="mb-3">
|
||||
<label for="secret_usage" class="form-label" id="secret_usage_label">{% trans "Usage" %}</label>
|
||||
<input id="secret_usage" name="usage" class="form-control font-monospace" required aria-describedby="secret_usage_help">
|
||||
<div class="form-text" id="secret_usage_help"></div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<label for="secret_value" class="col-sm-3 col-form-label">{% trans "Value" %}</label>
|
||||
<div class="col-sm-6">
|
||||
<input id="secret_value" type="password" name="value" class="form-control" autocomplete="new-password">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="secret_value" class="form-label" id="secret_value_label">{% trans "Value" %}</label>
|
||||
<input id="secret_value" type="password" name="value" class="form-control" autocomplete="new-password" aria-describedby="secret_value_help">
|
||||
<div class="form-text" id="secret_value_help"></div>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input id="secret_ephemeral" type="checkbox" name="ephemeral" class="form-check-input">
|
||||
<label for="secret_ephemeral" class="form-check-label">{% trans "Ephemeral" %}</label>
|
||||
</div>
|
||||
<div class="form-check">
|
||||
<input id="secret_private" type="checkbox" name="private" class="form-check-input">
|
||||
<div class="form-check form-switch">
|
||||
<input id="secret_private" type="checkbox" name="private" class="form-check-input" role="switch" aria-describedby="secret_private_help">
|
||||
<label for="secret_private" class="form-check-label">{% trans "Private" %}</label>
|
||||
<div class="form-text mt-0" id="secret_private_help">{% trans "Its value cannot be read back through libvirt." %}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Close" %}</button>
|
||||
<button type="submit" class="btn btn-primary" name="create">{% trans "Create" %}</button>
|
||||
</div>
|
||||
<div class="form-check form-switch">
|
||||
<input id="secret_ephemeral" type="checkbox" name="ephemeral" class="form-check-input" role="switch" aria-describedby="secret_ephemeral_help">
|
||||
<label for="secret_ephemeral" class="form-check-label">{% trans "Ephemeral" %}</label>
|
||||
<div class="form-text mt-0" id="secret_ephemeral_help">{% trans "Kept in memory only: gone when libvirtd restarts." %}</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">{% trans "Cancel" %}</button>
|
||||
<button type="submit" class="btn btn-primary" name="create">{% trans "Create secret" %}</button>
|
||||
</div>
|
||||
</form>
|
||||
</div> <!-- /.modal-content -->
|
||||
</div> <!-- /.modal-dialog -->
|
||||
</div><!-- /.modal -->
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue