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.
This commit is contained in:
Lauryn Menard 2024-09-23 21:39:34 +02:00 committed by Tim Abbott
parent 55d7ec843e
commit a89deb5e5c
3 changed files with 12 additions and 12 deletions

View File

@ -132,7 +132,7 @@ def realm_activity_link(realm_str: str) -> Markup:
from corporate.views.realm_activity import get_realm_activity from corporate.views.realm_activity import get_realm_activity
url = reverse(get_realm_activity, kwargs=dict(realm_str=realm_str)) url = reverse(get_realm_activity, kwargs=dict(realm_str=realm_str))
return Markup('<a href="{url}">{realm_str}</a>').format(url=url, realm_str=realm_str) return Markup('<a href="{url}"><i class="fa fa-table"></i></a>').format(url=url)
def realm_stats_link(realm_str: str) -> Markup: def realm_stats_link(realm_str: str) -> Markup:
@ -153,7 +153,7 @@ def realm_support_link(realm_str: str) -> Markup:
support_url = reverse("support") support_url = reverse("support")
query = urlencode({"q": realm_str}) query = urlencode({"q": realm_str})
url = append_url_query_string(support_url, query) url = append_url_query_string(support_url, query)
return Markup('<a href="{url}"><i class="fa fa-gear"></i></a>').format(url=url) return Markup('<a href="{url}">{realm}</i></a>').format(url=url, realm=realm_str)
def realm_url_link(realm_str: str) -> Markup: def realm_url_link(realm_str: str) -> Markup:

View File

@ -371,17 +371,17 @@ def get_integrations_activity(request: HttpRequest) -> HttpResponse:
""" """
) )
cols = [ cols = ["Client", "Realm", "Hits", "Last time (UTC)", "Links"]
"Client",
"Realm",
"Hits",
"Last time (UTC)",
]
rows = get_query_data(query) 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): for i, col in enumerate(cols):
if col == "Realm": if col == "Realm":
fix_rows(rows, i, realm_activity_link) fix_rows(rows, i, realm_support_link)
elif col == "Last time (UTC)": elif col == "Last time (UTC)":
fix_rows(rows, i, format_optional_datetime) fix_rows(rows, i, format_optional_datetime)

View File

@ -71,11 +71,11 @@
<td> <td>
{{ row.realm_url }} {{ row.realm_url }}
{{ row.stats_link }} {{ row.stats_link }}
{{ row.support_link }} {{ row.activity_link }}
</td> </td>
{% endif %} {% endif %}
<td> <td>
{{ row.activity_link }} {{ row.support_link }}
</td> </td>
<td {% if row.is_new %} <td {% if row.is_new %}