Implement network page

This commit is contained in:
2022-07-26 22:15:30 +01:00
parent c993bb9c6e
commit df049f822c
13 changed files with 304 additions and 15 deletions

View File

@@ -0,0 +1,22 @@
<div id="channels">
{% if channels is not None %}
<div class="content" style="max-height: 30em; overflow: auto;">
<div class="table-container">
<table class="table is-fullwidth is-hoverable">
<tbody>
{% for channel, info in channels.items %}
<tr>
<td>
{{ channel }}
<span class="tag">
{{ info }}
</span>
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
</div>

View File

@@ -0,0 +1,51 @@
<div id="info">
{% if network is not None %}
<div class="content" style="max-height: 30em; overflow: auto;">
<div class="table-container">
<table class="table is-fullwidth is-hoverable">
<thead>
<th>attribute</th>
<th>value</th>
</thead>
<tbody>
{% for key, item in network.items %}
<tr>
<th>{{ key }}</th>
<td>
{% if key == 'security' %}
{% if item == 'none' %}
<span class="icon">
<i class="fa-solid fa-lock-open" aria-hidden="true"></i>
</span>
{% elif item == 'ssl' %}
<span class="icon">
<i class="fa-solid fa-lock" aria-hidden="true"></i>
</span>
{% endif %}
{% elif key == 'relays' %}
<span class="icon">
<i class="fa-brands fa-unity"></i>
</span>
{% elif key == 'channels' %}
<span class="icon">
<i class="fa-solid fa-hashtag"></i>
</span>
{% elif key == 'records' %}
<span class="icon">
<i class="fa-solid fa-album"></i>
</span>
{% elif key == 'host' %}
<span class="icon">
<i class="fa-solid fa-router"></i>
</span>
{% endif %}
{{ item }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
</div>

View File

@@ -0,0 +1,59 @@
<div id="relays">
{% if relays is not None %}
<div class="content" style="max-height: 30em; overflow: auto;">
<div class="table-container">
<table class="table is-fullwidth is-hoverable">
<thead>
<th>net</th>
<th>id</th>
<th>registered</th>
<th>enabled</th>
<th>
<span class="icon">
<i class="fa-solid fa-hashtag"></i>
</span>
</th>
<th>nick</th>
</thead>
<tbody>
{% for relay in relays %}
<tr>
<th>{{ relay.net }}</th>
<td>{{ relay.id }}</td>
<td>
{% if relay.registered %}
<span class="icon">
<i class="fa-solid fa-check" aria-hidden="true"></i>
</span>
{% else %}
<span class="icon">
<i class="fa-solid fa-xmark" aria-hidden="true"></i>
</span>
{% endif %}
</td>
<td>
{% if relay.enabled %}
<span class="icon">
<i class="fa-solid fa-check" aria-hidden="true"></i>
</span>
{% else %}
<span class="icon">
<i class="fa-solid fa-xmark" aria-hidden="true"></i>
</span>
{% endif %}
</td>
<td>
{{ relay.chans }}
</td>
<td>
{{ relay.nick }}
</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
{% endif %}
</div>

View File

@@ -9,21 +9,21 @@
</thead>
{% for key, net in networks.items %}
<tr>
<th>{{ key }}</th>
<th><a href="{% url 'threshold_irc_network' key %}">{{ key }}</a></th>
<td>
<span class="icon has-text-info has-tooltip-info">
<span class="icon">
<i class="fa-brands fa-unity"></i>
</span>
{{ net.relays }}
</td>
<td>
<span class="icon has-text-info has-tooltip-info">
<span class="icon">
<i class="fa-solid fa-hashtag"></i>
</span>
{{ net.channels }}
</td>
<td>
<span class="icon has-text-info has-tooltip-info">
<span class="icon">
<i class="fa-solid fa-album"></i>
</span>
{{ net.records }}

View File

@@ -0,0 +1,60 @@
{% extends "base.html" %}
{% block content %}
<div
style="display: none;"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-post="{% url 'threshold_irc_network_info' net %}"
hx-trigger="load"
hx-target="#info"
hx-swap="outerHTML">
</div>
<div
style="display: none;"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-post="{% url 'threshold_irc_network_relays' net %}"
hx-trigger="load"
hx-target="#relays"
hx-swap="outerHTML">
</div>
<div
style="display: none;"
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
hx-post="{% url 'threshold_irc_network_channels' net %}"
hx-trigger="load"
hx-target="#channels"
hx-swap="outerHTML">
</div>
<div class="columns">
<div class="column">
<div class="box">
<div id="info">
</div>
</div>
</div>
<div class="column">
<div class="box">
<div id="relays">
</div>
</div>
</div>
</div>
<div class="columns">
<div class="column">
<div class="box">
<div id="channels">
</div>
</div>
</div>
<div class="column">
<div class="box">
<div id="alerts">
</div>
</div>
</div>
</div>
{% endblock %}