init
This commit is contained in:
4
templates/.gitignore
vendored
Normal file
4
templates/.gitignore
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
__pycache__
|
||||
data/
|
||||
instance/
|
||||
venv/
|
32
templates/add_device.html
Normal file
32
templates/add_device.html
Normal file
@ -0,0 +1,32 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Dodaj urządzenie - RouterOS Update{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<h2>Dodaj nowe urządzenie</h2>
|
||||
<form method="POST">
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Nazwa urządzenia (opcjonalnie)</label>
|
||||
<input type="text" class="form-control" name="name" id="name">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="ip" class="form-label">Adres IP</label>
|
||||
<input type="text" class="form-control" name="ip" id="ip" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="port" class="form-label">Port</label>
|
||||
<input type="number" class="form-control" name="port" id="port" value="8728" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="device_username" class="form-label">Nazwa użytkownika urządzenia</label>
|
||||
<input type="text" class="form-control" name="device_username" id="device_username" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="device_password" class="form-label">Hasło urządzenia</label>
|
||||
<input type="password" class="form-control" name="device_password" id="device_password" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Dodaj urządzenie</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
61
templates/base.html
Normal file
61
templates/base.html
Normal file
@ -0,0 +1,61 @@
|
||||
<!doctype html>
|
||||
<html lang="pl">
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{% block title %}RouterOS Update{% endblock %}</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<!-- Bootstrap CSS -->
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||
</head>
|
||||
<body class="d-flex flex-column min-vh-100">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
<div class="container-fluid">
|
||||
<span class="navbar-brand">RouterOS Update</span>
|
||||
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarButtons" aria-controls="navbarButtons" aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="collapse navbar-collapse" id="navbarButtons">
|
||||
<div class="ms-auto">
|
||||
{% if current_user.is_authenticated %}
|
||||
<div class="btn-group me-2" role="group">
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('devices') }}'">Urządzenia</button>
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('logs') }}'">Logi</button>
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('settings') }}'">Ustawienia</button>
|
||||
</div>
|
||||
<div class="btn-group" role="group">
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('logout') }}'">Wyloguj</button>
|
||||
</div>
|
||||
{% else %}
|
||||
<div class="btn-group me-2" role="group">
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('login') }}'">Logowanie</button>
|
||||
<button type="button" class="btn btn-outline-light" onclick="window.location.href='{{ url_for('register') }}'">Rejestracja</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<main class="container my-4 flex-fill">
|
||||
{% with messages = get_flashed_messages() %}
|
||||
{% if messages %}
|
||||
<div class="alert alert-info">
|
||||
{% for message in messages %}
|
||||
<div>{{ message }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
{% block content %}{% endblock %}
|
||||
</main>
|
||||
|
||||
<footer class="footer bg-light py-3 mt-auto">
|
||||
<div class="container text-center">
|
||||
<span class="text-muted">© 2025 RouterOS Update</span>
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<!-- Bootstrap JS -->
|
||||
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0/dist/js/bootstrap.bundle.min.js"></script>
|
||||
</body>
|
||||
</html>
|
94
templates/device_detail.html
Normal file
94
templates/device_detail.html
Normal file
@ -0,0 +1,94 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Szczegóły urządzenia - RouterOS Update{% endblock %}
|
||||
{% block content %}
|
||||
<div class="container">
|
||||
<h2 class="mb-4">Szczegóły urządzenia</h2>
|
||||
<div class="row">
|
||||
<!-- Dane urządzenia -->
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="card h-100">
|
||||
<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) }}">
|
||||
<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ń</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- Informacje o systemie -->
|
||||
<div class="col-md-6 mb-3">
|
||||
<div class="card h-100">
|
||||
<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 -->
|
||||
<div class="card mb-3">
|
||||
<div class="card-header bg-secondary text-white">
|
||||
Logi urządzenia
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<pre class="bg-light p-3" style="white-space: pre-wrap;">{{ device.last_log or 'Brak logów' }}</pre>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Akcje -->
|
||||
<div class="mb-4">
|
||||
<div class="btn-group" role="group">
|
||||
<form method="POST" action="{{ url_for('update_device', device_id=device.id) }}" style="display: inline-block;">
|
||||
<button type="submit" class="btn btn-warning me-2">Aktualizuj system</button>
|
||||
</form>
|
||||
<form method="POST" action="{{ url_for('update_firmware', device_id=device.id) }}" style="display: inline-block;">
|
||||
<button type="submit" class="btn btn-danger me-2">Aktualizuj firmware</button>
|
||||
</form>
|
||||
<a href="{{ url_for('force_check', device_id=device.id) }}" class="btn btn-secondary me-2">Wymuś sprawdzenie</a>
|
||||
</div>
|
||||
<a href="{{ url_for('devices') }}" class="btn btn-outline-secondary ms-3">Powrót do listy urządzeń</a>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
47
templates/devices.html
Normal file
47
templates/devices.html
Normal file
@ -0,0 +1,47 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Moje urządzenia - RouterOS Update{% endblock %}
|
||||
{% block content %}
|
||||
<h2>Moje urządzenia</h2>
|
||||
<button type="button" class="btn btn-success mb-3" onclick="window.location.href='{{ url_for('add_device') }}'">Dodaj nowe urządzenie</button>
|
||||
<table class="table table-bordered table-hover">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Nazwa / Adres IP</th>
|
||||
<th>Ostatnie sprawdzenie</th>
|
||||
<th>Status</th>
|
||||
<th>System / Firmware</th>
|
||||
<th>Akcje</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for device in devices %}
|
||||
<tr>
|
||||
<td>{{ device.name or device.ip }}</td>
|
||||
<td>{{ device.last_check.strftime('%Y-%m-%d %H:%M:%S') if device.last_check else 'Brak' }}</td>
|
||||
<td>
|
||||
{% if device.update_required %}
|
||||
<span class="badge bg-danger">Wymaga aktualizacji</span>
|
||||
{% else %}
|
||||
<span class="badge bg-success">Aktualny</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<small>
|
||||
<strong>System:</strong> {{ device.current_version or 'Brak' }}<br>
|
||||
<strong>Firmware:</strong> {{ device.current_firmware or 'Brak' }}
|
||||
</small>
|
||||
</td>
|
||||
<td>
|
||||
<button type="button" class="btn btn-info btn-sm" onclick="window.location.href='{{ url_for('device_detail', device_id=device.id) }}'">Szczegóły</button>
|
||||
<button type="button" class="btn btn-secondary btn-sm" onclick="window.location.href='{{ url_for('force_check', device_id=device.id) }}'">Wymuś sprawdzenie</button>
|
||||
<button type="button" class="btn btn-warning btn-sm" onclick="window.location.href='{{ url_for('edit_device', device_id=device.id) }}'">Edytuj</button>
|
||||
</td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="5" class="text-center">Brak dodanych urządzeń.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
40
templates/edit_device.html
Normal file
40
templates/edit_device.html
Normal file
@ -0,0 +1,40 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Edytuj urządzenie - RouterOS Update{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<h2>Edytuj urządzenie</h2>
|
||||
<form method="POST">
|
||||
<div class="mb-3">
|
||||
<label for="name" class="form-label">Nazwa urządzenia (opcjonalnie)</label>
|
||||
<input type="text" class="form-control" name="name" id="name" value="{{ device.name }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="ip" class="form-label">Adres IP</label>
|
||||
<input type="text" class="form-control" name="ip" id="ip" value="{{ device.ip }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="port" class="form-label">Port</label>
|
||||
<input type="number" class="form-control" name="port" id="port" value="{{ device.port }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="device_username" class="form-label">Nazwa użytkownika urządzenia</label>
|
||||
<input type="text" class="form-control" name="device_username" id="device_username" value="{{ device.device_username }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="device_password" class="form-label">Hasło urządzenia</label>
|
||||
<input type="password" class="form-control" name="device_password" id="device_password" value="{{ device.device_password }}" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="branch" class="form-label">Wybierz branch aktualizacji</label>
|
||||
<select class="form-select" name="branch" id="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>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Zapisz zmiany</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
16
templates/index.html
Normal file
16
templates/index.html
Normal file
@ -0,0 +1,16 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Strona główna - RouterOS Update{% endblock %}
|
||||
{% block content %}
|
||||
<div class="p-5 mb-4 bg-light rounded-3">
|
||||
<div class="container-fluid py-5">
|
||||
<h1 class="display-5 fw-bold">Witamy w RouterOS Update</h1>
|
||||
<p class="col-md-8 fs-4">Monitoruj swoje urządzenia, sprawdzaj aktualizacje oraz zarządzaj powiadomieniami w jednym miejscu.</p>
|
||||
{% if not current_user.is_authenticated %}
|
||||
<button type="button" class="btn btn-primary btn-lg" onclick="window.location.href='{{ url_for('login') }}'">Logowanie</button>
|
||||
<button type="button" class="btn btn-secondary btn-lg" onclick="window.location.href='{{ url_for('register') }}'">Rejestracja</button>
|
||||
{% else %}
|
||||
<button type="button" class="btn btn-primary btn-lg" onclick="window.location.href='{{ url_for('devices') }}'">Moje urządzenia</button>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
20
templates/login.html
Normal file
20
templates/login.html
Normal file
@ -0,0 +1,20 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Logowanie - RouterOS Update{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<h2>Logowanie</h2>
|
||||
<form method="POST">
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Nazwa użytkownika</label>
|
||||
<input type="text" class="form-control" name="username" id="username" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Hasło</label>
|
||||
<input type="password" class="form-control" name="password" id="password" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Zaloguj</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
33
templates/logs.html
Normal file
33
templates/logs.html
Normal file
@ -0,0 +1,33 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Logi - Aplikacja Updatera{% endblock %}
|
||||
{% block content %}
|
||||
<h2>Logi</h2>
|
||||
<table class="table table-striped">
|
||||
<thead class="table-dark">
|
||||
<tr>
|
||||
<th>Data i czas</th>
|
||||
<th>Urządzenie</th>
|
||||
<th>Wiadomość</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for log in logs %}
|
||||
<tr>
|
||||
<td>{{ log.timestamp.strftime('%Y-%m-%d %H:%M:%S') }}</td>
|
||||
<td>
|
||||
{% if log.device_id %}
|
||||
<a href="{{ url_for('device_detail', device_id=log.device_id) }}">Urządzenie #{{ log.device_id }}</a>
|
||||
{% else %}
|
||||
Ogólne
|
||||
{% endif %}
|
||||
</td>
|
||||
<td><pre style="white-space: pre-wrap;">{{ log.message }}</pre></td>
|
||||
</tr>
|
||||
{% else %}
|
||||
<tr>
|
||||
<td colspan="3" class="text-center">Brak logów.</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
{% endblock %}
|
24
templates/register.html
Normal file
24
templates/register.html
Normal file
@ -0,0 +1,24 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Rejestracja - RouterOS Update{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-6">
|
||||
<h2>Rejestracja</h2>
|
||||
<form method="POST">
|
||||
<div class="mb-3">
|
||||
<label for="username" class="form-label">Nazwa użytkownika</label>
|
||||
<input type="text" class="form-control" name="username" id="username" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="email" class="form-label">Email</label>
|
||||
<input type="email" class="form-control" name="email" id="email" required>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="password" class="form-label">Hasło</label>
|
||||
<input type="password" class="form-control" name="password" id="password" required>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Zarejestruj się</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
87
templates/settings.html
Normal file
87
templates/settings.html
Normal file
@ -0,0 +1,87 @@
|
||||
{% extends "base.html" %}
|
||||
{% block title %}Ustawienia - RouterOS Update{% endblock %}
|
||||
{% block content %}
|
||||
<div class="row justify-content-center">
|
||||
<div class="col-md-8">
|
||||
<h2>Ustawienia powiadomień</h2>
|
||||
<form method="POST">
|
||||
<fieldset class="border p-3 mb-3">
|
||||
<legend class="w-auto">Pushover</legend>
|
||||
<div class="form-check mb-2">
|
||||
<input type="checkbox" class="form-check-input" name="pushover_enabled" id="pushover_enabled" {% if settings.pushover_enabled %}checked{% endif %}>
|
||||
<label class="form-check-label" for="pushover_enabled">Włącz powiadomienia Pushover</label>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="pushover_user_key" class="form-label">Pushover User Key</label>
|
||||
<input type="text" class="form-control" name="pushover_user_key" id="pushover_user_key" value="{{ settings.pushover_user_key or '' }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="pushover_token" class="form-label">Pushover Token</label>
|
||||
<input type="text" class="form-control" name="pushover_token" id="pushover_token" value="{{ settings.pushover_token or '' }}">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<!-- Pozostała część formularza SMTP oraz interwału -->
|
||||
<fieldset class="border p-3 mb-3">
|
||||
<legend class="w-auto">SMTP (E-mail)</legend>
|
||||
<div class="form-check mb-2">
|
||||
<input type="checkbox" class="form-check-input" name="email_notifications_enabled" id="email_notifications_enabled" {% if settings.email_notifications_enabled %}checked{% endif %}>
|
||||
<label class="form-check-label" for="email_notifications_enabled">Włącz powiadomienia e-mail</label>
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="smtp_server" class="form-label">SMTP Server</label>
|
||||
<input type="text" class="form-control" name="smtp_server" id="smtp_server" value="{{ settings.smtp_server or '' }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="smtp_port" class="form-label">SMTP Port</label>
|
||||
<input type="number" class="form-control" name="smtp_port" id="smtp_port" value="{{ settings.smtp_port or '' }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="smtp_username" class="form-label">SMTP Username</label>
|
||||
<input type="text" class="form-control" name="smtp_username" id="smtp_username" value="{{ settings.smtp_username or '' }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="smtp_password" class="form-label">SMTP Password</label>
|
||||
<input type="password" class="form-control" name="smtp_password" id="smtp_password" value="{{ settings.smtp_password or '' }}">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="border p-3 mb-3">
|
||||
<legend class="w-auto">Interwał sprawdzania</legend>
|
||||
<div class="mb-3">
|
||||
<label for="check_interval" class="form-label">Interwał (sekundy)</label>
|
||||
<input type="number" class="form-control" name="check_interval" id="check_interval" value="{{ settings.check_interval or 60 }}">
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="time_input" class="form-label">Czas (HH:MM:SS)</label>
|
||||
<input type="text" class="form-control" id="time_input" placeholder="np. 01:30:00">
|
||||
<button type="button" class="btn btn-secondary mt-2" onclick="convertTime()">Konwertuj na sekundy</button>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="border p-3 mb-3">
|
||||
<legend class="w-auto">Retencja logów</legend>
|
||||
<div class="mb-3">
|
||||
<label for="log_retention_days" class="form-label">Przechowywać logi przez (dni)</label>
|
||||
<input type="number" class="form-control" name="log_retention_days" id="log_retention_days" value="{{ settings.log_retention_days or 30 }}">
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<button type="submit" class="btn btn-primary">Zapisz ustawienia</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
function convertTime() {
|
||||
var timeStr = document.getElementById("time_input").value;
|
||||
var parts = timeStr.split(':');
|
||||
if (parts.length !== 3) {
|
||||
alert("Podaj czas w formacie HH:MM:SS");
|
||||
return;
|
||||
}
|
||||
var seconds = parseInt(parts[0]) * 3600 + parseInt(parts[1]) * 60 + parseInt(parts[2]);
|
||||
document.getElementById("check_interval").value = seconds;
|
||||
}
|
||||
</script>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user