routeros_update/templates/device_detail.html
Mateusz Gruszczyński 8e7a0b3538 funkcje
2025-02-23 21:00:43 +01:00

121 lines
5.5 KiB
HTML

{% extends "base.html" %}
{% block title %}Szczegóły urządzenia - RouterOS Update{% endblock %}
{% block content %}
<div class="container">
<div class="my-4">
<h2 class="mb-3">Szczegóły urządzenia</h2>
<nav aria-label="breadcrumb">
<ol class="breadcrumb">
<li class="breadcrumb-item"><a href="{{ url_for('devices') }}">Urządzenia</a></li>
<li class="breadcrumb-item active" aria-current="page">{{ device.ip }}</li>
</ol>
</nav>
</div>
<!-- Zakładki dla danych urządzenia i informacji o systemie -->
<ul class="nav nav-tabs mb-3" id="deviceTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="device-data-tab" data-bs-toggle="tab" data-bs-target="#device-data" type="button" role="tab" aria-controls="device-data" aria-selected="true">Dane urządzenia</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="system-info-tab" data-bs-toggle="tab" data-bs-target="#system-info" type="button" role="tab" aria-controls="system-info" aria-selected="false">Informacje o systemie</button>
</li>
</ul>
<div class="tab-content" id="deviceTabContent">
<!-- Dane urządzenia -->
<div class="tab-pane fade show active" id="device-data" role="tabpanel" aria-labelledby="device-data-tab">
<div class="card mb-3">
<div class="card-header bg-primary text-white">
Dane urządzenia
</div>
<div class="card-body">
<p><strong>Adres IP:</strong> {{ device.ip }}</p>
<p><strong>Port:</strong> {{ device.port }}</p>
<p><strong>Ostatnie sprawdzenie:</strong>
{% if device.last_check %}{{ device.last_check.strftime('%Y-%m-%d %H:%M:%S') }}{% else %}Brak{% endif %}
</p>
<p>
<strong>System:</strong> {{ device.current_version or 'Brak' }}<br>
<strong>Firmware:</strong> {{ device.current_firmware or 'N/A' }}
</p>
<p>
<strong>Branch aktualizacji:</strong> {{ device.branch|capitalize }}
</p>
<!-- Formularz zmiany branch -->
<form method="POST" action="{{ url_for('edit_device', device_id=device.id) }}" class="mt-3">
<div class="input-group">
<select class="form-select" name="branch">
<option value="stable" {% if device.branch == 'stable' %}selected{% endif %}>Stable</option>
<option value="dev" {% if device.branch == 'dev' %}selected{% endif %}>Dev</option>
<option value="beta" {% if device.branch == 'beta' %}selected{% endif %}>Beta</option>
</select>
<button type="submit" class="btn btn-primary ms-2">Zmień branch</button>
</div>
</form>
</div>
</div>
</div>
<!-- Informacje o systemie -->
<div class="tab-pane fade" id="system-info" role="tabpanel" aria-labelledby="system-info-tab">
<div class="card mb-3">
<div class="card-header bg-info text-white">
Informacje o systemie
</div>
<div class="card-body">
{% if resource.error %}
<div class="alert alert-danger" role="alert">
Błąd pobierania danych: {{ resource.error }}
</div>
{% else %}
<p><strong>Wersja systemu:</strong> {{ resource.version or 'Brak danych' }}</p>
<p><strong>Czas pracy:</strong> {{ resource.uptime or 'Brak danych' }}</p>
<p><strong>Obciążenie CPU:</strong> {{ resource['cpu-load'] or 'Brak' }}%</p>
<p>
<strong>Pamięć:</strong>
{% if resource['free-memory'] and resource['total-memory'] %}
{{ resource['free-memory'] }} wolnej / {{ resource['total-memory'] }} całkowita
{% else %}
Brak danych
{% endif %}
</p>
<p><strong>Wolne miejsce na dysku:</strong> {{ resource['free-hdd-space'] or 'Brak danych' }}</p>
{% endif %}
</div>
</div>
</div>
</div>
<!-- Logi urządzenia w formie accordion -->
<div class="accordion mb-3" id="logsAccordion">
<div class="accordion-item">
<h2 class="accordion-header" id="headingLogs">
<button class="accordion-button collapsed" type="button" data-bs-toggle="collapse" data-bs-target="#collapseLogs" aria-expanded="false" aria-controls="collapseLogs">
Logi urządzenia
</button>
</h2>
<div id="collapseLogs" class="accordion-collapse collapse" aria-labelledby="headingLogs" data-bs-parent="#logsAccordion">
<div class="accordion-body">
<pre class="bg-light p-3" style="white-space: pre-wrap;">{{ device.last_log or 'Brak logów' }}</pre>
</div>
</div>
</div>
</div>
<!-- Akcje urządzenia -->
<div class="mb-4">
<div class="d-flex flex-wrap gap-2">
<form method="POST" action="{{ url_for('update_device', device_id=device.id) }}">
<button type="submit" class="btn btn-warning">Aktualizuj system</button>
</form>
<form method="POST" action="{{ url_for('update_firmware', device_id=device.id) }}">
<button type="submit" class="btn btn-danger">Aktualizuj firmware</button>
</form>
<a href="{{ url_for('force_check', device_id=device.id) }}" class="btn btn-secondary">Wymuś sprawdzenie</a>
</div>
<div class="mt-3">
<a href="{{ url_for('devices') }}" class="btn btn-outline-secondary">Powrót do listy urządzeń</a>
</div>
</div>
</div>
{% endblock %}