mirror of
https://github.com/retspen/webvirtcloud
synced 2026-12-03 17:36:05 +00:00
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.
18 lines
1.2 KiB
HTML
18 lines
1.2 KiB
HTML
{% load i18n %}
|
|
{% load bootstrap_icons %}
|
|
{# a VM's name, its title, and with owners its owners: the first as a badge, the others counted #}
|
|
<a class="fw-semibold text-break" href="{% url 'instances:instance' instance.id %}">{{ instance.name }}</a>
|
|
{% if instance.info and instance.title %}<div class="small text-body-secondary text-break">{{ instance.title }}</div>{% endif %}
|
|
{% with tags=instance.tags.all %}{% if tags %}<div class="mt-1">{% include 'common/tag_badges.html' %}</div>{% endif %}{% endwith %}
|
|
{% if owners %}
|
|
{% with users=instance.userinstance_set.all %}
|
|
{% if users %}
|
|
<div class="mt-1">
|
|
<span class="badge text-bg-light border">{% bs_icon 'person' %} {{ users.0.user }}</span>
|
|
{% if users|length > 1 %}
|
|
<span class="badge text-bg-light border" title="{% for owner in users|slice:"1:" %}{{ owner.user }}{% if not forloop.last %}, {% endif %}{% endfor %}">+{{ users|length|add:"-1" }}<span class="visually-hidden"> {% trans "more owners" %}: {% for owner in users|slice:"1:" %}{{ owner.user }}{% if not forloop.last %}, {% endif %}{% endfor %}</span></span>
|
|
{% endif %}
|
|
</div>
|
|
{% endif %}
|
|
{% endwith %}
|
|
{% endif %}
|