132 lines
4.8 KiB
HTML
132 lines
4.8 KiB
HTML
{% extends "base.html" %}
|
||
{% block title %}Szczegóły urządzenia - RouterOS Update{% endblock %}
|
||
{% block extra_head %}
|
||
<style>
|
||
/* Stylizacja kart w trybie ciemnym */
|
||
body.dark-mode .card {
|
||
background-color: #1e1e1e;
|
||
color: #e0e0e0;
|
||
border-color: #444;
|
||
}
|
||
/* Stylizacja bloku logów – przewijalny, z odpowiednim tłem i kolorem tekstu */
|
||
.log-block {
|
||
background-color: inherit;
|
||
color: inherit;
|
||
padding: 1rem;
|
||
border: 1px solid #ccc;
|
||
border-radius: 0.25rem;
|
||
max-height: 300px;
|
||
overflow-y: auto;
|
||
white-space: pre-wrap;
|
||
}
|
||
</style>
|
||
{% 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>
|
||
|
||
<!-- Dwukolumnowy układ: dane urządzenia i informacje o systemie -->
|
||
<div class="row">
|
||
<div class="col-md-6">
|
||
<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>
|
||
<div class="col-md-6">
|
||
<div class="card mb-3">
|
||
<div class="card-header bg-primary 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 jako pojedynczy blok tekstu -->
|
||
<div class="card mb-3">
|
||
<div class="card-header bg-secondary text-white">
|
||
Logi urządzenia
|
||
</div>
|
||
<div class="card-body">
|
||
{% if device.last_log %}
|
||
<div class="log-block">
|
||
{{ device.last_log }}
|
||
</div>
|
||
{% else %}
|
||
<p>Brak logów</p>
|
||
{% endif %}
|
||
</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 %}
|