Added filtering of packages to show outstanding maintenance.
This commit is contained in:
parent
2c29aa05c9
commit
51cef4e285
|
@ -100,6 +100,7 @@
|
||||||
(script ((type "text/javascript") (src ,(static "/jquery.tablesorter.min.js"))))
|
(script ((type "text/javascript") (src ,(static "/jquery.tablesorter.min.js"))))
|
||||||
(script ((type "text/javascript") (src ,(static "/jquery-ui.min.js"))))
|
(script ((type "text/javascript") (src ,(static "/jquery-ui.min.js"))))
|
||||||
(script ((type "text/javascript") (src ,(static "/bootstrap/js/bootstrap.min.js"))))
|
(script ((type "text/javascript") (src ,(static "/bootstrap/js/bootstrap.min.js"))))
|
||||||
|
(script ((type "text/javascript") (src ,(static "/todos.js"))))
|
||||||
(script ((type "text/javascript") (src ,(static "/site.js"))))
|
(script ((type "text/javascript") (src ,(static "/site.js"))))
|
||||||
,@(for/list ((script (bootstrap-page-scripts)))
|
,@(for/list ((script (bootstrap-page-scripts)))
|
||||||
`(script ((type "text/javascript") (src ,script))))))))
|
`(script ((type "text/javascript") (src ,script))))))))
|
||||||
|
|
48
src/site.rkt
48
src/site.rkt
|
@ -593,22 +593,45 @@
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(define (package-summary-table package-names)
|
(define (package-summary-table package-names)
|
||||||
(define now (/ (current-inexact-milliseconds) 1000))
|
(define-values (pkg-rows num-todos)
|
||||||
|
(build-pkg-rows/num-todos package-names))
|
||||||
`(table
|
`(table
|
||||||
((class "packages sortable"))
|
((class "packages sortable") (data-todokey ,num-todos))
|
||||||
(thead
|
(thead
|
||||||
(tr
|
(tr
|
||||||
(th 'nbsp)
|
(th 'nbsp)
|
||||||
(th "Package")
|
(th "Package")
|
||||||
(th "Description")
|
(th "Description")
|
||||||
(th "Build")))
|
(th "Build")
|
||||||
|
(th ((style "display: none")) 'nbsp))) ;; todokey
|
||||||
(tbody
|
(tbody
|
||||||
,@(maybe-splice (null? package-names)
|
,@(maybe-splice (null? package-names)
|
||||||
`(tr (td ((colspan "4"))
|
`(tr (td ((colspan "4"))
|
||||||
(div ((class "alert alert-info"))
|
(div ((class "alert alert-info"))
|
||||||
"No packages found."))))
|
"No packages found."))))
|
||||||
,@(for/list ((pkg (package-batch-detail package-names)))
|
,@pkg-rows)))
|
||||||
|
|
||||||
|
(define (build-pkg-rows/num-todos package-names)
|
||||||
|
;; Builds the list of rows in the package table as an x-exp.
|
||||||
|
;; Also returns the total number of non-zero todo keys,
|
||||||
|
;; representing packages with outstanding build errors or
|
||||||
|
;; failing tests, or which are missing docs or tags.
|
||||||
|
(define now (/ (current-inexact-milliseconds) 1000))
|
||||||
|
(define-values (pkg-rows num-todos)
|
||||||
|
(for/fold ([pkg-rows null] [num-todos 0])
|
||||||
|
([pkg (package-batch-detail package-names)])
|
||||||
|
(define has-docs? (pair? (package-docs pkg)))
|
||||||
|
(define has-readme? (pair? (package-readme-url pkg)))
|
||||||
|
(define has-tags? (pair? (package-tags pkg)))
|
||||||
|
(define todokey
|
||||||
|
(cond [(package-build-failure-log pkg) 4]
|
||||||
|
[(package-build-test-failure-log pkg) 3]
|
||||||
|
[(not (or has-docs? has-readme?)) 2]
|
||||||
|
[(not has-tags?) 1]
|
||||||
|
[else 0]))
|
||||||
|
(define row-xexp
|
||||||
`(tr
|
`(tr
|
||||||
|
((data-todokey ,todokey))
|
||||||
(td (span ((class "last-updated-negated") (style "display: none"))
|
(td (span ((class "last-updated-negated") (style "display: none"))
|
||||||
,(~a (- (package-last-updated pkg))))
|
,(~a (- (package-last-updated pkg))))
|
||||||
,@(maybe-splice
|
,@(maybe-splice
|
||||||
|
@ -618,21 +641,24 @@
|
||||||
,(authors-list (package-authors pkg)))
|
,(authors-list (package-authors pkg)))
|
||||||
(td (p ,(package-description pkg))
|
(td (p ,(package-description pkg))
|
||||||
,@(maybe-splice
|
,@(maybe-splice
|
||||||
(or (pair? (package-docs pkg)) (package-readme-url pkg))
|
(or has-docs? has-readme?)
|
||||||
`(div
|
`(div
|
||||||
(span ((class "doctags-label")) "Docs: ")
|
(span ((class "doctags-label")) "Docs: ")
|
||||||
,(doc-links (package-docs pkg))
|
,(doc-links (package-docs pkg))
|
||||||
,@(maybe-splice (package-readme-url pkg)
|
,@(maybe-splice has-readme?
|
||||||
" "
|
" "
|
||||||
`(a ((href ,(package-readme-url pkg)))
|
`(a ((href ,(package-readme-url pkg)))
|
||||||
"README"))
|
"README"))))
|
||||||
))
|
|
||||||
,@(maybe-splice
|
,@(maybe-splice
|
||||||
(pair? (package-tags pkg))
|
has-tags?
|
||||||
`(div
|
`(div
|
||||||
(span ((class "doctags-label")) "Tags: ")
|
(span ((class "doctags-label")) "Tags: ")
|
||||||
,(tag-links (package-tags pkg)))))
|
,(tag-links (package-tags pkg)))))
|
||||||
,(build-status-td pkg))))))
|
,(build-status-td pkg)
|
||||||
|
(td ((style "display: none")) ,todokey)))
|
||||||
|
(values (cons row-xexp pkg-rows) (if (> 0 todokey) (add1 num-todos) num-todos))))
|
||||||
|
;; for/fold reverses pkg-rows, so un-reverse before returning.
|
||||||
|
(values (reverse pkg-rows) num-todos))
|
||||||
|
|
||||||
(define (build-status-td pkg)
|
(define (build-status-td pkg)
|
||||||
;; Build the index page cell for summarizing a package's build status.
|
;; Build the index page cell for summarizing a package's build status.
|
||||||
|
@ -660,6 +686,7 @@
|
||||||
(match-define (list u p l) e)
|
(match-define (list u p l) e)
|
||||||
(if u `(span ,p ,(buildhost-link u l)) `(span)))))
|
(if u `(span ,p ,(buildhost-link u l)) `(span)))))
|
||||||
|
|
||||||
|
|
||||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||||
|
|
||||||
(define (main-page request)
|
(define (main-page request)
|
||||||
|
@ -700,6 +727,7 @@
|
||||||
,(format "~a packages" (length package-name-list))
|
,(format "~a packages" (length package-name-list))
|
||||||
" "
|
" "
|
||||||
(a ((href ,(format "~a?q=%20" (named-url search-page)))) "(see all, including packages tagged as \"deprecated\", \"main-distribution\", or \"main-test\")"))
|
(a ((href ,(format "~a?q=%20" (named-url search-page)))) "(see all, including packages tagged as \"deprecated\", \"main-distribution\", or \"main-test\")"))
|
||||||
|
(p ((class "package-count") (id "todo-msg")) "") ;; filled in by client-side JS.
|
||||||
,(package-summary-table package-name-list))
|
,(package-summary-table package-name-list))
|
||||||
`(div ((class "jumbotron"))
|
`(div ((class "jumbotron"))
|
||||||
(p "Questions? Comments? Bugs? Email "
|
(p "Questions? Comments? Bugs? Email "
|
||||||
|
|
1717
static/site.js
1717
static/site.js
File diff suppressed because it is too large
Load Diff
48
static/todos.js
Normal file
48
static/todos.js
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
$(function() {
|
||||||
|
"use strict";
|
||||||
|
|
||||||
|
function applyFilter() {
|
||||||
|
$("table.packages > tbody > tr").each(function() {
|
||||||
|
var row = this;
|
||||||
|
if (Number.parseInt($(row).data("todokey"), 10) === 0) {
|
||||||
|
row.style.display = "none";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("table.packages > thead > tr > :nth-child(5)").trigger("click");
|
||||||
|
}
|
||||||
|
|
||||||
|
function removeFilter() {
|
||||||
|
$("table.packages > tbody > tr").each(function() {
|
||||||
|
var row = this;
|
||||||
|
if (Number.parseInt($(row).data("todokey"), 10) === 0) {
|
||||||
|
row.style.display = "";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
$("table.packages > thead > tr > :nth-child(2)").trigger("click");
|
||||||
|
}
|
||||||
|
|
||||||
|
var todoTotal = $("table.packages").data("todokey");
|
||||||
|
|
||||||
|
if (todoTotal > 0) {
|
||||||
|
$("#todo-msg").html(
|
||||||
|
todoTotal + " todos. " +
|
||||||
|
"<a style='cursor:pointer' id='filter-pkgs'> Click here to see them.</a>"
|
||||||
|
);
|
||||||
|
|
||||||
|
var filterIsApplied = false;
|
||||||
|
|
||||||
|
$("#filter-pkgs").click(function() {
|
||||||
|
var filterLink = $(this);
|
||||||
|
if (!filterIsApplied) {
|
||||||
|
applyFilter();
|
||||||
|
filterLink.text("Click to see all packages.");
|
||||||
|
filterIsApplied = true;
|
||||||
|
} else {
|
||||||
|
removeFilter();
|
||||||
|
filterLink.text("Click here to see them.");
|
||||||
|
filterIsApplied = false;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
}); /* document.ready */
|
Loading…
Reference in New Issue
Block a user