activity: Move links columns to be first in chart.

Moves links in installation and remote server activity charts
to be the first column.
This commit is contained in:
Lauryn Menard 2024-01-31 21:59:03 +01:00 committed by Tim Abbott
parent 0e6f013e03
commit ff8552269d
2 changed files with 21 additions and 21 deletions

View File

@ -79,6 +79,7 @@ def get_remote_server_activity(request: HttpRequest) -> HttpResponse:
)
cols = [
"Links",
"IDs",
"Realm name",
"Realm host or server hostname",
@ -94,20 +95,19 @@ def get_remote_server_activity(request: HttpRequest) -> HttpResponse:
"Rate",
"Total users",
"Guest users",
"Links",
]
# If the query or column order above changes, update the constants below
SERVER_AND_REALM_IDS = 0
SERVER_HOST = 2
REALM_HOST = 3
LAST_AUDIT_LOG_DATE = 5
MOBILE_USER_COUNT = 6
MOBILE_PUSH_COUNT = 7
ORG_TYPE = 8
ARR = 11
TOTAL_USER_COUNT = 13
GUEST_COUNT = 14
LAST_AUDIT_LOG_DATE = 6
MOBILE_USER_COUNT = 7
MOBILE_PUSH_COUNT = 8
ORG_TYPE = 9
ARR = 12
TOTAL_USER_COUNT = 14
GUEST_COUNT = 15
rows = get_query_data(query)
plan_data_by_remote_server = get_plan_data_by_remote_server()
@ -140,6 +140,12 @@ def get_remote_server_activity(request: HttpRequest) -> HttpResponse:
row.pop(REALM_HOST)
server_host = row[SERVER_HOST]
# Add server links
stats = remote_installation_stats_link(server_id)
support = remote_installation_support_link(server_host)
links = stats + " " + support
row.insert(0, links)
# Count mobile users and pushes forwarded, once per server
if server_id not in remote_server_mobile_data_counted:
if row[MOBILE_USER_COUNT] is not None:
@ -190,12 +196,6 @@ def get_remote_server_activity(request: HttpRequest) -> HttpResponse:
row.append(total_users)
row.append(user_counts.guest_user_count)
# Add server links
stats = remote_installation_stats_link(server_id)
support = remote_installation_support_link(server_host)
links = stats + " " + support
row.append(links)
# Format column data and add total row
for i, col in enumerate(cols):
if i == LAST_AUDIT_LOG_DATE:

View File

@ -33,6 +33,7 @@
<thead class="activity-head">
<tr>
<th>Links</th>
<th>Realm</th>
<th>Created (green if ≤12wk)</th>
{% if billing_enabled %}
@ -41,7 +42,6 @@
<th>ARR</th>
<th>Rate (%)</th>
{% endif %}
<th>Links</th>
<th>DAU</th>
<th>WAU</th>
<th>Total users</th>
@ -55,6 +55,12 @@
{% for row in rows %}
<tr>
<td>
{{ row.realm_url }}
{{ row.stats_link }}
{{ row.support_link }}
</td>
<td>
{{ row.string_id }}
</td>
@ -89,12 +95,6 @@
</td>
{% endif %}
<td>
{{ row.realm_url }}
{{ row.stats_link }}
{{ row.support_link }}
</td>
<td class="number">
{{ row.dau_count }}
</td>