mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-03-15 05:26:17 +00:00
add application details view and update related forms; improve layout
This commit is contained in:
@@ -18,19 +18,13 @@
|
||||
{% trans 'Access Policies' %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if active_tab == 'routes' %}active{% endif %}"
|
||||
href="{% url 'app_gateway_list' %}?tab=routes" role="tab">
|
||||
{% trans 'Routes' %}
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<div class="tab-content mt-4">
|
||||
|
||||
{% if active_tab == 'applications' or active_tab == 'hosts' %}
|
||||
<div class="mb-3">
|
||||
<div class="btn-group mb-3">
|
||||
<div class="d-flex justify-content-between align-items-center mb-3">
|
||||
<div class="btn-group">
|
||||
<a href="{% url 'app_gateway_list' %}?tab=applications"
|
||||
class="btn {% if active_tab == 'applications' %}btn-primary{% else %}btn-outline-primary{% endif %}">
|
||||
{% trans 'Applications' %}
|
||||
@@ -40,61 +34,46 @@
|
||||
{% trans 'Hosts' %}
|
||||
</a>
|
||||
</div>
|
||||
{% if active_tab == 'applications' %}
|
||||
<div>
|
||||
<a href="{% url 'manage_application' %}" class="btn btn-outline-primary">
|
||||
<i class="fas fa-plus"></i> {% trans 'Add Application' %}
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
{% if active_tab == 'applications' %}
|
||||
<div class="mb-3">
|
||||
<a href="{% url 'manage_application' %}" class="btn btn-outline-primary btn-sm">
|
||||
<i class="fas fa-plus"></i> {% trans 'Add Application' %}
|
||||
</a>
|
||||
<a href="{% url 'manage_application_policy' %}" class="btn btn-outline-secondary btn-sm">
|
||||
<i class="fas fa-shield-alt"></i> {% trans 'Set Default Policy' %}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% if applications %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans 'Name' %}</th>
|
||||
<th>{% trans 'Display Name' %}</th>
|
||||
<th>{% trans 'Upstream' %}</th>
|
||||
<th>{% trans 'Hosts' %}</th>
|
||||
<th>{% trans 'Routes' %}</th>
|
||||
<th>{% trans 'Default Policy' %}</th>
|
||||
<th>{% trans 'Actions' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for app in applications %}
|
||||
<tr>
|
||||
<td>{{ app.name }}</td>
|
||||
<td>{{ app.display_name }}</td>
|
||||
<td>
|
||||
<a href="{% url 'view_application' %}?uuid={{ app.uuid }}">
|
||||
<strong>{{ app }}</strong>
|
||||
</a>
|
||||
</td>
|
||||
<td><code>{{ app.upstream }}</code></td>
|
||||
<td>{{ app.hosts.count }}</td>
|
||||
<td>{{ app.routes.count }}</td>
|
||||
<td>
|
||||
{% if app.default_policy_config %}
|
||||
<span class="badge badge-info">{{ app.default_policy_config.default_policy.name }}</span>
|
||||
<a href="{% url 'manage_application_policy' %}?uuid={{ app.default_policy_config.uuid }}"
|
||||
class="btn btn-sm btn-outline-secondary btn-xs" title="{% trans 'Edit Default Policy' %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<a href="{% url 'delete_application_policy' %}?uuid={{ app.default_policy_config.uuid }}"
|
||||
class="btn btn-sm btn-outline-danger btn-xs" title="{% trans 'Remove Default Policy' %}">
|
||||
<i class="fas fa-times"></i>
|
||||
</a>
|
||||
{{ app.default_policy_config.default_policy.name }}
|
||||
{% else %}
|
||||
<span class="text-muted">{% trans 'Not set' %}</span>
|
||||
{% trans 'Default (Deny)' %}
|
||||
{% endif %}
|
||||
</td>
|
||||
<td style="width: 15%">
|
||||
<a href="{% url 'manage_application' %}?uuid={{ app.uuid }}"
|
||||
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<a href="{% url 'delete_application' %}?uuid={{ app.uuid }}"
|
||||
class="btn btn-sm btn-danger" title="{% trans 'Delete' %}">
|
||||
<i class="fas fa-trash"></i>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
@@ -107,11 +86,6 @@
|
||||
{% endif %}
|
||||
|
||||
{% elif active_tab == 'hosts' %}
|
||||
<div class="mb-3">
|
||||
<a href="{% url 'manage_application_host' %}" class="btn btn-outline-primary btn-sm">
|
||||
<i class="fas fa-plus"></i> {% trans 'Add Host' %}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% if hosts %}
|
||||
<div class="table-responsive">
|
||||
@@ -120,22 +94,15 @@
|
||||
<tr>
|
||||
<th>{% trans 'Hostname' %}</th>
|
||||
<th>{% trans 'Application' %}</th>
|
||||
<th>{% trans 'Actions' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for host in hosts %}
|
||||
<tr>
|
||||
<td>{{ host.hostname }}</td>
|
||||
<td>{{ host.application.display_name }}</td>
|
||||
<td style="width: 15%">
|
||||
<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>
|
||||
<td>
|
||||
<a href="{% url 'view_application' %}?uuid={{ host.application.uuid }}">
|
||||
{{ host.application }}
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@@ -197,56 +164,7 @@
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% elif active_tab == 'routes' %}
|
||||
<div class="mb-3">
|
||||
<a href="{% url 'manage_application_route' %}" 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 'Application' %}</th>
|
||||
<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.application.display_name }}</td>
|
||||
<td>{{ route.name }}</td>
|
||||
<td><code>{{ route.path_prefix }}</code></td>
|
||||
<td>{{ route.policy.name }}</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 found.' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
|
||||
142
templates/app_gateway/application_details.html
Normal file
142
templates/app_gateway/application_details.html
Normal file
@@ -0,0 +1,142 @@
|
||||
{% 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>
|
||||
<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>
|
||||
</div>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
|
||||
<div class="row mb-4">
|
||||
<div class="col-md-6">
|
||||
<strong>{% trans 'Name' %}:</strong> {{ application.name }}<br>
|
||||
<strong>{% trans 'Display Name' %}:</strong> {{ application.display_name }}<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.name }}</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">
|
||||
<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>
|
||||
</div>
|
||||
|
||||
{% if hosts %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans 'Hostname' %}</th>
|
||||
<th>{% trans 'Actions' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for host in hosts %}
|
||||
<tr>
|
||||
<td>{{ host.hostname }}</td>
|
||||
<td style="width: 15%">
|
||||
<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>
|
||||
</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.name }}</td>
|
||||
<td><code>{{ route.path_prefix }}</code></td>
|
||||
<td>{{ route.policy.name }}</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 %}
|
||||
Reference in New Issue
Block a user