summaryrefslogtreecommitdiffstats
path: root/mirrors/views.py
AgeCommit message (Collapse)AuthorFilesLines
2014-10-21Use cache_page on mirror status JSONDan McGee1-0/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-21Reduce complexity of status data URL queryDan McGee1-1/+4
Get rid of all the junk trying to only return URLs that have been checked in the last 24 hours; it just isn't worth it. Instead, do that screening only in the views that need it, namely the HTML status page. Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-21Remove queryset specialization in JSON encoderDan McGee1-4/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-21Small performance tweaks to mirror status JSON encodingDan McGee1-5/+2
Do a few things to speed up the encoding of the JSON, including better usage of list comprehensions, less dynamic setattr() usage, and removal of the queryset specialization since we can easily do it outside of the encoder. Signed-off-by: Dan McGee <dan@archlinux.org>
2014-10-19Use raw DB query to fetch last modified dateDan McGee1-1/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-02-22Upgrade django-countries to 2.0Dan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2014-01-11Add a 'last_modified' function for mirror status pagesrelease_2014-01-11Dan McGee1-0/+7
We can use this on both the HTML and JSON views of this data to prevent recomputation for smart clients that respect the modified date header. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-12-15Use select_related() in new mirror URL details viewDan McGee1-2/+4
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-12-15Add mirror URL details pageDan McGee1-0/+19
This will allow those that care about mirrors to zoom into URL-level details for each mirror and examine the individual check results. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-12-14Show all mirror status data to authorized usersDan McGee1-5/+13
Regardless of whether the mirror URL is active or not, we often have data we can show the end user, especially if mirror admins care to see the data we've been gathering. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-06-01Ensure only active mirror URLs are listedDan McGee1-1/+1
This fixes things up on the download page as well as the individual mirror details page. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-05-31Whoops, committed a little bit too muchrelease_2013-05-31Dan McGee1-3/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-05-31Honor mirror URL active attribute in several placesDan McGee1-2/+5
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-05-21Begin removal of FTP mirror supportDan McGee1-24/+5
FTP is a terrible protocol these days compared to HTTP. IPv6 support is spotty at best, it is much slower for the connect/begin transfer cycle, and overall just doesn't provide anything HTTP does better. Start killing bits that we've added to treat FTP as a first-class protocol and regulate it to the back seat. The expectation here is once this commit goes live to the production site, the FTP mirror URLs themselves will get removed completely from the database, and the FTP protocol object itself will get deleted. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-05-10Add mirror error logs to mirror details pageDan McGee1-2/+9
Give a window of 7 days for logs here rather than the default 24 hours we do on the main status page since we are only retrieving details for a single mirror with a handful of URLs. This should make it easier to have all information regarding one mirror in a single location. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-16Remove COUNTRY_LOOKUP global variableDan McGee1-3/+3
This is only used in one place, so it makes more sense for it to not be globally accessible. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-14Draw one mirror status graph per check locationDan McGee1-1/+2
Rather than lump it all together and have odd spikes depending on which side of the Atlantic checked a mirror in a given timeslot, draw a chart per check location. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-14Add a JSON view for retrieving mirror check locationsDan McGee1-2/+31
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-04-13Support only a single mirror ID in error/status retrievalDan McGee1-2/+2
This simplifies things and makes injecting this single mirror ID into custom SQL a whole lot easier. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-16Remove debugging print statementDan McGee1-1/+0
Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-14Support mirror status JSON by tierDan McGee1-1/+7
Just as we do for the normal status HTML view. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-14Ensure URLs without check data work on mirror details pageDan McGee1-7/+11
Less noticeable in production as the templates don't show '@@@INVALID@@@' there, but we were trying to access attributes that don't actually exist on certain mirror objects. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-14Drop country column from mirror tableDan McGee1-10/+5
We now always look for this information at the URL level, not the mirror level. This simplifies quite a bit of code in and around the mirror views. Signed-off-by: Dan McGee <dan@archlinux.org>
2013-01-13Use content_type and not mimetype on HttpResponse()Dan McGee1-2/+2
Bug #16519 in Django deprecates mimetype, so update our code accordingly. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-12-27Ensure mirror protocols are distinctDan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-16Use Python 2.7 dictionary comprehension syntaxDan McGee1-7/+4
Rather than the old idiom of dict((k, v) for <> in <>). Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-12Prefetch the available protocols on the mirror overview pageDan McGee1-0/+8
Otherwise we are doing one query per mirror, which at this point is over 100 separate queries. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-11Mirror graph tweaking after usage with real dataDan McGee1-2/+0
* Clamp y-axis minimum to 0. * Don't plot `is_success == false` values. * Ensure URLs are sorted predictably. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-11Mirror status graph, now with points AND linesDan McGee1-1/+2
We might have to tweak the interpolation method once we see this with real data, but for now it looks really pretty locally. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-10Allow filtering retrieved mirror statuses by mirror_idDan McGee1-4/+4
When we don't need them all, no need to fetch them all. Let the database do the work for us, hopefully. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-11-10Add mirror extended status JSON viewDan McGee1-3/+34
When asking for status for a single mirror, we can include logs from the past 24 hours in addition to the normal information we provide. This is slated for usage by a frontend graph still to come, similar to those on the NTP pool website. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-09-18Sort mirrorlist by English country name, not ISO codeDan McGee1-1/+1
Fixes FS#31503. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-31Declare 'enums' at class scopeDan McGee1-2/+2
Signed-off-by: Dan McGee <dan@archlinux.org>
2012-07-24Replace deprecated direct_to_template() with render() shortcutDan McGee1-10/+9
Now that Django actually provides a concise way to use a RequestContext object without instantiating it, we can use that rather than the old function-based generic view that worked well to do the same. Additionally, these function-based generic views will be gone in Django 1.5, so might as well make the move now. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-13Add ability to restrict status report to single tierrelease_2012-05-13Dan McGee1-3/+16
This should make it easier to catch errors in our Tier 1 mirrors. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-12Use python json module directly in place of simplejsonDan McGee1-3/+2
As of Python 2.6, this is a builtin module that has all the same functions and capabilities of the Django simplejson module. Additionally simplejson is deprecated in the upcoming Django 1.5 release. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-02Add a smart protocol filter to mirrorlist generatorDan McGee1-15/+40
This will only list FTP mirrors for a given country if there are no HTTP mirrors available, since FTP must die. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-05-02Allow mirrorlist generator pattern to match any protocolDan McGee1-5/+13
Add a helper method that checks if we know about the protocol; if so, we can spit out a URL for it. This allows (if you are insane) generation of an rsync mirrorlist, for instance. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-25Ensure sorted order of mirrors in status page matches with JSrelease_2012-04-25Dan McGee1-5/+5
We had one sorting order in the backend, and another once the JS sorting routine kicked in. Match them so we aren't doing more on the client-side on initial display than we have to. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-25Clean up mirrorlist generation form a bitDan McGee1-3/+15
Rename template since it really isn't an index of mirrors at all, and convert the form to use multiple checkboxes for both ftp/http and ipv4/ipv6 selection. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-25Finish django countries implementationDan McGee1-20/+42
* Add a migration to drop the old countries field. * Update all templates/views/utility methods to point at the new country field and dereference it as necessary. * Add the flags images to a few views where it makes sense. * Cleanup the download page layout quite a bit. * Bump the mirror status JSON version to 3; add country_code attribute. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-04-25Rename mirror country fields to country_old in prep for normalizationDan McGee1-4/+4
We're going to move to using ISO 2 character codes via django countries, so start by moving the old data out of the way first. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-03-26Bump signoffs and mirror status JSON API versionsDan McGee1-1/+1
Due to datetime formatting changes in Django 1.4, we know follow the ECMA specification more closely and use 'yyyy-mm-ddThh:mm_ssZ' format. As this could break existing users of the JSON data, bump the version. Signed-off-by: Dan McGee <dan@archlinux.org>
2012-02-13Don't select FTP by default in mirrorlistsDan McGee1-2/+4
More generally, add a new 'default' column to the mirror protocol model so we can determine what is selected and shown by default. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-10-26Don't require mirrorlist URLs to have ISOsrelease_2011-10-26Dan McGee1-1/+1
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-06-14Add JSON package details and files viewsDan McGee1-3/+2
These are retrieved by adding 'json/' to the normal package details or files view. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-18mirrors: pylint discovered cleanupsDan McGee1-4/+3
Signed-off-by: Dan McGee <dan@archlinux.org>
2011-04-12Add optional country override for individual mirror URLsDan McGee1-5/+7
This allows a named top-level mirror to have geographically distributed URLs, e.g. kernel.org and the geo-DNS setup. Signed-off-by: Dan McGee <dan@archlinux.org>
2011-03-28Enhance the mirror details pageDan McGee1-2/+11
Get the URLs with their performance data showing up, and simplify the top part for non-authenticated users while adding more detail for logged-in users. Signed-off-by: Dan McGee <dan@archlinux.org>
2010-12-13Add a mirror status JSON viewDan McGee1-1/+36
Requested in FS#21144. This should provide most if not all of the data that was provided on the archlinux.de website, although there are some differences in what is returned to the user. It is nearly the same data as that provided in the HTML view, the difference being things are a bit more machine-friendly and the list is not split into good and bad portions. Signed-off-by: Dan McGee <dan@archlinux.org>