1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 17:36:05 +00:00
webvirtcloud/computes/templates/computes/form.html
catborise 149530f8df feat: tags for VMs and hosts
One list of tag names (lower case letters, digits, dot, dash, underscore;
up to 32) given to VMs and hosts. A superuser sets a VM's tags on its
Options tab and a host's on its form; Tom Select suggests the tags there
are and makes a new one typed. The VM list, the VM page and the hosts list
show them as badges, to everyone who sees the VM or host.

A VM's tags stay with it: an out-of-band move adds them to those on the
new host's record, and a VM that leaves its host keeps them on the Removed
VMs page (a VM with only tags too) and gets them back when it returns.
Setting them is audited and held against the VM's move.
2026-11-18 20:20:52 +03:00

57 lines
3.1 KiB
HTML

{% extends "base.html" %}
{% load django_bootstrap5 %}
{% load i18n %}
{% load static %}
{% block title %}{% if form.instance.pk %}{% trans "Edit host" %}{% else %}{% trans "Add host" %}{% endif %}{% endblock %}
{% block page_heading %}
<span class="text-break">{% if form.instance.pk %}{% blocktrans with name=form.instance.name %}Edit host: {{ name }}{% endblocktrans %}{% else %}{% trans "Add host" %}{% endif %}</span>
<span class="badge text-bg-light border align-middle fs-6">{{ form.kind }}</span>
{% endblock page_heading %}
{% block style %}<link href="{% static 'css/tom-select.bootstrap5.min.css' %}" rel="stylesheet">{% endblock %}
{% block content %}
<p class="text-body-secondary">{{ form.about }}</p>
<form method="post">
{% csrf_token %}
{% bootstrap_form_errors form type='non_fields' %}
{% for field in form.hidden_fields %}{{ field }}{% endfor %}
<section class="card mb-3" aria-labelledby="connection-title">
<div class="card-header"><h2 class="h5 mb-0" id="connection-title">{% trans "Connection" %}</h2></div>
<div class="card-body">
<div class="row">
<div class="col-md-6">{% bootstrap_field form.name %}</div>
{% if not form.hostname.is_hidden %}<div class="col-md-6">{% bootstrap_field form.hostname %}</div>{% endif %}
{% if "login" in form.fields %}<div class="col-md-6">{% bootstrap_field form.login %}</div>{% endif %}
{% if "password" in form.fields %}<div class="col-md-6">{% bootstrap_field form.password %}</div>{% endif %}
<div class="col-12">{% bootstrap_field form.details %}</div>
<div class="col-12">{% bootstrap_field form.tags %}</div>
</div>
{# open when one of them is set or refused #}
<details class="border-top pt-3"{% if form.migration_address.value or form.migration_address.errors or form.gstfsd_key.errors %} open{% endif %}>
<summary>
<span class="fw-semibold">{% trans "Advanced" %}</span>
<span class="d-block small text-body-secondary text-break ms-3">
{% trans "Migration address" %}: {{ form.migration_address.value|default:_("the host name") }}
&middot; {% trans "gstfsd key" %}: {% if form.instance.gstfsd_key %}{% trans "stored" %}{% else %}{% trans "none" %}{% endif %}
</span>
</summary>
<div class="mt-3">
{% bootstrap_field form.migration_address %}
{% bootstrap_field form.gstfsd_key %}
</div>
</details>
</div>
</section>
<div class="d-flex justify-content-end gap-2">
<a class="btn btn-outline-secondary" href="{% url 'computes' %}">{% trans "Cancel" %}</a>
<button type="submit" class="btn btn-primary">{% trans "Save" %}</button>
</div>
</form>
{% endblock content %}
{% block script %}
<script src="{% static 'js/tom-select.complete.min.js' %}"></script>
<script src="{% static 'js/searchable_select.js' %}"></script>
{% endblock script %}