Files
FabledSteward/fablednetmon/templates/hosts/list.html
T

85 lines
4.9 KiB
HTML

{% extends "base.html" %}
{% block title %}Hosts — FabledNetMon{% endblock %}
{% block content %}
<div style="display:flex;align-items:center;justify-content:space-between;margin-bottom:1.5rem;">
<h1 style="color:#c0c0ff;">Hosts</h1>
<a class="btn" href="/hosts/new">Add Host</a>
</div>
{% if hosts %}
<div class="card" style="padding:0;">
<table style="width:100%;border-collapse:collapse;">
<thead>
<tr style="border-bottom:1px solid #2a2a4a;">
<th style="text-align:left;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">Name</th>
<th style="text-align:left;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">Address</th>
<th style="text-align:left;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">Probe</th>
<th style="text-align:center;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">Ping</th>
<th style="text-align:center;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">Latency</th>
<th style="text-align:center;padding:0.75rem 1rem;color:#8080a0;font-weight:normal;">DNS</th>
<th style="padding:0.75rem 1rem;"></th>
</tr>
</thead>
<tbody>
{% for host in hosts %}
{% set ping = latest_pings.get(host.id) %}
{% set dns = latest_dns.get(host.id) %}
<tr style="border-bottom:1px solid #1a1a3a;">
<td style="padding:0.75rem 1rem;">{{ host.name }}</td>
<td style="padding:0.75rem 1rem;color:#a0a0c0;">{{ host.address }}</td>
<td style="padding:0.75rem 1rem;color:#a0a0c0;font-size:0.85rem;">
{{ host.probe_type.value | upper }}{% if host.probe_type.value == 'tcp' %}:{{ host.probe_port }}{% endif %}
</td>
<td style="padding:0.75rem 1rem;text-align:center;">
{% if not host.ping_enabled %}
<span style="color:#404060;font-size:0.8rem;">off</span>
{% elif ping is none %}
<span style="color:#606080;font-size:0.8rem;"></span>
{% elif ping.status.value == 'up' %}
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#40c040;" title="Up"></span>
{% else %}
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#c04040;" title="Down"></span>
{% endif %}
</td>
<td style="padding:0.75rem 1rem;text-align:center;font-size:0.9rem;">
{% if ping and ping.response_time_ms is not none %}
{% if ping.response_time_ms < 10 %}
<span style="color:#40c040;">{{ ping.response_time_ms | round(1) }} ms</span>
{% elif ping.response_time_ms < 100 %}
<span style="color:#c0c040;">{{ ping.response_time_ms | round(1) }} ms</span>
{% else %}
<span style="color:#c08040;">{{ ping.response_time_ms | round(1) }} ms</span>
{% endif %}
{% else %}
<span style="color:#404060;"></span>
{% endif %}
</td>
<td style="padding:0.75rem 1rem;text-align:center;">
{% if not host.dns_enabled %}
<span style="color:#404060;font-size:0.8rem;">off</span>
{% elif dns is none %}
<span style="color:#606080;font-size:0.8rem;"></span>
{% elif dns.status.value == 'resolved' %}
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#40c040;" title="{{ dns.resolved_ip }}"></span>
{% else %}
<span style="display:inline-block;width:10px;height:10px;border-radius:50%;background:#c04040;" title="Failed"></span>
{% endif %}
</td>
<td style="padding:0.75rem 1rem;text-align:right;">
<a href="/hosts/{{ host.id }}/edit" style="color:#a0a0ff;margin-right:1rem;">Edit</a>
<form method="post" action="/hosts/{{ host.id }}/delete" style="display:inline;">
<button type="submit" style="background:none;border:none;color:#ff6060;cursor:pointer;"
onclick="return confirm('Delete {{ host.name }}?')">Delete</button>
</form>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
{% else %}
<div class="card">
<p style="color:#606080;">No hosts configured yet. <a href="/hosts/new" style="color:#a0a0ff;">Add one.</a></p>
</div>
{% endif %}
{% endblock %}