1
0
Fork 0
mirror of https://github.com/retspen/webvirtcloud synced 2026-12-03 09:26:03 +00:00
webvirtcloud/vmbackups/templates/vmbackups/target.html
catborise 43d25a2759 feat(vmbackups): the Backups tab and restore pages for VM owners
A VM owner with the backup permission who may change the VM gets its
Backups tab: the targets open to VM owners, the VM's backups on them,
Restore as a new VM or over the VM, and Delete for the backups they took;
no schedule is shown. Their restore as a new VM names the VM's host and
pool instead of asking, and the restore-over page says that the disks the
VM runs from are deleted. A superuser opens or closes a target to VM
owners on its page.
2026-11-17 19:40:33 +03:00

76 lines
4.1 KiB
HTML

{% extends "base.html" %}
{% load i18n %}
{% load bootstrap_icons %}
{% load django_bootstrap5 %}
{% load operations %}
{% block title %}{{ target.name }} - {% trans "Backup targets" %}{% endblock %}
{% block page_heading %}<a href="{% url 'vmbackups:targets' %}">{% trans "Backup targets" %}</a> / {{ target.name }}{% endblock page_heading %}
{% block content %}
<div class="d-flex flex-wrap align-items-center gap-2 mb-3">
<span class="text-body-secondary me-auto">{% blocktrans count counter=backup_count %}{{ counter }} backup.{% plural %}{{ counter }} backups.{% endblocktrans %}
{% if target.owners %}{% trans "VM owners with the backup permission may use it." %}{% else %}{% trans "Only superusers use it." %}{% endif %}</span>
<form method="post">
{% csrf_token %}
<button type="submit" name="owners" value="{% if target.owners %}0{% else %}1{% endif %}" class="btn btn-sm btn-outline-secondary">{% if target.owners %}{% trans "Close to VM owners" %}{% else %}{% trans "Open to VM owners" %}{% endif %}</button>
</form>
{% if pools %}
<form method="post">
{% csrf_token %}{% submission_key %}
<button type="submit" name="import" value="1" class="btn btn-sm btn-outline-primary"
title="{% trans "Adds the backups whose manifest is in the target and that the panel does not list, as after its database was lost." %}">{% bs_icon 'download' %} {% trans "Read backups from target" %}</button>
</form>
{% endif %}
</div>
<div class="row row-cols-1 row-cols-md-2 g-3 mb-4">
{% for item in pools %}
<div class="col">
<div class="card h-100">
<div class="card-header d-flex flex-wrap align-items-center gap-2">
<span class="fw-semibold me-auto text-break">{{ item.row.compute.name }}: {{ item.row.pool }}</span>
{% if not backup_count %}
<form method="post">
{% csrf_token %}
<button type="submit" name="remove_pool" value="{{ item.row.id }}" class="btn btn-sm btn-outline-danger"
data-confirm="{% trans "Remove this storage pool from the target? The pool and its files stay on the host." %}">{% trans "Remove" %}</button>
</form>
{% endif %}
</div>
<div class="card-body">
{% if item.error %}
<div class="text-danger small">{% bs_icon 'exclamation-triangle' %} {{ item.error }}</div>
{% else %}
{% include "computes/pool_bar.html" with pool=item.space hide_name=True %}
{% if item.inside %}
<div class="alert alert-warning small mt-2 mb-0">{% blocktrans with pool=item.inside %}The target is inside storage pool {{ pool }}: its backups are lost with that storage.{% endblocktrans %}</div>
{% endif %}
{% endif %}
</div>
</div>
</div>
{% endfor %}
</div>
<div class="card mb-4" style="max-width: 40rem;">
<div class="card-header fw-semibold">{% trans "Add a compute's storage pool" %}</div>
<div class="card-body">
<p class="small text-body-secondary">{% trans "The pool must be the same directory as the target's other pools, as an NFS share mounted on each host." %}</p>
<form method="post">
{% csrf_token %}
{% bootstrap_form form %}
<button type="submit" name="add_pool" value="1" class="btn btn-primary">{% bs_icon 'plus' %} {% trans "Add" %}</button>
</form>
</div>
</div>
{% if not backup_count %}
<form method="post">
{% csrf_token %}
<button type="submit" name="delete" value="1" class="btn btn-outline-danger"
data-confirm="{% trans "Delete this backup target? Its storage pools stay on the hosts." %}">{% bs_icon 'trash' %} {% trans "Delete target" %}</button>
</form>
{% endif %}
{% endblock %}