mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-11-21 04:23:15 +01:00
215 lines
9.9 KiB
HTML
215 lines
9.9 KiB
HTML
{% extends "base.html" %}
|
|
{% load i18n %}
|
|
|
|
{% block content %}
|
|
<div class="card card-primary card-outline">
|
|
<div class="card-header">
|
|
<h3 class="card-title">
|
|
<i class="fas fa-server"></i> {{ application }}
|
|
</h3>
|
|
<div class="card-tools">
|
|
<a href="{% url 'app_gateway_list' %}" class="btn btn-sm btn-secondary">
|
|
<i class="fas fa-arrow-left"></i> {% trans 'Back to List' %}
|
|
</a>
|
|
{% if is_reserved %}
|
|
<a class="btn btn-sm btn-secondary disabled" aria-disabled="true" tabindex="-1" title="{% trans 'This application cannot be modified' %}">
|
|
<i class="fas fa-edit"></i> {% trans 'Edit Application' %}
|
|
</a>
|
|
<a class="btn btn-sm btn-secondary disabled" aria-disabled="true" tabindex="-1" title="{% trans 'This application cannot be deleted' %}">
|
|
<i class="fas fa-trash"></i> {% trans 'Delete Application' %}
|
|
</a>
|
|
{% else %}
|
|
<a href="{% url 'manage_application' %}?uuid={{ application.uuid }}" class="btn btn-sm btn-info">
|
|
<i class="fas fa-edit"></i> {% trans 'Edit Application' %}
|
|
</a>
|
|
<a href="{% url 'delete_application' %}?uuid={{ application.uuid }}" class="btn btn-sm btn-danger">
|
|
<i class="fas fa-trash"></i> {% trans 'Delete Application' %}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
<div class="card-body">
|
|
|
|
<div class="row mb-4">
|
|
<div class="col-md-6">
|
|
<strong>{% trans 'Name' %}:</strong> {{ application }}<br>
|
|
<strong>{% trans 'Upstream' %}:</strong> <code>{{ application.upstream }}</code><br>
|
|
</div>
|
|
<div class="col-md-6">
|
|
<strong>{% trans 'Default Policy' %}:</strong>
|
|
{% if application.default_policy_config %}
|
|
<span>{{ application.default_policy_config.default_policy }}</span>
|
|
<a href="{% url 'manage_application_policy' %}?uuid={{ application.default_policy_config.uuid }}"
|
|
class="btn btn-sm btn-outline-secondary btn-xs"><i class="fas fa-edit"></i></a>
|
|
<a href="{% url 'delete_application_policy' %}?uuid={{ application.default_policy_config.uuid }}"
|
|
class="btn btn-sm btn-outline-danger btn-xs"><i class="fas fa-times"></i></a>
|
|
{% else %}
|
|
<span class="text-muted">{% trans 'Default (Deny)' %}</span>
|
|
<a href="{% url 'manage_application_policy' %}?application_uuid={{ application.uuid }}"
|
|
class="btn btn-sm btn-outline-primary btn-xs"><i class="fas fa-plus"></i> {% trans 'Set Policy' %}</a>
|
|
{% endif %}
|
|
</div>
|
|
</div>
|
|
|
|
<hr>
|
|
|
|
<h4 id="hosts">{% trans 'Application Hosts' %}</h4>
|
|
<div class="mb-3">
|
|
{% if is_reserved %}
|
|
<a class="btn btn-outline-secondary btn-sm disabled" aria-disabled="true" tabindex="-1" title="{% trans 'This application cannot be modified' %}">
|
|
<i class="fas fa-plus"></i> {% trans 'Add Host' %}
|
|
</a>
|
|
{% else %}
|
|
<a href="{% url 'manage_application_host' %}?application_uuid={{ application.uuid }}"
|
|
class="btn btn-outline-primary btn-sm">
|
|
<i class="fas fa-plus"></i> {% trans 'Add Host' %}
|
|
</a>
|
|
{% endif %}
|
|
</div>
|
|
|
|
{% if hosts %}
|
|
<div class="table-responsive">
|
|
<table class="table table-striped table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>{% trans 'Hostname' %}</th>
|
|
<th>{% trans 'Certificate' %}</th>
|
|
{% if caddy_enabled %}<th>{% trans 'Status' %}</th>{% endif %}
|
|
<th>{% trans 'Actions' %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for host in hosts %}
|
|
<tr>
|
|
<td>{{ host.hostname }}</td>
|
|
<td>
|
|
{{ host.get_certificate_type_display }}
|
|
{% if host.dns_credential %}<small class="text-muted">({{ host.dns_credential }})</small>{% endif %}
|
|
{% if host.certificate_type != 'self_signed' and not host.certificate_fallback %}
|
|
<small class="text-muted">({% trans 'no fallback' %})</small>
|
|
{% endif %}
|
|
</td>
|
|
{% if caddy_enabled %}
|
|
<td class="certificate-status" data-host-uuid="{{ host.uuid }}">
|
|
<i class="fas fa-spinner fa-spin text-muted"></i>
|
|
</td>
|
|
{% endif %}
|
|
<td style="width: 15%" class="text-nowrap">
|
|
{% if host.certificate_type != 'self_signed' %}
|
|
<form method="post" action="{% url 'retry_application_host_certificate' %}?uuid={{ host.uuid }}" class="d-inline">
|
|
{% csrf_token %}
|
|
<button type="submit" class="btn btn-sm btn-outline-secondary" title="{% trans 'Retry certificate' %}">
|
|
<i class="fas fa-sync-alt"></i>
|
|
</button>
|
|
</form>
|
|
{% endif %}
|
|
{% if is_reserved %}
|
|
<a href="{% url 'manage_application_host' %}?uuid={{ host.uuid }}"
|
|
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
<a class="btn btn-sm btn-secondary disabled" aria-disabled="true" tabindex="-1" title="{% trans 'This application cannot be modified' %}">
|
|
<i class="fas fa-trash"></i>
|
|
</a>
|
|
{% else %}
|
|
<a href="{% url 'manage_application_host' %}?uuid={{ host.uuid }}"
|
|
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
<a href="{% url 'delete_application_host' %}?uuid={{ host.uuid }}"
|
|
class="btn btn-sm btn-danger" title="{% trans 'Delete' %}">
|
|
<i class="fas fa-trash"></i>
|
|
</a>
|
|
{% endif %}
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<div class="alert alert-info">
|
|
{% trans 'No Hosts configured for this application.' %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
<hr class="mt-4 mb-4">
|
|
|
|
<h4 id="routes">{% trans 'Application Routes' %}</h4>
|
|
<div class="mb-3">
|
|
<a href="{% url 'manage_application_route' %}?application_uuid={{ application.uuid }}"
|
|
class="btn btn-outline-primary btn-sm">
|
|
<i class="fas fa-plus"></i> {% trans 'Add Route' %}
|
|
</a>
|
|
</div>
|
|
|
|
{% if routes %}
|
|
<div class="table-responsive">
|
|
<table class="table table-striped table-hover">
|
|
<thead>
|
|
<tr>
|
|
<th>{% trans 'Route Name' %}</th>
|
|
<th>{% trans 'Path Prefix' %}</th>
|
|
<th>{% trans 'Policy' %}</th>
|
|
<th>{% trans 'Order' %}</th>
|
|
<th>{% trans 'Actions' %}</th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
{% for route in routes %}
|
|
<tr>
|
|
<td>{{ route }}</td>
|
|
<td><code>{{ route.path_prefix }}</code></td>
|
|
<td>{{ route.policy }}</td>
|
|
<td>{{ route.order }}</td>
|
|
<td style="width: 15%">
|
|
<a href="{% url 'manage_application_route' %}?uuid={{ route.uuid }}"
|
|
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
|
|
<i class="fas fa-edit"></i>
|
|
</a>
|
|
<a href="{% url 'delete_application_route' %}?uuid={{ route.uuid }}"
|
|
class="btn btn-sm btn-danger" title="{% trans 'Delete' %}">
|
|
<i class="fas fa-trash"></i>
|
|
</a>
|
|
</td>
|
|
</tr>
|
|
{% endfor %}
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
{% else %}
|
|
<div class="alert alert-info">
|
|
{% trans 'No Routes configured for this application.' %}
|
|
</div>
|
|
{% endif %}
|
|
|
|
</div>
|
|
</div>
|
|
{% endblock %}
|
|
|
|
{% block custom_page_scripts %}
|
|
{% if caddy_enabled and hosts %}
|
|
<script>
|
|
$(document).ready(function () {
|
|
$.getJSON("{% url 'application_certificate_status' %}?uuid={{ application.uuid }}", function (data) {
|
|
$('.certificate-status').each(function () {
|
|
var cell = $(this);
|
|
var hostStatus = data.hosts[cell.data('host-uuid')];
|
|
cell.empty();
|
|
if (!hostStatus) {
|
|
return;
|
|
}
|
|
cell.append(
|
|
$('<span class="badge"></span>')
|
|
.addClass('badge-' + hostStatus.css_class)
|
|
.attr('title', hostStatus.detail)
|
|
.text(hostStatus.label)
|
|
);
|
|
});
|
|
}).fail(function () {
|
|
$('.certificate-status').html('<span class="text-muted">-</span>');
|
|
});
|
|
});
|
|
</script>
|
|
{% endif %}
|
|
{% endblock %} |