Jan Dittberner
cb62bd63e2
- add model CustomerPackageDiskUsage for hosting package disk usage statistics - add REST API endpoint for submittings statistics for disk, mysql and pgsql usage - add disk usage information to hosting package detail view - add separate hosting package disk usage statistic view
282 lines
17 KiB
HTML
282 lines
17 KiB
HTML
{% extends "hostingpackages/base.html" %}
|
|
{% load i18n %}
|
|
|
|
{% block title %}{{ block.super }} - {% spaceless %}
|
|
{% if user == customer %}
|
|
{% blocktranslate with package=hostingpackage.name trimmed %}
|
|
Details for your Hosting Package {{ package }}
|
|
{% endblocktranslate %}
|
|
{% else %}
|
|
{% blocktranslate with package=hostingpackage.name full_name=customer.get_full_name trimmed %}
|
|
Details for Hosting Package {{ package }} of {{ full_name }}
|
|
{% endblocktranslate %}
|
|
{% endif %}
|
|
{% endspaceless %}{% endblock title %}
|
|
|
|
{% block page_title %}{% blocktranslate with package=hostingpackage.name trimmed %}
|
|
Details of Hosting Package {{ package }}
|
|
{% endblocktranslate %}{% endblock page_title %}
|
|
|
|
{% block content %}
|
|
<div class="row row-cols-1 row-cols-md-2 row-cols-lg-3 g-4">
|
|
<div class="col">
|
|
<div class="card">
|
|
<div class="card-header">
|
|
{% translate "Hosting Package Information" %}
|
|
{% if user.is_staff %}
|
|
<div class="float-end">
|
|
<a class="panel-title" href="#"
|
|
title="{% translate "Edit Hosting Package Information" %}"><i
|
|
class="bi-gear"></i></a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
<div class="card-body">
|
|
<dl class="dl-horizontal">
|
|
<dt>{% translate "Name" %}</dt>
|
|
<dd>{{ hostingpackage.name }}</dd>
|
|
<dt>{% translate "Description" %}</dt>
|
|
<dd>{{ hostingpackage.description|default:"-" }}</dd>
|
|
<dt>{% translate "Disk space" %}</dt>
|
|
{% with used_space=hostingpackage.get_used_disk_space_sum|filesizeformat disk_space=hostingpackage.get_disk_space|filesizeformat package_space=hostingpackage.get_package_space|filesizeformat space_level=hostingpackage.space_level %}
|
|
<dd>
|
|
<span title="{% blocktranslate trimmed %}
|
|
You use {{ used_space }} of the reserved disk space of {{ disk_space }} for your hosting package
|
|
{% endblocktranslate %}" class="text-{% if space_level > 90.0 %}danger{% elif space_level > 80.0 %}warning{% else %}success{% endif %}">{% blocktranslate with space_level_percent=space_level|floatformat:1 trimmed%}
|
|
{{ used_space }} of {{ disk_space }} ({{ space_level_percent }}%)
|
|
{% endblocktranslate %} <a title="{% translate "Disk usage details" %}" href="{% url "disk_usage_details" package=hostingpackage.id %}">{% translate "Details" %}</a></span>
|
|
<i class="bi-info-circle"
|
|
title="{% blocktranslate trimmed %}
|
|
The package contributes {{ package_space }} the difference comes from disk space options
|
|
{% endblocktranslate %}"></i>
|
|
</dd>
|
|
{% endwith %}
|
|
<dt>{% translate "Mailboxes" %}</dt>
|
|
<dd>
|
|
{% blocktranslate with num=hostingpackage.used_mailbox_count total=hostingpackage.mailbox_count trimmed %}
|
|
{{ num }} of {{ total }} in use{% endblocktranslate %}
|
|
<i class="bi-info-circle"
|
|
title="{% blocktranslate with mailboxcount=hostingpackage.mailboxcount trimmed %}The package provides {{ mailboxcount }} mailboxes the difference comes from mailbox options.{% endblocktranslate %}"></i>
|
|
</dd>
|
|
<dt>{% if osuser.is_sftp_user %}{% translate "SFTP username" %}{% else %}
|
|
{% translate "SSH/SFTP username" %}{% endif %}</dt>
|
|
<dd>{{ osuser.username }}{% if sshkeys %}
|
|
<a href="{% url 'list_ssh_keys' package=hostingpackage.id %}" class="badge"
|
|
title="{% blocktranslate count counter=sshkeys|length trimmed %}There is an SSH public key set for this user.{% plural %}There are {{ counter }} SSH public keys set for this user.{% endblocktranslate %}"><i
|
|
class="bi-key"></i> {{ sshkeys|length }}</a>{% endif %}</dd>
|
|
<dt>{% translate "Upload server" %}</dt>
|
|
<dd>{{ uploadserver }}</dd>
|
|
</dl>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="col">
|
|
<div class="card">
|
|
<div class="card-header">{% translate "Hosting Package Options" %}</div>
|
|
{% if hostingoptions %}
|
|
<ul class="list-group list-group-flush">
|
|
{% for opt in hostingoptions %}
|
|
<li class="list-group-item">{{ opt }}</li>
|
|
{% endfor %}
|
|
</ul>
|
|
{% else %}
|
|
<div class="card-body text-info">{% translate "No options booked" %}</div>
|
|
{% endif %}
|
|
{% if user.is_staff %}
|
|
<div class="card-footer"><a
|
|
class="btn btn-primary"
|
|
href="{% url 'hosting_option_choices' pk=hostingpackage.id %}"
|
|
title="{% translate "Add another hosting option" %}">{% translate "Add option" %}</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="col">
|
|
<div class="card">
|
|
<div class="card-header">{% translate "Hosting Package Actions" %}</div>
|
|
<ul class="list-group list-group-flush">
|
|
<li class="list-group-item"><a
|
|
href="#"
|
|
title="{% translate "Edit Hosting Package Description" %}">{% translate "Edit description" %}</a>
|
|
</li>
|
|
<li class="list-group-item"><a href="{% url "set_osuser_password" slug=osuser.username %}">
|
|
{% if osuser.is_sftp_user %}{% translate "Set SFTP password" %}{% else %}
|
|
{% translate "Set SSH/SFTP password" %}{% endif %}</a></li>
|
|
<li class="list-group-item"><a
|
|
href="{% url "add_ssh_key" package=hostingpackage.id %}"
|
|
title="{% blocktranslate trimmed %}
|
|
Add an SSH public key that can be used as an alternative for password
|
|
{% endblocktranslate %}">{% translate "Add SSH public key" %}</a>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row row-cols-1 mt-4">
|
|
<div class="col">
|
|
<div class="card">
|
|
<div class="card-header">{% translate "Domains" %}</div>
|
|
{% if domains %}
|
|
<table class="table table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th class="name-column">{% translate "Domain name" %}</th>
|
|
<th>{% translate "Mail addresses" %}</th>
|
|
<th>{% translate "Websites" %}</th>
|
|
<th title="{% translate "Domain actions" %}" class="actions-column"><span
|
|
class="visually-hidden">{% translate "Actions" %}</span></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for domain in domains %}
|
|
<tr>
|
|
<td>{{ domain.domain }}</td>
|
|
{% if domain.domain.maildomain.mailaddress_set.exists %}
|
|
<td>
|
|
{% with maildomain=domain.domain.maildomain %}
|
|
{% for mailaddress in maildomain.mailaddresses %}{% spaceless %}
|
|
<a href="{% url 'edit_mailaddress' package=hostingpackage.id domain=maildomain.domain pk=mailaddress.id %}"
|
|
title="{% translate "Edit mail address targets" %}">{{ mailaddress }}</a>
|
|
<a href="{% url 'delete_mailaddress' package=hostingpackage.id domain=maildomain.domain pk=mailaddress.id %}"
|
|
title="{% translate "Delete mail address" %}"><i
|
|
class="bi-trash"></i><span
|
|
class="visually-hidden"> {% translate "Delete mail address" %}</span></a>
|
|
{% endspaceless %}{% if not forloop.last %}, {% endif %}{% endfor %}
|
|
{% endwith %}
|
|
</td>
|
|
{% else %}
|
|
<td class="text-info">{% translate "None" %}</td>
|
|
{% endif %}
|
|
{% if domain.domain.website_set.exists %}
|
|
<td>
|
|
{% with domain=domain.domain %}
|
|
{% for website in domain.website_set.all %}{% spaceless %}
|
|
{{ website }}
|
|
<a href="{% url 'delete_website' package=hostingpackage.id domain=domain.domain pk=website.id %}"
|
|
titel="{% translate "Delete website" %}"><i
|
|
class="bi-trash"></i><span
|
|
class="visually-hidden"> {% translate "Delete website" %}</span></a>
|
|
{% endspaceless %}{% if not forloop.last %}, {% endif %}{% endfor %}
|
|
{% endwith %}
|
|
</td>
|
|
{% else %}
|
|
<td class="text-info">{% translate "None" %}</td>
|
|
{% endif %}
|
|
<td>
|
|
{% if domain.domain.maildomain %}
|
|
{% with maildomain=domain.domain.maildomain %}
|
|
<a href="{% url 'add_mailaddress' package=hostingpackage.id domain=maildomain.domain %}"
|
|
title="{% translate "Add mail address" %}"><i
|
|
class="bi-envelope-plus"></i><span
|
|
class="visually-hidden"> {% translate "Add mail address" %}</span></a>
|
|
{% endwith %}
|
|
{% endif %}
|
|
{% with hostingdomain=domain.domain %}
|
|
<a href="{% url 'add_website' package=hostingpackage.id domain=hostingdomain.domain %}"
|
|
title="{% translate "Add website" %}"><i class="bi-globe"></i><span
|
|
class="visually-hidden"> {% translate "Add website" %}</span></a>
|
|
{% endwith %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% else %}
|
|
<div class="card-body text-info">{% translate "There are no domains assigned to this hosting package yet." %}</div>
|
|
{% endif %}
|
|
{% if user.is_staff %}
|
|
<div class="card-footer"><a href="{% url 'create_hosting_domain' package=hostingpackage.id %}"
|
|
class="btn btn-primary">{% translate "Add domain" %}</a></div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="row row-cols-1 row-cols-lg-2 mt-4">
|
|
<div class="col">
|
|
<div class="card">
|
|
<div class="card-header">{% translate "E-Mail-Accounts" %}</div>
|
|
{% if mailboxes %}
|
|
<table class="table table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th class="name-column">{% translate "Mailbox" %}</th>
|
|
<th>{% translate "Mail addresses" %}</th>
|
|
<th class="status-column">{% translate "Active" %}</th>
|
|
<th title="{% translate "Mailbox actions" %}" class="actions-column"><span
|
|
class="visually-hidden">{% translate "Actions" %}</span></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for mailbox in mailboxes %}
|
|
<tr>
|
|
<td>{{ mailbox.username }}</td>
|
|
<td>{{ mailbox.mailaddresses|join:", " }}</td>
|
|
<td>
|
|
<i class="{% if mailbox.active %}bi-check-circle{% else %}bi-dash-circle{% endif %}"></i><span
|
|
class="visually-hidden"> {% if mailbox.active %}{% translate "Active" %}{% else %}
|
|
{% translate "inactive" %}{% endif %}</span></td>
|
|
<td>
|
|
<a href="{% url 'change_mailbox_password' package=hostingpackage.id slug=mailbox.username %}"><i
|
|
class="bi-lock" title="{% translate "Set mailbox password" %}"></i><span
|
|
class="visually-hidden"> {% translate "Set mailbox password" %}</span></a>
|
|
</td>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% else %}
|
|
<div class="card-body text-info">{% translate "There are no mailboxes assigned to this hosting package yet." %}</div>
|
|
{% endif %}
|
|
{% if hostingpackage.may_add_mailbox %}
|
|
<div class="card-footer"><a
|
|
href="{% url 'create_mailbox' package=hostingpackage.id %}"
|
|
class="btn btn-primary">{% translate "Add mailbox" %}</a>
|
|
</div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="col">
|
|
<div class="card">
|
|
<div class="card-header">{% translate "Databases" %}</div>
|
|
{% if databases %}
|
|
<table class="table table-condensed">
|
|
<thead>
|
|
<tr>
|
|
<th class="name-column">{% translate "Database name" %}</th>
|
|
<th class="name-column">{% translate "Database user" %}</th>
|
|
<th title="{% translate "Database type" %}"><span
|
|
class="visually-hidden">{% translate "Type" %}</span></th>
|
|
<th title="{% translate "Database actions" %}" class="actions-column"><span
|
|
class="visually-hidden">{% translate "Actions" %}</span></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for database in databases %}
|
|
<tr>
|
|
<td>{{ database.db_name }}</td>
|
|
<td>{{ database.db_user.name }}</td>
|
|
<td>{% include "userdbs/snippets/db_type.html" with db_type=database.db_user.db_type %}</td>
|
|
<td>
|
|
<a href="{% url 'change_dbuser_password' package=hostingpackage.id slug=database.db_user.name %}"
|
|
title="{% translate "Set database user password" %}"><i
|
|
class="bi-database-gear"></i><span
|
|
class="visually-hidden"> {% translate "Set database user password" %}</span></a>
|
|
<a href="{% url 'delete_userdatabase' package=hostingpackage.id slug=database.db_name %}"
|
|
title="{% translate "Delete database" %}"><i class="bi-database-dash"></i><span
|
|
class="visually-hidden">{% translate "Delete database" %}</span></a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
{% else %}
|
|
<div class="card-body text-info">{% translate "There are no databases assigned to this hosting package yet." %}</div>
|
|
{% endif %}
|
|
{% if hostingpackage.may_add_database %}
|
|
<div class="card-footer"><a
|
|
href="{% url 'add_userdatabase' package=hostingpackage.id %}"
|
|
class="btn btn-primary">{% translate "Add database" %}</a></div>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
</div>
|
|
{% endblock content %}
|