mirror of https://github.com/zulip/zulip.git
analytics: Move integrations by client to separate activity page.
Moves the tab in the main installation activity page to be a separate page: "/activity/integrations".
This commit is contained in:
parent
0f009c439d
commit
40e6455579
|
@ -31,7 +31,7 @@ class ActivityTest(ZulipTestCase):
|
|||
user_profile.is_staff = True
|
||||
user_profile.save(update_fields=["is_staff"])
|
||||
|
||||
with self.assert_database_query_count(17):
|
||||
with self.assert_database_query_count(16):
|
||||
result = self.client_get("/activity")
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
|
@ -39,6 +39,10 @@ class ActivityTest(ZulipTestCase):
|
|||
result = self.client_get("/activity/remote")
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
with self.assert_database_query_count(4):
|
||||
result = self.client_get("/activity/integrations")
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
||||
with self.assert_database_query_count(8):
|
||||
result = self.client_get("/realm_activity/zulip/")
|
||||
self.assertEqual(result.status_code, 200)
|
||||
|
|
|
@ -4,7 +4,10 @@ from django.conf.urls import include
|
|||
from django.urls import path
|
||||
from django.urls.resolvers import URLPattern, URLResolver
|
||||
|
||||
from analytics.views.installation_activity import get_installation_activity
|
||||
from analytics.views.installation_activity import (
|
||||
get_installation_activity,
|
||||
get_integrations_activity,
|
||||
)
|
||||
from analytics.views.realm_activity import get_realm_activity
|
||||
from analytics.views.remote_activity import get_remote_server_activity
|
||||
from analytics.views.stats import (
|
||||
|
@ -27,6 +30,7 @@ i18n_urlpatterns: List[Union[URLPattern, URLResolver]] = [
|
|||
# Server admin (user_profile.is_staff) visible stats pages
|
||||
path("activity", get_installation_activity),
|
||||
path("activity/remote", get_remote_server_activity),
|
||||
path("activity/integrations", get_integrations_activity),
|
||||
path("activity/support", support, name="support"),
|
||||
path("activity/remote/support", remote_servers_support, name="remote_servers_support"),
|
||||
path("realm_activity/<realm_str>/", get_realm_activity),
|
||||
|
|
|
@ -463,8 +463,31 @@ def ad_hoc_queries() -> List[Dict[str, str]]:
|
|||
|
||||
pages.append(get_page(query, cols, title))
|
||||
|
||||
###
|
||||
return pages
|
||||
|
||||
|
||||
@require_server_admin
|
||||
@has_request_variables
|
||||
def get_installation_activity(request: HttpRequest) -> HttpResponse:
|
||||
duration_content, realm_minutes = user_activity_intervals()
|
||||
counts_content: str = realm_summary_table(realm_minutes)
|
||||
data = [
|
||||
("Counts", counts_content),
|
||||
("Durations", duration_content),
|
||||
*((page["title"], page["content"]) for page in ad_hoc_queries()),
|
||||
]
|
||||
|
||||
title = "Activity"
|
||||
|
||||
return render(
|
||||
request,
|
||||
"analytics/activity.html",
|
||||
context=dict(data=data, title=title, is_home=True),
|
||||
)
|
||||
|
||||
|
||||
@require_server_admin
|
||||
def get_integrations_activity(request: HttpRequest) -> HttpResponse:
|
||||
title = "Integrations by client"
|
||||
|
||||
query = SQL(
|
||||
|
@ -501,26 +524,14 @@ def ad_hoc_queries() -> List[Dict[str, str]]:
|
|||
"Last time",
|
||||
]
|
||||
|
||||
pages.append(get_page(query, cols, title))
|
||||
|
||||
return pages
|
||||
|
||||
|
||||
@require_server_admin
|
||||
@has_request_variables
|
||||
def get_installation_activity(request: HttpRequest) -> HttpResponse:
|
||||
duration_content, realm_minutes = user_activity_intervals()
|
||||
counts_content: str = realm_summary_table(realm_minutes)
|
||||
data = [
|
||||
("Counts", counts_content),
|
||||
("Durations", duration_content),
|
||||
*((page["title"], page["content"]) for page in ad_hoc_queries()),
|
||||
]
|
||||
|
||||
title = "Activity"
|
||||
integrations_activity = get_page(query, cols, title)
|
||||
|
||||
return render(
|
||||
request,
|
||||
"analytics/activity.html",
|
||||
context=dict(data=data, title=title, is_home=True),
|
||||
"analytics/activity_details_template.html",
|
||||
context=dict(
|
||||
data=integrations_activity["content"],
|
||||
title=integrations_activity["title"],
|
||||
is_home=False,
|
||||
),
|
||||
)
|
||||
|
|
|
@ -6,6 +6,7 @@
|
|||
<ul>
|
||||
<li><a href="/stats/installation">Server total /stats style graphs</a></li>
|
||||
<li><a href="/activity/remote">Remote servers</a></li>
|
||||
<li><a href="/activity/integrations">Integrations by client</a></li>
|
||||
</ul>
|
||||
|
||||
<h4>Counts chart key:</h4>
|
||||
|
|
Loading…
Reference in New Issue