improved backup list, details and compare.

This commit is contained in:
Eduardo Silva 2024-03-29 11:29:14 -03:00
parent 24906b197d
commit 48dc45f19c
4 changed files with 70 additions and 36 deletions

View file

@ -12,11 +12,13 @@
</a>
</h3>
{% comment %}
<span class="float-right">
<a href="/router/manage/?uuid={{ backup.router.uuid }}" >
<i class="fas fa-edit"></i>
</a>
</span>
{% endcomment %}
</div>
<div class="card-body row">
@ -29,6 +31,12 @@
<span class="float-right">{{ backup }}</span>
</li>
{% endcomment %}
<li class="list-group-item">
<b>Backup ID</b>
<span class="float-right">
{{ backup.id }}
</span>
</li>
<li class="list-group-item">
<b>Schedule Type</b>
<span class="float-right">
@ -97,12 +105,20 @@
<table class="table">
<thead>
<tr>
<th>ID</th>
<th>Date</th>
<th>Compare</th>
</tr>
</thead>
<tbody>
{% for compare_backup in backup_list %}
<tr>
<td class="min-width">
<a href="/backup/backup_details/?uuid={{ compare_backup.uuid }}">
{{ compare_backup.id }}
</a>
</td>
<td>
{% if compare_backup.finish_time %}
{{ compare_backup.finish_time }}

View file

@ -15,22 +15,62 @@
<div class="row">
<div class="col-lg-12">
<table class="table table-hover">
<thead>
<tr>
<th class="min-width">ID</th>
<th>Router</th>
<th>Address</th>
<th>Schedule Type</th>
<th>Schedule Time</th>
<th>Finish Time</th>
<th class="min-width">Hash</th>
<th class="min-width"><i class="fas fa-code-branch" title="Configuration has changed"></i></th>
<th class="min-width">Status</th>
</thead>
<tbody>
{% for backup in backup_list %}
<tr>
<td>
<td class="min-width">
<a href="/backup/backup_details/?uuid={{ backup.uuid }}">
{{ backup.router }}
{{ backup.id }}
</a>
</td>
<td>
<a href="/router/details/?uuid={{ backup.router.uuid }}">
{{ backup.router.name }}
</a>
</td>
<td>{{ backup.router.address }}</td>
<td>{{ backup.get_schedule_type_display }}</td>
<td>{{ backup.schedule_time|default_if_none:"" }}</td>
<td>{% if backup.finish_time %}{{ backup.finish_time }}{% else %}
<i class="far fa-clock text-warning"></i>{% endif %}</td>
<td class="min-width">
{% if backup.backup_text_hash %}
<a href="#" title="{{ backup.backup_text_hash }}">{{ backup.backup_text_hash|slice:":12" }}...</a>
{% endif %}
</td>
<td class="min-width">
{% if backup.config_change_detected %}
<i class="fas fa-code-branch text-info"
title="Configuration has changed since last backup"></i>
{% endif %}
</td>
<td class="min-width" style="text-align: center;">
{% if backup.success %}
<i class="far fa-check-circle text-success"></i>
{% elif backup.error %}
<i class="far fa-times-circle text-danger"
title="{{ backup.error_message }}"></i>
{% elif backup.backup_pending_retrieval %}
<i class="fas fa-cloud-download-alt text-info"
title="Backup pending Retrieval"></i>
{% else %}
<i class="far fa-clock text-warning"></i>
{% endif %}
</td>
</tr>
{% endfor %}
</tbody>

View file

@ -23,21 +23,11 @@
<div class="card card-primary card-outline">
<div class="card-header">
<h3 class="card-title">
<a href="/router/details/?uuid={{ backup1.router.uuid }}">{{ backup1.router }}</a> -
Comparing backup:
<a href="/backup/backup_details/?uuid={{ backup1.uuid }}"
title="{{ backup1.backup_text_hash }}">
{% if backup1.finish_time %}{{ backup1.finish_time }}{% else %}
{{ backup1.created }}{% endif %}
</a>
with:
<a href="/backup/backup_details/?uuid={{ backup2.uuid }}"
title="{{ backup2.backup_text_hash }}">
{% if backup2.finish_time %}{{ backup2.finish_time }}{% else %}
{{ backup2.created }}{% endif %}
</a>
Comparing backup
<a href="/backup/backup_details/?uuid={{ backup1.uuid }}" title="hash: {{ backup1.backup_text_hash }}">{{ backup1.id }}</a>
with
<a href="/backup/backup_details/?uuid={{ backup2.uuid }}" title="hash: {{ backup2.backup_text_hash }}">{{ backup2.id }}</a>
</h3>
</div>
<div class="card-body row">
@ -62,7 +52,6 @@
{% block custom_page_scripts %}
<script type="text/javascript">
var diffString = `{{ diff_str|safe }}`;
function renderDiff(viewType) {
var targetElement = document.getElementById('diff-container');
var processedDiffString = diffString.split('\n').filter(line => {
@ -78,12 +67,7 @@
var diffHtml = Diff2Html.html(processedDiffString, configuration);
targetElement.innerHTML = diffHtml;
}
//renderDiff('inline');
renderDiff('side-by-side');
</script>
{% endblock %}

View file

@ -5,10 +5,8 @@
<div class='row'>
<div class='col-xl-5'>
<div class="card card-primary card-outline">
<div class="card-header">
<h3 class="card-title">{{ router.name }}
</h3>
<span class="float-right">
<a href="/router/manage/?uuid={{ router.uuid }}" >
@ -123,23 +121,19 @@
<table class="table">
<thead>
<tr>
<th></th>
<th>ID</th>
<th>Schedule</th>
<th>Time</th>
<th>Status</th>
<th><i class="fas fa-code-branch" title="Configuration has changed"></i></th>
</tr>
</thead>
<tbody>
{% for backup in router_backup_list %}
<tr>
<td class="min-width">
<a href="/backup/backup_details/?uuid={{ backup.uuid }}">
<i class="far fa-eye"></i>
{% comment %}<i class="far fa-eye"></i>{% endcomment %}{{ backup.id }}
</a>
</td>