2026-03-12 18:41:21 -03:00
{% extends "base.html" %}
{% load i18n %}
{% block content %}
2026-11-18 18:00:06 -03:00
{% include 'app_gateway/pending_export_alert.html' %}
2026-03-12 18:41:21 -03:00
< 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 >
2026-03-16 17:24:20 -03:00
{% 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 %}
2026-03-12 18:41:21 -03:00
< 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 >
2026-03-16 17:24:20 -03:00
{% endif %}
2026-03-12 18:41:21 -03:00
</ div >
</ div >
< div class = "card-body" >
< div class = "row mb-4" >
< div class = "col-md-6" >
2026-03-16 16:33:12 -03:00
< strong > {% trans 'Name' %}:</ strong > {{ application }}< br >
2026-03-12 18:41:21 -03:00
< 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 %}
2026-03-16 16:33:12 -03:00
< span > {{ application.default_policy_config.default_policy }}</ span >
2026-03-12 18:41:21 -03:00
< 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" >
2026-03-16 17:24:20 -03:00
{% 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 %}
2026-03-12 18:41:21 -03:00
< 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 >
2026-03-16 17:24:20 -03:00
{% endif %}
2026-03-12 18:41:21 -03:00
</ div >
2026-11-17 15:59:40 -03:00
{% if hosts %}
2026-03-12 18:41:21 -03:00
< div class = "table-responsive" >
< table class = "table table-striped table-hover" >
< thead >
< tr >
< th > {% trans 'Hostname' %}</ th >
2026-11-17 15:59:40 -03:00
< th > {% trans 'Certificate' %}</ th >
2026-11-18 17:46:49 -03:00
{% if caddy_enabled %}< th > {% trans 'Status' %}</ th > {% endif %}
2026-11-22 12:13:27 -03:00
< th class = "min-width" > {% trans 'Actions' %}</ th >
2026-03-12 18:41:21 -03:00
</ tr >
</ thead >
< tbody >
{% for host in hosts %}
< tr >
< td > {{ host.hostname }}</ td >
2026-11-17 15:59:40 -03:00
< td >
2026-11-22 11:47:11 -03:00
{% include 'app_gateway/host_certificate.html' %}
2026-11-17 15:59:40 -03:00
</ td >
2026-11-18 17:46:49 -03:00
{% if caddy_enabled %}
< td class = "certificate-status" data-host-uuid = "{{ host.uuid }}" >
< i class = "fas fa-spinner fa-spin text-muted" ></ i >
</ td >
{% endif %}
2026-11-22 12:13:27 -03:00
< td class = "min-width" >
2026-11-18 17:33:44 -03:00
< form method = "post" action = "{% url 'retry_application_host_certificate' %}?uuid={{ host.uuid }}" class = "d-inline" >
{% csrf_token %}
2026-11-22 12:13:27 -03:00
< button type = "submit" class = "btn btn-sm btn-outline-secondary"
title = "{% if host.certificate_type == 'self_signed' %}{% trans 'Issue a new self-signed certificate' %}{% else %}{% trans 'Retry certificate' %}{% endif %}" >
2026-11-18 17:33:44 -03:00
< i class = "fas fa-sync-alt" ></ i >
</ button >
</ form >
2026-03-16 17:24:20 -03:00
{% if is_reserved %}
2026-11-17 15:59:40 -03:00
< a href = "{% url 'manage_application_host' %}?uuid={{ host.uuid }}"
class = "btn btn-sm btn-info" title = "{% trans 'Edit' %}" >
2026-03-16 17:24:20 -03:00
< 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 %}
2026-03-12 18:41:21 -03:00
< 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 >
2026-03-16 17:24:20 -03:00
{% endif %}
2026-03-12 18:41:21 -03:00
</ 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 >
2026-11-22 12:13:27 -03:00
< th class = "min-width" > {% trans 'Actions' %}</ th >
2026-03-12 18:41:21 -03:00
</ tr >
</ thead >
< tbody >
{% for route in routes %}
< tr >
2026-03-16 16:33:12 -03:00
< td > {{ route }}</ td >
2026-03-12 18:41:21 -03:00
< td >< code > {{ route.path_prefix }}</ code ></ td >
2026-03-16 16:33:12 -03:00
< td > {{ route.policy }}</ td >
2026-03-12 18:41:21 -03:00
< td > {{ route.order }}</ td >
2026-11-22 12:13:27 -03:00
< td class = "min-width" >
2026-03-12 18:41:21 -03:00
< 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 >
2026-11-18 17:46:49 -03:00
{% endblock %}
2026-11-22 11:47:11 -03:00
{% block page_custom_head %}
< style >
. tooltip-inner . host-certificate-tooltip {
max-width : 420 px ;
}
</ style >
{% endblock %}
2026-11-18 17:46:49 -03:00
{% block custom_page_scripts %}
2026-11-22 11:47:11 -03:00
< script >
$ ( function () {
$ ( '[data-toggle="tooltip"]' ). tooltip ();
});
</ script >
2026-11-18 17:46:49 -03:00
{% 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 );
2026-11-20 11:56:30 -03:00
var serversStatus = data . hosts [ cell . data ( 'host-uuid' )] || [];
2026-11-18 17:46:49 -03:00
cell . empty ();
2026-11-22 12:13:27 -03:00
if ( ! serversStatus . length ) {
return ;
}
function badge ( cssClass , label , title ) {
return $ ( '<span class="badge"></span>' ). addClass ( 'badge-' + cssClass ). attr ( 'title' , title ). text ( label );
}
function serverDetail ( serverStatus ) {
return serverStatus . server ? serverStatus . server + ': ' + serverStatus . detail : serverStatus . detail ;
}
// When every server is in the same state, a single badge summarizes them
var first = serversStatus [ 0 ];
var sameState = serversStatus . every ( function ( serverStatus ) {
return serverStatus . label === first . label && serverStatus . css_class === first . css_class ;
});
if ( sameState ) {
cell . append ( badge ( first . css_class , first . label , serversStatus . map ( serverDetail ). join ( '\n' )));
return ;
}
2026-11-20 11:56:30 -03:00
$ . each ( serversStatus , function ( index , serverStatus ) {
2026-11-22 12:13:27 -03:00
if ( index ) {
cell . append ( '<br>' );
}
cell . append ( badge (
serverStatus . css_class , serverStatus . server + ': ' + serverStatus . label , serverStatus . detail
));
2026-11-20 11:56:30 -03:00
});
2026-11-18 17:46:49 -03:00
});
}). fail ( function () {
$ ( '.certificate-status' ). html ( '<span class="text-muted">-</span>' );
});
});
</ script >
{% endif %}
2026-03-12 18:41:21 -03:00
{% endblock %}