From 66412aa1037befef0b579c7df73656dc3b8b9804 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 21 Apr 2013 20:29:17 -0500 Subject: 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 --- devel/urls.py | 1 + devel/views.py | 21 +++++--- templates/devel/index.html | 128 +++------------------------------------------ templates/devel/stats.html | 120 ++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 142 insertions(+), 128 deletions(-) create mode 100644 templates/devel/stats.html 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.*)/$','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.*)/(?P.*)/$', '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 (yours only)
  • Mismatched Signatures: - 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 (yours only)
  • Big: All packages with compressed size > 50 MiB @@ -173,127 +174,10 @@ Packages that have no maintainer and are not required by any other package in any repository
  • - - - -{% cache 60 dev-dash-by-arch %} -
    - -

    Stats by Architecture

    - - - - - - - - - - - {% for arch in arches %} - - - - - - {% endfor %} - -
    Arch# Packages# Flagged
    {{ arch.name }} - {{ arch.total_ct }} packages - {{ arch.flagged_ct }} packages
    -
    {# #dash-by-arch #} -{% endcache %} - -{% cache 60 dev-dash-by-repo %} -
    - -

    Stats by Repository

    - - - - - - - - - - - - {% for repo in repos %} - - - - - - - - {% endfor %} - -
    Repository# Packages# Flagged# Maintainers
    {{ repo.name }} - {{ repo.total_ct }} packages - {{ repo.flagged_ct }} packages{{ repo.maintainer_ct }} maintainers
    -
    {# dash-by-arch #} -{% endcache %} - -{% cache 60 dev-dash-by-developer %} -
    - -

    Stats by Developer

    - - {% if perms.main.change_package %} -

    Look for stale relations

    - {% endif %} - - - - - - - - - - - - - - - - - - {% for maint in maintainers %} - - - - - - - {% endfor %} - -
    Maintainer# Maintained# Flagged# Last Packager
    Orphan/Unknown - {{ orphan.package_count }} packages - - {{ orphan.flagged_count }} packages - - {{ orphan.updated_count }} packages -
    {{ maint.get_full_name }} - {{ maint.package_count }} packages - - {{ maint.flagged_count }} packages - - {{ maint.updated_count }} packages -
    -
    {# #dash-by-developer #} -{% endcache %} +{# #dev-dashboard #} +
    +

    Enable Javascript to get more useful info here.

    +
    {% 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 %} +
    + +

    Stats by Architecture

    + + + + + + + + + + + {% for arch in arches %} + + + + + + {% endfor %} + +
    Arch# Packages# Flagged
    {{ arch.name }} + {{ arch.total_ct }} packages + {{ arch.flagged_ct }} packages
    +
    {# #dash-by-arch #} +{% endcache %} + +{% cache 60 dev-dash-by-repo %} +
    + +

    Stats by Repository

    + + + + + + + + + + + + {% for repo in repos %} + + + + + + + + {% endfor %} + +
    Repository# Packages# Flagged# Maintainers
    {{ repo.name }} + {{ repo.total_ct }} packages + {{ repo.flagged_ct }} packages{{ repo.maintainer_ct }} maintainers
    +
    {# dash-by-arch #} +{% endcache %} + +{% cache 60 dev-dash-by-developer %} +
    + +

    Stats by Developer

    + + {% if perms.main.change_package %} +

    Look for stale relations

    + {% endif %} + + + + + + + + + + + + + + + + + + {% for maint in maintainers %} + + + + + + + {% endfor %} + +
    Maintainer# Maintained# Flagged# Last Packager
    Orphan/Unknown + {{ orphan.package_count }} packages + + {{ orphan.flagged_count }} packages + + {{ orphan.updated_count }} packages +
    {{ maint.get_full_name }} + {{ maint.package_count }} packages + + {{ maint.flagged_count }} packages + + {{ maint.updated_count }} packages +
    +
    {# #dash-by-developer #} +{% endcache %} -- cgit v1.2.3-55-g3dc8