mirror of
https://github.com/eduardogsilva/wireguard_webadmin.git
synced 2026-03-15 05:26:17 +00:00
add app_gateway management views and templates
This commit is contained in:
254
templates/app_gateway/app_gateway_list.html
Normal file
254
templates/app_gateway/app_gateway_list.html
Normal file
@@ -0,0 +1,254 @@
|
||||
{% extends "base.html" %}
|
||||
{% load i18n %}
|
||||
|
||||
{% block content %}
|
||||
<div class="card card-primary card-outline">
|
||||
<div class="card-body">
|
||||
|
||||
<ul class="nav nav-tabs" role="tablist">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if active_tab == 'applications' or active_tab == 'hosts' %}active{% endif %}"
|
||||
href="{% url 'app_gateway_list' %}?tab=applications" role="tab">
|
||||
{% trans 'Applications' %}
|
||||
</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if active_tab == 'policies' %}active{% endif %}"
|
||||
href="{% url 'app_gateway_list' %}?tab=policies" role="tab">
|
||||
{% 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">
|
||||
<a href="{% url 'app_gateway_list' %}?tab=applications"
|
||||
class="btn {% if active_tab == 'applications' %}btn-primary{% else %}btn-outline-primary{% endif %}">
|
||||
{% trans 'Applications' %}
|
||||
</a>
|
||||
<a href="{% url 'app_gateway_list' %}?tab=hosts"
|
||||
class="btn {% if active_tab == 'hosts' %}btn-primary{% else %}btn-outline-primary{% endif %}">
|
||||
{% trans 'Hosts' %}
|
||||
</a>
|
||||
</div>
|
||||
</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 '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><code>{{ app.upstream }}</code></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>
|
||||
{% else %}
|
||||
<span class="text-muted">{% trans 'Not set' %}</span>
|
||||
{% 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>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-info">
|
||||
{% trans 'No Applications found.' %}
|
||||
</div>
|
||||
{% 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">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<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>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="alert alert-info">
|
||||
{% trans 'No Hosts found.' %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% elif active_tab == 'policies' %}
|
||||
<div class="mb-3">
|
||||
<a href="{% url 'manage_access_policy' %}" class="btn btn-outline-primary btn-sm">
|
||||
<i class="fas fa-plus"></i> {% trans 'Add Access Policy' %}
|
||||
</a>
|
||||
</div>
|
||||
|
||||
{% if access_policies %}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{% trans 'Name' %}</th>
|
||||
<th>{% trans 'Policy Type' %}</th>
|
||||
<th>{% trans 'Groups' %}</th>
|
||||
<th>{% trans 'Auth Methods' %}</th>
|
||||
<th>{% trans 'Actions' %}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for policy in access_policies %}
|
||||
<tr>
|
||||
<td>{{ policy.name }}</td>
|
||||
<td>{{ policy.get_policy_type_display }}</td>
|
||||
<td>{{ policy.groups.count }}</td>
|
||||
<td>{{ policy.methods.count }}</td>
|
||||
<td style="width: 15%">
|
||||
<a href="{% url 'manage_access_policy' %}?uuid={{ policy.uuid }}"
|
||||
class="btn btn-sm btn-info" title="{% trans 'Edit' %}">
|
||||
<i class="fas fa-edit"></i>
|
||||
</a>
|
||||
<a href="{% url 'delete_access_policy' %}?uuid={{ policy.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 Access Policies found.' %}
|
||||
</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>
|
||||
</div>
|
||||
{% endblock %}
|
||||
Reference in New Issue
Block a user