diff --git a/app/local_settings.example.py b/app/local_settings.example.py index 62b4f0d..7e69036 100644 --- a/app/local_settings.example.py +++ b/app/local_settings.example.py @@ -53,4 +53,4 @@ THRESHOLD_API_KEY = "name" THRESHOLD_API_TOKEN = "token" THRESHOLD_API_COUNTER = "counter" -DEBUG = True \ No newline at end of file +DEBUG = True diff --git a/app/urls.py b/app/urls.py index db449f7..b28d3a0 100644 --- a/app/urls.py +++ b/app/urls.py @@ -33,6 +33,8 @@ from core.views.dynamic.drilldown import DrilldownSearch, ThresholdInfoModal from core.views.dynamic.insights import ( InsightsChannels, InsightsInfoModal, + InsightsMeta, + InsightsNicks, InsightsSearch, ) @@ -54,13 +56,18 @@ urlpatterns = [ path("admin/", admin.site.urls), path("accounts/", include("django.contrib.auth.urls")), path("accounts/signup/", Signup.as_view(), name="signup"), + ## path("ui/drilldown/", Drilldown.as_view(), name="drilldown"), + path("ui/drilldown/modal/", ThresholdInfoModal.as_view(), name="modal_drilldown"), + path("ui/drilldown/search/", DrilldownSearch.as_view(), name="search_drilldown"), + ## path("ui/insights/", Insights.as_view(), name="insights"), - path("parts/search/drilldown/", DrilldownSearch.as_view(), name="search_drilldown"), - path("parts/search/insights/", InsightsSearch.as_view(), name="search_insights"), - path("parts/channels/insights/", InsightsChannels.as_view(), name="chans_insights"), - path("modal/drilldown/", ThresholdInfoModal.as_view(), name="modal_drilldown"), - path("modal/insights/", InsightsInfoModal.as_view(), name="modal_insights"), + path("ui/insights/search/", InsightsSearch.as_view(), name="search_insights"), + path("ui/insights/channels/", InsightsChannels.as_view(), name="chans_insights"), + path("ui/insights/nicks/", InsightsNicks.as_view(), name="nicks_insights"), + path("ui/insights/meta/", InsightsMeta.as_view(), name="meta_insights"), + path("ui/insights/modal/", InsightsInfoModal.as_view(), name="modal_insights"), + ## 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/nicktrace.py b/core/lib/nicktrace.py new file mode 100644 index 0000000..96f99eb --- /dev/null +++ b/core/lib/nicktrace.py @@ -0,0 +1,15 @@ +from core.lib.opensearch import client, run_main_query + + +def get_nicks(request, net, nick): + """ + Get all related nicknames of the given nickname by tracking nickname changes. + """ + # Get the initial query + query = {} + results = set() + # nicks = query["nicks"] + # for nick in nicks: + # if nick not in results: + # nicks_result = get_nicks(request, net_nick) + # results.add(nick) diff --git a/core/lib/opensearch.py b/core/lib/opensearch.py index 5829e7b..31331de 100644 --- a/core/lib/opensearch.py +++ b/core/lib/opensearch.py @@ -93,7 +93,7 @@ def filter_blacklisted(user, response): response["exemption"] = True -def run_main_query(client, user, query, size=None): +def run_main_query(client, user, query, custom_query=False, size=None): """ Low level helper to run an ES query. Accept a user to pass it to the filter, so we can @@ -101,7 +101,10 @@ def run_main_query(client, user, query, size=None): Accept fields and size, for the fields we want to match and the number of results to return. """ - search_query = construct_query(query, size) + if custom_query: + search_query = query + else: + search_query = construct_query(query, size) try: response = client.search( body=search_query, index=settings.OPENSEARCH_INDEX_MAIN @@ -131,7 +134,7 @@ def query_results(request, size=None): client, request.user, query, - size, + size=size, ) if not results: return False diff --git a/core/templates/ui/insights/channels.html b/core/templates/ui/insights/channels.html index 0bece44..1509ed5 100644 --- a/core/templates/ui/insights/channels.html +++ b/core/templates/ui/insights/channels.html @@ -1,12 +1,9 @@ - - -
+ Information +
+src | ++ {% if item.src == 'irc' %} + + + + IRC + {% elif item.src == 'dis' %} + + + + Discord + {% endif %} + | +
---|---|
nick | ++ {% if item.online is True %} + + + + {{ item.nick }} + {% elif item.online is False %} + + + + {{ item.nick }} + {% else %} + + + + {{ item.nick }} + {% endif %} + {% if item.num_chans is not None %} + + {{ item.num_chans }} + + {% endif %} + | +
host | +{{ item.host }} | +
actions | ++ {% if item.src == 'irc' %} + + {% endif %} + | +
net | +{{ item.net }} | +
+ Meta +
+ + + + ++ Nicks +
+ + + + +- Information -
-src | -- {% if item.src == 'irc' %} - - - - IRC - {% elif item.src == 'dis' %} - - - - Discord - {% endif %} - | -
---|---|
nick | -- {% if item.online is True %} - - - - {{ item.nick }} - {% elif item.online is False %} - - - - {{ item.nick }} - {% else %} - - - - {{ item.nick }} - {% endif %} - {% if item.num_chans is not None %} - - {{ item.num_chans }} - - {% endif %} - | -
host | -{{ item.host }} | -
actions | -- {% if item.src == 'irc' %} - - {% endif %} - | -
net | -{{ item.net }} | -