mirror of https://github.com/zulip/zulip.git
analytics-activity: Add links for realm's Zulip and support page.
This commit is contained in:
parent
90d0531e20
commit
c75e5c8ba6
|
@ -3,6 +3,7 @@ import sys
|
|||
from datetime import datetime
|
||||
from html import escape
|
||||
from typing import Any, Collection, Dict, List, Optional, Sequence
|
||||
from urllib.parse import urlencode
|
||||
|
||||
from django.conf import settings
|
||||
from django.db.backends.utils import CursorWrapper
|
||||
|
@ -10,7 +11,8 @@ from django.template import loader
|
|||
from django.urls import reverse
|
||||
from markupsafe import Markup
|
||||
|
||||
from zerver.models import UserActivity
|
||||
from zerver.lib.url_encoding import append_url_query_string
|
||||
from zerver.models import UserActivity, get_realm
|
||||
|
||||
if sys.version_info < (3, 9): # nocoverage
|
||||
from backports import zoneinfo
|
||||
|
@ -78,10 +80,24 @@ def realm_stats_link(realm_str: str) -> Markup:
|
|||
from analytics.views.stats import stats_for_realm
|
||||
|
||||
url = reverse(stats_for_realm, kwargs=dict(realm_str=realm_str))
|
||||
stats_link = f'<a href="{escape(url)}"><i class="fa fa-pie-chart"></i>{escape(realm_str)}</a>'
|
||||
stats_link = f'<a href="{escape(url)}"><i class="fa fa-pie-chart"></i></a>'
|
||||
return Markup(stats_link)
|
||||
|
||||
|
||||
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)
|
||||
support_link = f'<a href="{escape(url)}">{escape(realm_str)}</a>'
|
||||
return Markup(support_link)
|
||||
|
||||
|
||||
def realm_url_link(realm_str: str) -> Markup:
|
||||
url = get_realm(realm_str).uri
|
||||
realm_link = f'<a href="{escape(url)}"><i class="fa fa-home"></i></a>'
|
||||
return Markup(realm_link)
|
||||
|
||||
|
||||
def remote_installation_stats_link(server_id: int, hostname: str) -> Markup:
|
||||
from analytics.views.stats import stats_for_remote_installation
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ from analytics.views.activity_common import (
|
|||
make_table,
|
||||
realm_activity_link,
|
||||
realm_stats_link,
|
||||
realm_support_link,
|
||||
realm_url_link,
|
||||
remote_installation_stats_link,
|
||||
)
|
||||
from analytics.views.support import get_plan_name
|
||||
|
@ -246,7 +248,9 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
|
|||
|
||||
# formatting
|
||||
for row in rows:
|
||||
row["realm_url"] = realm_url_link(row["string_id"])
|
||||
row["stats_link"] = realm_stats_link(row["string_id"])
|
||||
row["support_link"] = realm_support_link(row["string_id"])
|
||||
row["string_id"] = realm_activity_link(row["string_id"])
|
||||
|
||||
# Count active sites
|
||||
|
@ -272,7 +276,9 @@ def realm_summary_table(realm_minutes: Dict[str, float]) -> str:
|
|||
org_type_string="",
|
||||
effective_rate="",
|
||||
arr=total_arr,
|
||||
realm_url="",
|
||||
stats_link="",
|
||||
support_link="",
|
||||
date_created_day="",
|
||||
dau_count=total_dau_count,
|
||||
user_profile_count=total_user_profile_count,
|
||||
|
|
|
@ -9,6 +9,13 @@
|
|||
<li><strong>active (user)</strong> - sent a message, or advanced the pointer (reading messages doesn't count unless advances the pointer)</li>
|
||||
<li><strong>ARR</strong> (Annual recurring revenue) - the number of users they are paying for * annual price/user.</li>
|
||||
<li><strong>Rate</strong> - % of full price the customer pays, or will pay, if on a paid plan.</li>
|
||||
<li><strong>Links</strong>
|
||||
<ul>
|
||||
<li><strong><i class="fa fa-home"></i></strong> - realm's Zulip</li>
|
||||
<li><strong><i class="fa fa-pie-chart"></i></strong> - realm's stats page</li>
|
||||
<li><strong>realm</strong> - realm's support page</li>
|
||||
</ul>
|
||||
</li>
|
||||
<li><strong>DAU</strong> (daily active users) - users active in last 24hr</li>
|
||||
<li><strong>WAU</strong> (weekly active users) - users active in last 7 * 24hr</li>
|
||||
<li><strong>DAT</strong> (daily active time) - total user-activity time in last 24hr</li>
|
||||
|
@ -28,7 +35,7 @@
|
|||
<th>ARR</th>
|
||||
<th>Rate (%)</th>
|
||||
{% endif %}
|
||||
<th></th>
|
||||
<th>Links</th>
|
||||
<th>DAU</th>
|
||||
<th>WAU</th>
|
||||
<th>Total users</th>
|
||||
|
@ -79,7 +86,9 @@
|
|||
{% endif %}
|
||||
|
||||
<td>
|
||||
{{ row.realm_url }}
|
||||
{{ row.stats_link }}
|
||||
{{ row.support_link }}
|
||||
</td>
|
||||
|
||||
<td class="number">
|
||||
|
|
Loading…
Reference in New Issue