From ecf57207c0a5f90d51b6be551158ce7a0f82c9cb Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 21 Apr 2013 20:06:14 -0500 Subject: Fix sorting of file size values in jQuery tablesorter The dumbass currency parser was matching values like '1.5 GB', causing the actual sorting to not work right since the magnitude values of GB values are obviously different than MB. Remove it fully from the parser list so our actual parser matches and we sort correctly. Signed-off-by: Dan McGee --- templates/devel/packages.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'templates') diff --git a/templates/devel/packages.html b/templates/devel/packages.html index 0e6b1752..d6aab497 100644 --- a/templates/devel/packages.html +++ b/templates/devel/packages.html @@ -86,7 +86,7 @@

Filter Packages

var filter_func = function() { filter_pkgs_list('#report_filter', '#dev-report-results tbody'); }; $('#report_filter input').change(filter_func); $('#criteria_reset').click(function() { filter_pkgs_reset(filter_func); }); - // fire function on page load to ensure the current form selections take effect + // run on page load to ensure current form selections take effect filter_func(); }); -- cgit v1.2.3-54-g00ecf 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 (limited to 'templates') 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 @@ (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 @@ @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 @@

Developer Reports

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 @@

    Developer Reports

    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-54-g00ecf From a8203a0a17fbd8680f96c9357c7fba5923960e34 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 21 Apr 2013 20:37:44 -0500 Subject: Load developer dashboard stats via $.load() call This completes the separation started in an earlier commit. Signed-off-by: Dan McGee --- templates/devel/index.html | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) (limited to 'templates') diff --git a/templates/devel/index.html b/templates/devel/index.html index 232a9034..03e5d73a 100644 --- a/templates/devel/index.html +++ b/templates/devel/index.html @@ -175,6 +175,7 @@

    Developer Reports

    package in any repository {# #dev-dashboard #} +

    Enable Javascript to get more useful info here.

    @@ -185,6 +186,19 @@

    Developer Reports

    {% endblock %} -- cgit v1.2.3-54-g00ecf From 6fa6a8db0787fa40fa1c88b725b0bce184903c4c Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Mon, 22 Apr 2013 10:50:03 -0500 Subject: Use required_signoffs value when creating signoff specs And respect it elsewhere when we create a fake default specification because a real one does not exist yet. Signed-off-by: Dan McGee --- packages/management/commands/populate_signoffs.py | 6 ++++-- packages/models.py | 12 +++++++++--- packages/utils.py | 4 ++-- templates/packages/signoffs.html | 2 +- 4 files changed, 16 insertions(+), 8 deletions(-) (limited to 'templates') diff --git a/packages/management/commands/populate_signoffs.py b/packages/management/commands/populate_signoffs.py index 97ba4146..a9c1c81c 100644 --- a/packages/management/commands/populate_signoffs.py +++ b/packages/management/commands/populate_signoffs.py @@ -29,7 +29,8 @@ logger = logging.getLogger() class Command(NoArgsCommand): - help = "Pull the latest commit message from SVN for a given package that is signoff-eligible and does not have an existing comment attached" + help = """Pull the latest commit message from SVN for a given package that +is signoff-eligible and does not have an existing comment attached""" def handle_noargs(self, **options): v = int(options.get('verbosity', None)) @@ -74,10 +75,11 @@ def cached_svn_log(pkgbase, repo): def create_specification(package, log, finder): trimmed_message = log['message'].strip() + required = package.arch.required_signoffs spec = SignoffSpecification(pkgbase=package.pkgbase, pkgver=package.pkgver, pkgrel=package.pkgrel, epoch=package.epoch, arch=package.arch, repo=package.repo, - comments=trimmed_message) + comments=trimmed_message, required=required) spec.user = finder.find_by_username(log['author']) return spec diff --git a/packages/models.py b/packages/models.py index f830aade..6477d412 100644 --- a/packages/models.py +++ b/packages/models.py @@ -60,7 +60,8 @@ def get_or_default_from_package(self, pkg): pkgbase=pkg.pkgbase, pkgver=pkg.pkgver, pkgrel=pkg.pkgrel, epoch=pkg.epoch, arch=pkg.arch, repo=pkg.repo) except SignoffSpecification.DoesNotExist: - return DEFAULT_SIGNOFF_SPEC + return fake_signoff_spec(pkg.arch) + class SignoffSpecification(models.Model): ''' @@ -97,10 +98,15 @@ def __unicode__(self): return u'%s-%s' % (self.pkgbase, self.full_version) -# fake default signoff spec when we don't have a persisted one in the database +# Fake signoff specs for when we don't have persisted ones in the database. +# These have all necessary attributes of the real thing but are lighter weight +# and have no chance of being persisted. FakeSignoffSpecification = namedtuple('FakeSignoffSpecification', ('required', 'enabled', 'known_bad', 'comments')) -DEFAULT_SIGNOFF_SPEC = FakeSignoffSpecification(2, True, False, u'') + + +def fake_signoff_spec(arch): + return FakeSignoffSpecification(arch.required_signoffs, True, False, u'') class SignoffManager(models.Manager): diff --git a/packages/utils.py b/packages/utils.py index 4f3b8665..b8d1504d 100644 --- a/packages/utils.py +++ b/packages/utils.py @@ -14,7 +14,7 @@ groupby_preserve_order, PackageStandin) from .models import (PackageGroup, PackageRelation, License, Depend, Conflict, Provision, Replacement, - SignoffSpecification, Signoff, DEFAULT_SIGNOFF_SPEC) + SignoffSpecification, Signoff, fake_signoff_spec) VERSION_RE = re.compile(r'^((\d+):)?(.+)-([^-]+)$') @@ -297,7 +297,6 @@ def __init__(self, packages): self.user = None self.target_repo = None self.signoffs = set() - self.specification = DEFAULT_SIGNOFF_SPEC self.default_spec = True first = packages[0] @@ -308,6 +307,7 @@ def __init__(self, packages): self.last_update = first.last_update self.packager = first.packager self.maintainers = first.maintainers + self.specification = fake_signoff_spec(first.arch) version = first.full_version if all(version == pkg.full_version for pkg in packages): diff --git a/templates/packages/signoffs.html b/templates/packages/signoffs.html index 6fbbd00e..807b613b 100644 --- a/templates/packages/signoffs.html +++ b/templates/packages/signoffs.html @@ -68,7 +68,7 @@

    Filter Displayed Signoffs

    {% endif %} {% include "packages/signoff_cell.html" %} {% if not group.default_spec %}{% with group.specification as spec %}{% comment %} - {% endcomment %}{% if spec.required != 2 %}Required signoffs: {{ spec.required }}
    {% endif %}{% comment %} + {% endcomment %}{% if spec.required != spec.arch.required_signoffs %}Required signoffs: {{ spec.required }}
    {% endif %}{% comment %} {% endcomment %}{% if not spec.enabled %}Signoffs are not currently enabled
    {% endif %}{% comment %} {% endcomment %}{% if spec.known_bad %}Package is known to be bad
    {% endif %}{% comment %} {% endcomment %}{{ spec.comments|default:""|linebreaksbr }} -- cgit v1.2.3-54-g00ecf