Implement network statistics
This commit is contained in:
parent
1c4d87e662
commit
c993bb9c6e
|
@ -1,5 +1,6 @@
|
|||
from core.lib.threshold import threshold_request
|
||||
|
||||
|
||||
def get_irc_stats():
|
||||
url = "irc/stats"
|
||||
payload = {}
|
||||
|
@ -8,6 +9,7 @@ def get_irc_stats():
|
|||
return {}
|
||||
return stats
|
||||
|
||||
|
||||
def get_irc_networks():
|
||||
url = "irc/networks"
|
||||
payload = {}
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<div class="content" style="max-height: 30em; overflow: auto;">
|
||||
<table class="table is-fullwidth is-hoverable">
|
||||
<thead>
|
||||
<th>name</th>
|
||||
<th>net</th>
|
||||
<th>relays</th>
|
||||
<th>channels</th>
|
||||
<th>records</th>
|
||||
|
|
|
@ -1,32 +1,24 @@
|
|||
<div id="stats">
|
||||
<div class="content" style="max-height: 30em; overflow: auto;">
|
||||
<div class="table-container">
|
||||
|
||||
<table class="table is-fullwidth is-hoverable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>X</th>
|
||||
<th>total</th>
|
||||
<th>unique</th>
|
||||
<th>attribute</th>
|
||||
<th>count</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>total</th>
|
||||
<th>relays</th>
|
||||
<td>
|
||||
{{ stats.servers_total_total }}
|
||||
</td>
|
||||
<td>
|
||||
{{ stats.servers_total_unique }}
|
||||
{{ stats.servers_online_total }}/{{ stats.servers_total_total }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>online</th>
|
||||
<th>networks</th>
|
||||
<td>
|
||||
{{ stats.servers_online_total }}
|
||||
</td>
|
||||
<td>
|
||||
{{ stats.servers_online_unique }}
|
||||
{{ stats.servers_online_unique }}/{{ stats.servers_total_unique }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
|
|
|
@ -1,25 +1,25 @@
|
|||
{% extends "base.html" %}
|
||||
{% block content %}
|
||||
|
||||
<div
|
||||
<div
|
||||
style="display: none;"
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-post="{% url 'threshold_irc_stats' %}"
|
||||
hx-trigger="load"
|
||||
hx-target="#stats"
|
||||
hx-swap="outerHTML">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
<div
|
||||
style="display: none;"
|
||||
hx-headers='{"X-CSRFToken": "{{ csrf_token }}"}'
|
||||
hx-post="{% url 'threshold_irc_networks' %}"
|
||||
hx-trigger="load"
|
||||
hx-target="#networks"
|
||||
hx-swap="outerHTML">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="columns">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="box">
|
||||
<div id="stats">
|
||||
|
@ -32,9 +32,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="columns">
|
||||
<div class="columns">
|
||||
<div class="column">
|
||||
<div class="box">
|
||||
<div id="channels">
|
||||
|
@ -47,5 +47,5 @@
|
|||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
|
|
@ -1,12 +1,13 @@
|
|||
from django.views import View
|
||||
from django.shortcuts import render
|
||||
from django.views import View
|
||||
|
||||
from core.lib.manage.threshold import get_irc_networks, get_irc_stats
|
||||
from core.views.manage.permissions import SuperUserRequiredMixin
|
||||
from core.lib.manage.threshold import get_irc_stats, get_irc_networks
|
||||
|
||||
|
||||
class ThresholdIRCStats(SuperUserRequiredMixin, View):
|
||||
stats_template = "dynamic/manage/threshold/irc/stats.html"
|
||||
|
||||
|
||||
def post(self, request):
|
||||
stats = get_irc_stats()
|
||||
context = {"stats": stats}
|
||||
|
@ -16,7 +17,6 @@ class ThresholdIRCStats(SuperUserRequiredMixin, View):
|
|||
class ThresholdIRCNetworks(SuperUserRequiredMixin, View):
|
||||
stats_template = "dynamic/manage/threshold/irc/networks.html"
|
||||
|
||||
|
||||
def post(self, request):
|
||||
stats = get_irc_networks()
|
||||
context = {"networks": stats}
|
||||
|
|
Loading…
Reference in New Issue