mirror of https://github.com/zulip/zulip.git
support: Add remote realm stub to remote server information.
Adds a small section for any remote realms attached to the remote server in the support view.
This commit is contained in:
parent
cfd61669e0
commit
ba3279e959
|
@ -49,7 +49,7 @@ from zerver.views.invite import get_invitee_emails_set
|
|||
|
||||
if settings.ZILENCER_ENABLED:
|
||||
from zilencer.lib.remote_counts import MissingDataError, compute_max_monthly_messages
|
||||
from zilencer.models import RemoteZulipServer
|
||||
from zilencer.models import RemoteRealm, RemoteZulipServer
|
||||
|
||||
if settings.BILLING_ENABLED:
|
||||
from corporate.lib.stripe import (
|
||||
|
@ -375,7 +375,9 @@ def get_remote_servers_for_support(
|
|||
if not email_to_search and not hostname_to_search:
|
||||
return []
|
||||
|
||||
remote_servers_query = RemoteZulipServer.objects.order_by("id")
|
||||
remote_servers_query = RemoteZulipServer.objects.order_by("id").prefetch_related(
|
||||
"remoterealm_set"
|
||||
)
|
||||
if email_to_search:
|
||||
remote_servers_query = remote_servers_query.filter(contact_email__iexact=email_to_search)
|
||||
elif hostname_to_search:
|
||||
|
@ -464,7 +466,10 @@ def remote_servers_support(
|
|||
)
|
||||
remote_server_to_max_monthly_messages: Dict[int, Union[int, str]] = dict()
|
||||
plan_data: Dict[int, PlanData] = {}
|
||||
remote_realms: Dict[int, List[RemoteRealm]] = {}
|
||||
for remote_server in remote_servers:
|
||||
remote_realms_for_server = list(remote_server.remoterealm_set.all())
|
||||
remote_realms[remote_server.id] = remote_realms_for_server
|
||||
billing_session = RemoteServerBillingSession(remote_server=remote_server)
|
||||
remote_server_plan_data = get_current_plan_data_for_support_view(billing_session)
|
||||
plan_data[remote_server.id] = remote_server_plan_data
|
||||
|
@ -476,10 +481,12 @@ def remote_servers_support(
|
|||
remote_server_to_max_monthly_messages[remote_server.id] = "Recent data missing"
|
||||
|
||||
context["remote_servers"] = remote_servers
|
||||
context["remote_realms"] = remote_realms
|
||||
context["remote_server_to_max_monthly_messages"] = remote_server_to_max_monthly_messages
|
||||
context["plan_data"] = plan_data
|
||||
context["get_discount"] = get_customer_discount_for_support_view
|
||||
context["get_plan_type_name"] = get_plan_type_string
|
||||
context["get_org_type_display_name"] = get_org_type_display_name
|
||||
|
||||
return render(
|
||||
request,
|
||||
|
|
|
@ -0,0 +1,7 @@
|
|||
<div class="remote-realm-information">
|
||||
<span class="label">remote realm</span>
|
||||
<h3>{{ remote_realm.name }}</h3>
|
||||
<b>Remote server hostname:</b> {{ remote_realm.host }}<br />
|
||||
<b>Date created</b>: {{ remote_realm.realm_date_created.strftime('%d %B %Y') }}<br />
|
||||
<b>Org type</b>: {{ get_org_type_display_name(remote_realm.org_type) }}<br />
|
||||
</div>
|
|
@ -46,6 +46,7 @@
|
|||
<b>Last updated</b>: {{ remote_server.last_updated|timesince }} ago<br />
|
||||
<b>Max monthly messages</b>: {{ remote_server_to_max_monthly_messages[remote_server.id] }}<br />
|
||||
<b>Plan type</b>: {{ get_plan_type_name(remote_server.plan_type) }}<br />
|
||||
<b>Has remote realm(s)</b>: {{ remote_realms[remote_server.id] != [] }}
|
||||
{% if remote_server.plan_type == 100 %}
|
||||
<h4>On 100% sponsored Zulip Community plan.</h4>
|
||||
{% endif %}
|
||||
|
@ -133,6 +134,13 @@
|
|||
<button type="submit" class="btn btn-default support-submit-button">Modify</button>
|
||||
</form>
|
||||
{% endif %}
|
||||
|
||||
{% for remote_realm in remote_realms[remote_server.id] %}
|
||||
<hr />
|
||||
<div>
|
||||
{% include "analytics/remote_realm_details.html" %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
|
|
@ -152,7 +152,8 @@ tr.admin td:first-child {
|
|||
}
|
||||
}
|
||||
|
||||
.remote-server-information {
|
||||
.remote-server-information,
|
||||
.remote-realm-information {
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue