add route template application functionality for peers

This commit is contained in:
Eduardo Silva
2026-01-22 15:30:42 -03:00
parent d378b62c49
commit 2a61a05499
4 changed files with 129 additions and 5 deletions

View File

@@ -0,0 +1,67 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<div class="card card-primary card-outline">
<div class="card-header">
<h3 class="card-title">{% trans 'Apply Route Template' %}</h3>
</div>
<div class="card-body">
<div class="row">
<div class="col-md-12">
<p>{% trans 'Select a routing template to apply to the peer' %} <strong>{{ current_peer }}</strong>.</p>
{% if current_template %}
<div class="alert alert-info">
{% trans 'Current Active Template:' %} <strong>{{ current_template.name }}</strong>
</div>
{% endif %}
</div>
</div>
<div class="table-responsive">
<table class="table table-hover table-bordered table-striped">
<thead>
<tr>
<th>{% trans 'Template Name' %}</th>
<th>{% trans 'Type' %}</th>
<th>{% trans 'Actions' %}</th>
</tr>
</thead>
<tbody>
{% for template in available_templates %}
<tr {% if template == current_template %}class="table-primary" {% endif %}>
<td>{{ template.name }}</td>
<td>{{ template.get_route_type_display }}</td>
<td>
{% if template != current_template %}
<form method="post" style="display:inline;">
{% csrf_token %}
<input type="hidden" name="template_uuid" value="{{ template.uuid }}">
<button type="submit" class="btn btn-primary btn-sm">{% trans 'Apply' %}</button>
</form>
{% else %}
<button class="btn btn-secondary btn-sm" disabled>{% trans 'Active' %}</button>
<form method="post" style="display:inline;">
{% csrf_token %}
<input type="hidden" name="action" value="unlink">
<button type="submit" class="btn btn-warning btn-sm">{% trans 'Unlink' %}</button>
</form>
{% endif %}
</td>
</tr>
{% empty %}
<tr>
<td colspan="3" class="text-center">{% trans 'No routing templates available for this interface.' %}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<div class="card-footer">
<a href="/peer/manage/?peer={{ current_peer.uuid }}" class="btn btn-default">{% trans 'Back' %}</a>
</div>
</div>
{% endblock %}