From 45891cb0fbd13cb8965a6e34d9f47bcfa679d381 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Mon, 25 Jul 2022 18:03:10 +0100 Subject: [PATCH] Finish Threshold stats and implement network listing --- app/urls.py | 23 ++++++++ core/lib/manage/threshold.py | 18 ++++++ core/templates/base.html | 2 +- .../manage/threshold/irc/networks.html | 35 ++++++++++++ .../dynamic/manage/threshold/irc/stats.html | 57 +++++++++++++++++++ core/templates/manage/overview.html | 9 --- .../manage/threshold/irc/overview.html | 51 +++++++++++++++++ core/views/dynamic/manage/threshold/irc.py | 23 ++++++++ core/views/manage/permissions.py | 4 +- core/views/manage/threshold.py | 11 ++++ 10 files changed, 221 insertions(+), 12 deletions(-) create mode 100644 core/lib/manage/threshold.py create mode 100644 core/templates/dynamic/manage/threshold/irc/networks.html create mode 100644 core/templates/dynamic/manage/threshold/irc/stats.html delete mode 100644 core/templates/manage/overview.html create mode 100644 core/templates/manage/threshold/irc/overview.html create mode 100644 core/views/dynamic/manage/threshold/irc.py 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 @@