diff --git a/app/urls.py b/app/urls.py
index b28d3a0..0f04ee6 100644
--- a/app/urls.py
+++ b/app/urls.py
@@ -37,6 +37,13 @@ from core.views.dynamic.insights import (
InsightsNicks,
InsightsSearch,
)
+from core.views.dynamic.manage.threshold.irc import (
+ ThresholdIRCNetworks,
+ ThresholdIRCStats,
+)
+
+# Management stuff
+from core.views.manage.threshold import ThresholdIRCOverview
urlpatterns = [
path("", Home.as_view(), name="home"),
@@ -68,6 +75,22 @@ urlpatterns = [
path("ui/insights/meta/", InsightsMeta.as_view(), name="meta_insights"),
path("ui/insights/modal/", InsightsInfoModal.as_view(), name="modal_insights"),
##
+ path(
+ "manage/threshold/irc/overview/",
+ ThresholdIRCOverview.as_view(),
+ name="threshold_irc_overview",
+ ),
+ path(
+ "manage/threshold/irc/stats/",
+ ThresholdIRCStats.as_view(),
+ name="threshold_irc_stats",
+ ),
+ path(
+ "manage/threshold/irc/networks/",
+ ThresholdIRCNetworks.as_view(),
+ name="threshold_irc_networks",
+ ),
+ ##
path("api/chans/", ThresholdChans.as_view(), name="chans"),
path("api/users/", ThresholdUsers.as_view(), name="users"),
path("api/online/", ThresholdOnline.as_view(), name="online"),
diff --git a/core/lib/manage/threshold.py b/core/lib/manage/threshold.py
new file mode 100644
index 0000000..c27c0c3
--- /dev/null
+++ b/core/lib/manage/threshold.py
@@ -0,0 +1,18 @@
+from core.lib.threshold import threshold_request
+
+def get_irc_stats():
+ url = "irc/stats"
+ payload = {}
+ stats = threshold_request(url, payload)
+ if not stats:
+ return {}
+ print("tsats", stats)
+ return stats
+
+def get_irc_networks():
+ url = "irc/networks"
+ payload = {}
+ networks = threshold_request(url, payload)
+ if not networks:
+ return {}
+ return networks
\ No newline at end of file
diff --git a/core/templates/base.html b/core/templates/base.html
index 0f413fd..30c7d2e 100644
--- a/core/templates/base.html
+++ b/core/templates/base.html
@@ -123,7 +123,7 @@
-
+
Overview
diff --git a/core/templates/dynamic/manage/threshold/irc/networks.html b/core/templates/dynamic/manage/threshold/irc/networks.html
new file mode 100644
index 0000000..19971a5
--- /dev/null
+++ b/core/templates/dynamic/manage/threshold/irc/networks.html
@@ -0,0 +1,35 @@
+
+
+
+
+ name |
+ relays |
+ channels |
+ records |
+
+ {% for key, net in networks.items %}
+
+ {{ key }} |
+
+
+
+
+ {{ net.relays }}
+ |
+
+
+
+
+ {{ net.channels }}
+ |
+
+
+
+
+ {{ net.records }}
+ |
+
+ {% endfor %}
+
+
+
\ No newline at end of file
diff --git a/core/templates/dynamic/manage/threshold/irc/stats.html b/core/templates/dynamic/manage/threshold/irc/stats.html
new file mode 100644
index 0000000..b03bde3
--- /dev/null
+++ b/core/templates/dynamic/manage/threshold/irc/stats.html
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+ X |
+ total |
+ unique |
+
+
+
+
+ total |
+
+ {{ stats.servers_total_total }}
+ |
+
+ {{ stats.servers_total_unique }}
+ |
+
+
+ online |
+
+ {{ stats.servers_online_total }}
+ |
+
+ {{ stats.servers_online_unique }}
+ |
+
+
+
+ channels |
+
+ {{ stats.channels}}
+ |
+
+
+
+ records |
+
+ {{ stats.records }}
+ |
+
+
+ events |
+
+ {{ stats.eventrate }}
+ |
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/core/templates/manage/overview.html b/core/templates/manage/overview.html
deleted file mode 100644
index 4743616..0000000
--- a/core/templates/manage/overview.html
+++ /dev/null
@@ -1,9 +0,0 @@
-{% extends "base.html" %}
-{% block content %}
-
-
-
hello
- {{ perms.app }}
-
-
-{% endblock %}
diff --git a/core/templates/manage/threshold/irc/overview.html b/core/templates/manage/threshold/irc/overview.html
new file mode 100644
index 0000000..0be48e3
--- /dev/null
+++ b/core/templates/manage/threshold/irc/overview.html
@@ -0,0 +1,51 @@
+{% extends "base.html" %}
+{% block content %}
+
+
+
+
+
+
+
+
+
+
+{% endblock %}
diff --git a/core/views/dynamic/manage/threshold/irc.py b/core/views/dynamic/manage/threshold/irc.py
new file mode 100644
index 0000000..fed2fc9
--- /dev/null
+++ b/core/views/dynamic/manage/threshold/irc.py
@@ -0,0 +1,23 @@
+from django.views import View
+from django.shortcuts import render
+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}
+ return render(request, self.stats_template, context)
+
+
+class ThresholdIRCNetworks(SuperUserRequiredMixin, View):
+ stats_template = "dynamic/manage/threshold/irc/networks.html"
+
+
+ def post(self, request):
+ stats = get_irc_networks()
+ context = {"networks": stats}
+ return render(request, self.stats_template, context)
\ No newline at end of file
diff --git a/core/views/manage/permissions.py b/core/views/manage/permissions.py
index d07e288..0f6fb33 100644
--- a/core/views/manage/permissions.py
+++ b/core/views/manage/permissions.py
@@ -1,6 +1,6 @@
from django.contrib.auth.mixins import LoginRequiredMixin, UserPassesTestMixin
-class SuperUserRequiredMixin(LoginRequiredMixin, UserPassesTestMixin):
+class SuperUserRequiredMixin(LoginRequiredMixin, UserPassesTestMixin):
def test_func(self):
- return self.request.user.is_superuser
\ No newline at end of file
+ return self.request.user.is_superuser
diff --git a/core/views/manage/threshold.py b/core/views/manage/threshold.py
index e69de29..b11eb3b 100644
--- a/core/views/manage/threshold.py
+++ b/core/views/manage/threshold.py
@@ -0,0 +1,11 @@
+from django.shortcuts import render
+from django.views import View
+
+from core.views.manage.permissions import SuperUserRequiredMixin
+
+
+class ThresholdIRCOverview(SuperUserRequiredMixin, View):
+ template_name = "manage/threshold/irc/overview.html"
+
+ def get(self, request):
+ return render(request, self.template_name)