summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2013-04-21 20:29:17 -0500
committerDan McGee <dan@archlinux.org>2013-04-21 20:29:17 -0500
commit66412aa1037befef0b579c7df73656dc3b8b9804 (patch)
treed47fd7081159a54acb870a6eecc7b605022d5121
parentecf57207c0a5f90d51b6be551158ce7a0f82c9cb (diff)
Move stats portion of developer dashboard to separate view
This stuff is all below the fold when the page first loads, and adds a good amount of loading time to the developer dashboard. Split it out, where it will be wired back and hooked up via an AJAX insertion in a future commit. Both parts work standalone as is in this commit. Signed-off-by: Dan McGee <dan@archlinux.org>
-rw-r--r--devel/urls.py1
-rw-r--r--devel/views.py21
-rw-r--r--templates/devel/index.html128
-rw-r--r--templates/devel/stats.html120
4 files changed, 142 insertions, 128 deletions
diff --git a/devel/urls.py b/devel/urls.py
index 31afc86b..472c6456 100644
--- a/devel/urls.py
+++ b/devel/urls.py
@@ -5,6 +5,7 @@ urlpatterns = patterns('devel.views',
(r'^admin_log/(?P<username>.*)/$','admin_log'),
(r'^clock/$', 'clock', {}, 'devel-clocks'),
(r'^$', 'index', {}, 'devel-index'),
+ (r'^stats/$', 'stats', {}, 'devel-stats'),
(r'^newuser/$', 'new_user_form'),
(r'^profile/$', 'change_profile'),
(r'^reports/(?P<report_name>.*)/(?P<username>.*)/$', 'report'),
diff --git a/devel/views.py b/devel/views.py
index 4258ea7f..378d6d57 100644
--- a/devel/views.py
+++ b/devel/views.py
@@ -33,7 +33,7 @@ from .utils import get_annotated_maintainers
@login_required
def index(request):
- '''the developer dashboard'''
+ """The developer dashboard."""
if request.user.is_authenticated():
inner_q = PackageRelation.objects.filter(user=request.user)
else:
@@ -54,6 +54,19 @@ def index(request):
signoffs = sorted(get_signoff_groups(user=request.user),
key=operator.attrgetter('pkgbase'))
+ page_dict = {
+ 'todos': todolists,
+ 'flagged': flagged,
+ 'todopkgs': todopkgs,
+ 'signoffs': signoffs
+ }
+
+ return render(request, 'devel/index.html', page_dict)
+
+
+@login_required
+def stats(request):
+ """The second half of the dev dashboard."""
arches = Arch.objects.all().annotate(
total_ct=Count('packages'), flagged_ct=Count('packages__flag_date'))
repos = Repo.objects.all().annotate(
@@ -80,17 +93,13 @@ def index(request):
}
page_dict = {
- 'todos': todolists,
'arches': arches,
'repos': repos,
'maintainers': maintainers,
'orphan': orphan,
- 'flagged': flagged,
- 'todopkgs': todopkgs,
- 'signoffs': signoffs
}
- return render(request, 'devel/index.html', page_dict)
+ return render(request, 'devel/stats.html', page_dict)
@login_required
diff --git a/templates/devel/index.html b/templates/devel/index.html
index c067b69b..232a9034 100644
--- a/templates/devel/index.html
+++ b/templates/devel/index.html
@@ -161,7 +161,8 @@
Self-explanatory
(<a href="reports/uncompressed-info/{{ user.username }}/">yours only</a>)</li>
<li><a href="reports/mismatched-signature/">Mismatched Signatures</a>:
- Packages where 1) signing key is unknown, 2) signer != packager, or 3) signature timestamp more than 24 hours after build timestamp
+ Packages where 1) signing key is unknown, 2) signer != packager,
+ or 3) signature timestamp more than 24 hours after build timestamp
(<a href="reports/mismatched-signature/{{ user.username }}/">yours only</a>)</li>
<li><a href="reports/big/">Big</a>:
All packages with compressed size &gt; 50 MiB
@@ -173,127 +174,10 @@
Packages that have no maintainer and are not required by any other
package in any repository</li>
</ul>
-
-</div><!-- #dev-dashboard -->
-
-{% cache 60 dev-dash-by-arch %}
-<div id="dash-by-arch" class="box">
-
- <h2>Stats by Architecture</h2>
-
- <table id="stats-by-arch" class="results dash-stats">
- <thead>
- <tr>
- <th class="key">Arch</th>
- <th># Packages</th>
- <th># Flagged</th>
- </tr>
- </thead>
- <tbody>
- {% for arch in arches %}
- <tr class="{% cycle 'odd' 'even' %}">
- <td>{{ arch.name }}</td>
- <td><a href="/packages/?arch={{ arch.name }}"
- title="View all packages for the {{ arch.name }} architecture">
- <strong>{{ arch.total_ct }}</strong> packages</a></td>
- <td><a href="/packages/?arch={{ arch.name }}&amp;flagged=Flagged"
- title="View all flagged packages for the {{ arch.name }} architecture">
- <strong>{{ arch.flagged_ct }}</strong> packages</a></td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
-</div>{# #dash-by-arch #}
-{% endcache %}
-
-{% cache 60 dev-dash-by-repo %}
-<div id="dash-by-repo" class="box">
-
- <h2>Stats by Repository</h2>
-
- <table id="stats-by-repo" class="results dash-stats">
- <thead>
- <tr>
- <th class="key">Repository</th>
- <th># Packages</th>
- <th># Flagged</th>
- <th># Maintainers</th>
- </tr>
- </thead>
- <tbody>
- {% for repo in repos %}
- <tr class="{% cycle 'odd' 'even' %}">
- <td>{{ repo.name }}</td>
- <td><a href="/packages/?repo={{ repo.name }}"
- title="View all packages in the {{ repo.name }} repository">
- <strong>{{ repo.total_ct }}</strong> packages</a></td>
- <td><a href="/packages/?repo={{ repo.name }}&amp;flagged=Flagged"
- title="View all flagged packages in the {{ repo.name }} repository">
- <strong>{{ repo.flagged_ct }}</strong> packages</a></td>
- <td><strong>{{ repo.maintainer_ct }}</strong> maintainers</td>
- </tr>
- </tr>
- {% endfor %}
- </tbody>
- </table>
-</div>{# dash-by-arch #}
-{% endcache %}
-
-{% cache 60 dev-dash-by-developer %}
-<div id="dash-by-developer" class="box">
-
- <h2>Stats by Developer</h2>
-
- {% if perms.main.change_package %}
- <p><a href="/packages/stale_relations/">Look for stale relations</a></p>
- {% endif %}
-
- <table id="stats-by-maintainer" class="results dash-stats">
- <thead>
- <tr>
- <th class="key">Maintainer</th>
- <th># Maintained</th>
- <th># Flagged</th>
- <th># Last Packager</th>
- </tr>
- <tr class="even">
- <td><em>Orphan/Unknown</em></td>
- <td><a href="/packages/?maintainer=orphan"
- title="View all orphan packages">
- <strong>{{ orphan.package_count }}</strong> packages</a>
- </td>
- <td><a href="/packages/?maintainer=orphan&amp;flagged=Flagged"
- title="View all flagged orphan packages">
- <strong>{{ orphan.flagged_count }}</strong> packages</a>
- </td>
- <td><a href="/packages/?packager=unknown"
- title="View all packages last updated by unknown">
- <strong>{{ orphan.updated_count }}</strong> packages</a>
- </td>
- </tr>
- </thead>
- <tbody>
- {% for maint in maintainers %}
- <tr class="{% cycle 'odd' 'even' %}">
- <td>{{ maint.get_full_name }}</td>
- <td><a href="/packages/?maintainer={{ maint.username }}"
- title="View all packages maintained by {{ maint.get_full_name }}">
- <strong>{{ maint.package_count }}</strong> packages</a>
- </td>
- <td><a href="/packages/?maintainer={{ maint.username }}&amp;flagged=Flagged"
- title="View all flagged packages maintained by {{ maint.get_full_name }}">
- <strong>{{ maint.flagged_count }}</strong> packages</a>
- </td>
- <td><a href="/packages/?packager={{ maint.username }}"
- title="View all packages last updated by {{ maint.get_full_name }}">
- <strong>{{ maint.updated_count }}</strong> packages</a>
- </td>
- </tr>
- {% endfor %}
- </tbody>
- </table>
-</div>{# #dash-by-developer #}
-{% endcache %}
+</div>{# #dev-dashboard #}
+<div id='stats-area'>
+ <p>Enable Javascript to get more useful info here.</p>
+</div>
{% endblock %}
{% block script_block %}
diff --git a/templates/devel/stats.html b/templates/devel/stats.html
new file mode 100644
index 00000000..2dbe4755
--- /dev/null
+++ b/templates/devel/stats.html
@@ -0,0 +1,120 @@
+{% load cache %}
+
+{% cache 60 dev-dash-by-arch %}
+<div id="dash-by-arch" class="box">
+
+ <h2>Stats by Architecture</h2>
+
+ <table id="stats-by-arch" class="results dash-stats">
+ <thead>
+ <tr>
+ <th class="key">Arch</th>
+ <th># Packages</th>
+ <th># Flagged</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for arch in arches %}
+ <tr class="{% cycle 'odd' 'even' %}">
+ <td>{{ arch.name }}</td>
+ <td><a href="/packages/?arch={{ arch.name }}"
+ title="View all packages for the {{ arch.name }} architecture">
+ <strong>{{ arch.total_ct }}</strong> packages</a></td>
+ <td><a href="/packages/?arch={{ arch.name }}&amp;flagged=Flagged"
+ title="View all flagged packages for the {{ arch.name }} architecture">
+ <strong>{{ arch.flagged_ct }}</strong> packages</a></td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+</div>{# #dash-by-arch #}
+{% endcache %}
+
+{% cache 60 dev-dash-by-repo %}
+<div id="dash-by-repo" class="box">
+
+ <h2>Stats by Repository</h2>
+
+ <table id="stats-by-repo" class="results dash-stats">
+ <thead>
+ <tr>
+ <th class="key">Repository</th>
+ <th># Packages</th>
+ <th># Flagged</th>
+ <th># Maintainers</th>
+ </tr>
+ </thead>
+ <tbody>
+ {% for repo in repos %}
+ <tr class="{% cycle 'odd' 'even' %}">
+ <td>{{ repo.name }}</td>
+ <td><a href="/packages/?repo={{ repo.name }}"
+ title="View all packages in the {{ repo.name }} repository">
+ <strong>{{ repo.total_ct }}</strong> packages</a></td>
+ <td><a href="/packages/?repo={{ repo.name }}&amp;flagged=Flagged"
+ title="View all flagged packages in the {{ repo.name }} repository">
+ <strong>{{ repo.flagged_ct }}</strong> packages</a></td>
+ <td><strong>{{ repo.maintainer_ct }}</strong> maintainers</td>
+ </tr>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+</div>{# dash-by-arch #}
+{% endcache %}
+
+{% cache 60 dev-dash-by-developer %}
+<div id="dash-by-developer" class="box">
+
+ <h2>Stats by Developer</h2>
+
+ {% if perms.main.change_package %}
+ <p><a href="/packages/stale_relations/">Look for stale relations</a></p>
+ {% endif %}
+
+ <table id="stats-by-maintainer" class="results dash-stats">
+ <thead>
+ <tr>
+ <th class="key">Maintainer</th>
+ <th># Maintained</th>
+ <th># Flagged</th>
+ <th># Last Packager</th>
+ </tr>
+ <tr class="even">
+ <td><em>Orphan/Unknown</em></td>
+ <td><a href="/packages/?maintainer=orphan"
+ title="View all orphan packages">
+ <strong>{{ orphan.package_count }}</strong> packages</a>
+ </td>
+ <td><a href="/packages/?maintainer=orphan&amp;flagged=Flagged"
+ title="View all flagged orphan packages">
+ <strong>{{ orphan.flagged_count }}</strong> packages</a>
+ </td>
+ <td><a href="/packages/?packager=unknown"
+ title="View all packages last updated by unknown">
+ <strong>{{ orphan.updated_count }}</strong> packages</a>
+ </td>
+ </tr>
+ </thead>
+ <tbody>
+ {% for maint in maintainers %}
+ <tr class="{% cycle 'odd' 'even' %}">
+ <td>{{ maint.get_full_name }}</td>
+ <td><a href="/packages/?maintainer={{ maint.username }}"
+ title="View all packages maintained by {{ maint.get_full_name }}">
+ <strong>{{ maint.package_count }}</strong> packages</a>
+ </td>
+ <td><a href="/packages/?maintainer={{ maint.username }}&amp;flagged=Flagged"
+ title="View all flagged packages maintained by {{ maint.get_full_name }}">
+ <strong>{{ maint.flagged_count }}</strong> packages</a>
+ </td>
+ <td><a href="/packages/?packager={{ maint.username }}"
+ title="View all packages last updated by {{ maint.get_full_name }}">
+ <strong>{{ maint.updated_count }}</strong> packages</a>
+ </td>
+ </tr>
+ {% endfor %}
+ </tbody>
+ </table>
+</div>{# #dash-by-developer #}
+{% endcache %}