From a89deb5e5c7374d7e3816f568e49aea535f066b0 Mon Sep 17 00:00:00 2001 From: Lauryn Menard Date: Mon, 23 Sep 2024 21:39:34 +0200 Subject: [PATCH] activity: Use icon for activity links and realm name for support view. In the installation and integrations activity views, updates the links to a realm's activity view to use the 'fa fa-table' icon, instead of the realm name. Now, the realm name links instead to the realm's support page. Also, the integrations activity page now includes a link to a realm's stats view. --- corporate/lib/activity.py | 4 ++-- corporate/views/installation_activity.py | 16 ++++++++-------- .../activity/installation_activity_table.html | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/corporate/lib/activity.py b/corporate/lib/activity.py index b84c508779..ef849eccda 100644 --- a/corporate/lib/activity.py +++ b/corporate/lib/activity.py @@ -132,7 +132,7 @@ def realm_activity_link(realm_str: str) -> Markup: from corporate.views.realm_activity import get_realm_activity url = reverse(get_realm_activity, kwargs=dict(realm_str=realm_str)) - return Markup('{realm_str}').format(url=url, realm_str=realm_str) + return Markup('').format(url=url) def realm_stats_link(realm_str: str) -> Markup: @@ -153,7 +153,7 @@ def realm_support_link(realm_str: str) -> Markup: support_url = reverse("support") query = urlencode({"q": realm_str}) url = append_url_query_string(support_url, query) - return Markup('').format(url=url) + return Markup('{realm}').format(url=url, realm=realm_str) def realm_url_link(realm_str: str) -> Markup: diff --git a/corporate/views/installation_activity.py b/corporate/views/installation_activity.py index 72a6a27c93..5c487ac5b7 100644 --- a/corporate/views/installation_activity.py +++ b/corporate/views/installation_activity.py @@ -371,17 +371,17 @@ def get_integrations_activity(request: HttpRequest) -> HttpResponse: """ ) - cols = [ - "Client", - "Realm", - "Hits", - "Last time (UTC)", - ] - + cols = ["Client", "Realm", "Hits", "Last time (UTC)", "Links"] rows = get_query_data(query) + for row in rows: + realm_str = row[1] + activity = realm_activity_link(realm_str) + stats = realm_stats_link(realm_str) + row.append(activity + " " + stats) + for i, col in enumerate(cols): if col == "Realm": - fix_rows(rows, i, realm_activity_link) + fix_rows(rows, i, realm_support_link) elif col == "Last time (UTC)": fix_rows(rows, i, format_optional_datetime) diff --git a/templates/corporate/activity/installation_activity_table.html b/templates/corporate/activity/installation_activity_table.html index 7f5bad81e1..fcfe4569ab 100644 --- a/templates/corporate/activity/installation_activity_table.html +++ b/templates/corporate/activity/installation_activity_table.html @@ -71,11 +71,11 @@ {{ row.realm_url }} {{ row.stats_link }} - {{ row.support_link }} + {{ row.activity_link }} {% endif %} - {{ row.activity_link }} + {{ row.support_link }}