mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
Add summary view to the /activity report.
When you load the activity report, it will just show summary counts for realms, but if you click on a realm, you will see details about users in the realms. You can also click "Show all" to see an interleaved view of realms and users. (imported from commit b106557b1fae64d525071afc124b5a8aed319086)
This commit is contained in:
45
static/js/activity_page.js
Normal file
45
static/js/activity_page.js
Normal file
@@ -0,0 +1,45 @@
|
|||||||
|
$(function () {
|
||||||
|
function show_realms_only() {
|
||||||
|
$(".table").each(function () {
|
||||||
|
var table = $(this);
|
||||||
|
|
||||||
|
table.find('tbody tr[data-type="user"]').hide();
|
||||||
|
table.find('tbody tr[data-type="realm"]').show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function filter_to_realm(realm) {
|
||||||
|
$(".table").each(function () {
|
||||||
|
var table = $(this);
|
||||||
|
|
||||||
|
table.find("tbody tr").hide();
|
||||||
|
var rows = table.find('tbody tr[data-realm="'+realm+'"]');
|
||||||
|
rows.show();
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_up_realm_links() {
|
||||||
|
$("a.realm").on("click", function () {
|
||||||
|
var realm = $(this).attr("data-realm");
|
||||||
|
filter_to_realm(realm);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_up_summary_link() {
|
||||||
|
$("a.show-summary").on("click", function () {
|
||||||
|
show_realms_only();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
function set_up_show_all_link() {
|
||||||
|
$("a.show-all").on("click", function () {
|
||||||
|
$(".table tbody tr").show();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
show_realms_only();
|
||||||
|
set_up_realm_links();
|
||||||
|
set_up_summary_link();
|
||||||
|
set_up_show_all_link();
|
||||||
|
});
|
||||||
@@ -21,6 +21,10 @@
|
|||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
|
|
||||||
|
<a class="show-all">Show all</a>
|
||||||
|
|
||||||
|
<a class="show-summary">Show summary</a>
|
||||||
|
|
||||||
<div class="tab-content">
|
<div class="tab-content">
|
||||||
|
|
||||||
{% for name, activity in data.iteritems %}
|
{% for name, activity in data.iteritems %}
|
||||||
@@ -44,10 +48,14 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody>
|
<tbody>
|
||||||
{% for email, row in activity.sorted_rows %}
|
{% for email, row in activity.sorted_rows %}
|
||||||
<tr class="{{ row.class }}">
|
<tr class="{{ row.class }}" data-type="{{ row.type }}" data-realm="{{ row.realm }}">
|
||||||
<td><strong>{{ row.full_name }}</strong></td>
|
<td><strong>{{ row.full_name }}</strong></td>
|
||||||
<td><strong>{{ row.email }}</strong></td>
|
<td><strong>{{ row.email }}</strong></td>
|
||||||
<td><strong>{{ row.realm }}</strong></td>
|
<td>
|
||||||
|
<a class="realm" data-realm="{{ row.realm }}">
|
||||||
|
<strong>{{ row.realm }}</strong>
|
||||||
|
<a>
|
||||||
|
</td>
|
||||||
<td sorttable_customkey="{{ row.send_message_last|date:'YmdHi' }}">{{ row.send_message_last|date:"M d, H:i" }}</td>
|
<td sorttable_customkey="{{ row.send_message_last|date:'YmdHi' }}">{{ row.send_message_last|date:"M d, H:i" }}</td>
|
||||||
<td class="number">{{ row.send_message_count }}</td>
|
<td class="number">{{ row.send_message_count }}</td>
|
||||||
{% if activity.has_pointer %}
|
{% if activity.has_pointer %}
|
||||||
|
|||||||
@@ -1786,7 +1786,8 @@ class ActivityTable(object):
|
|||||||
row = self.rows.setdefault(email,
|
row = self.rows.setdefault(email,
|
||||||
{'realm': domain,
|
{'realm': domain,
|
||||||
'full_name': full_name,
|
'full_name': full_name,
|
||||||
'email': email})
|
'email': email,
|
||||||
|
'type': 'user'})
|
||||||
row[count_field] = count
|
row[count_field] = count
|
||||||
row[last_visit_field] = last_visit
|
row[last_visit_field] = last_visit
|
||||||
|
|
||||||
@@ -1795,7 +1796,8 @@ class ActivityTable(object):
|
|||||||
row = self.rows.setdefault(domain,
|
row = self.rows.setdefault(domain,
|
||||||
{'realm': domain,
|
{'realm': domain,
|
||||||
'full_name': full_name,
|
'full_name': full_name,
|
||||||
'email': ''})
|
'email': '',
|
||||||
|
'type': 'realm'})
|
||||||
row.setdefault(count_field, 0)
|
row.setdefault(count_field, 0)
|
||||||
row[count_field] += count
|
row[count_field] += count
|
||||||
|
|
||||||
|
|||||||
@@ -420,6 +420,7 @@ JS_SPECS = {
|
|||||||
'activity': {
|
'activity': {
|
||||||
'source_filenames': (
|
'source_filenames': (
|
||||||
'third/sorttable/sorttable.js',
|
'third/sorttable/sorttable.js',
|
||||||
|
'js/activity_page.js',
|
||||||
),
|
),
|
||||||
'output_filename': 'min/activity.js'
|
'output_filename': 'min/activity.js'
|
||||||
},
|
},
|
||||||
|
|||||||
Reference in New Issue
Block a user