routeros_backup/templates/dashboard.html
2025-02-28 16:26:27 +01:00

136 lines
4.6 KiB
HTML

{% extends "base.html" %}
{% block content %}
<div class="container my-4">
<h2 class="text-center mb-4">Dashboard</h2>
<!-- Wiersz akcji ogólnych -->
<div class="row mb-4">
<div class="col text-center">
<a href="{{ url_for('routers_list') }}" class="btn btn-lg btn-outline-primary">
<i class="bi bi-hdd-network"></i> Zobacz routery
</a>
</div>
</div>
<!-- Karty głównych statystyk -->
<div class="row mb-4">
<div class="col-md-3">
<div class="card text-white bg-primary shadow-sm">
<div class="card-body text-center">
<h5 class="card-title">Routery</h5>
<p class="display-4">{{ routers_count }}</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-white bg-success shadow-sm">
<div class="card-body text-center">
<h5 class="card-title">Exporty</h5>
<p class="display-4">{{ export_count }}</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-white bg-info shadow-sm">
<div class="card-body text-center">
<h5 class="card-title">Backupy binarne</h5>
<p class="display-4">{{ binary_count }}</p>
</div>
</div>
</div>
<div class="col-md-3">
<div class="card text-white bg-dark shadow-sm">
<div class="card-body text-center">
<h5 class="card-title">Łącznie</h5>
<p class="display-4">{{ total_backups }}</p>
</div>
</div>
</div>
</div>
<!-- Przyciski akcji dla wszystkich routerów -->
<div class="row mb-4">
<div class="col-md-6 d-flex justify-content-center">
<form action="{{ url_for('export_all_routers') }}" method="POST">
<button type="submit" class="btn btn-lg btn-outline-success">
<i class="bi bi-arrow-down-circle"></i> Eksport wszystkich routerów
</button>
</form>
</div>
<div class="col-md-6 d-flex justify-content-center">
<form action="{{ url_for('backup_all_routers') }}" method="POST">
<button type="submit" class="btn btn-lg btn-outline-secondary">
<i class="bi bi-cloud-download"></i> Backup binarny wszystkich routerów
</button>
</form>
</div>
</div>
<!-- Statystyki operacji -->
{% set total_ops = success_ops + failure_ops %}
{% if total_ops > 0 %}
{% set success_percent = (success_ops * 100) // total_ops %}
{% else %}
{% set success_percent = 0 %}
{% endif %}
<div class="card mb-4 shadow-sm border-0">
<div class="card-body">
<h5 class="card-title">Statystyki operacji</h5>
<p>Udane operacje: {{ success_ops }}, Nieudane operacje: {{ failure_ops }}</p>
<div class="progress mb-2">
<div class="progress-bar bg-success" role="progressbar" style="width: {{ success_percent }}%;" aria-valuenow="{{ success_percent }}" aria-valuemin="0" aria-valuemax="100">
{{ success_percent }}%
</div>
<div class="progress-bar bg-danger" role="progressbar" style="width: {{ 100 - success_percent }}%;" aria-valuenow="{{ 100 - success_percent }}" aria-valuemin="0" aria-valuemax="100">
{{ 100 - success_percent }}%
</div>
</div>
</div>
</div>
<!-- Log operacji -->
<div class="card shadow-sm border-0 mb-4">
<div class="card-body">
<h5 class="card-title">
Log operacji
<a href="{{ url_for('logs_page') }}" class="btn btn-sm btn-outline-primary ms-2">Więcej logów</a>
</h5>
<table class="table table-sm table-bordered">
<thead>
<tr>
<th>Data</th>
<th>Wiadomość</th>
</tr>
</thead>
<tbody>
{% for log in logs %}
<tr>
<td>{{ log.timestamp.strftime("%Y-%m-%d %H:%M:%S") }}</td>
<td>{{ log.message }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
<!-- Dodatkowe statystyki -->
<div class="card shadow-sm border-0">
<div class="card-body">
<h5 class="card-title">Dodatkowe statystyki</h5>
<div class="row">
<div class="col-md-6">
<p><strong>Czas działania:</strong> {{ uptime }}</p>
<p><strong>Aktualny czas:</strong> {{ current_time.strftime('%Y-%m-%d %H:%M:%S') }}</p>
</div>
<div class="col-md-6">
<p><strong>Całkowity rozmiar dysku:</strong> {{ disk_total|filesize }}</p>
<p><strong>Zajęte (/data):</strong> {{ disk_used|filesize }} ({{ disk_usage_percent|round(2) }}%)</p>
<p><strong>Wolne:</strong> {{ disk_free|filesize }}</p>
</div>
</div>
</div>
</div>
</div>
{% endblock %}