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-ui.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"))))
|
||||
,@(for/list ((script (bootstrap-page-scripts)))
|
||||
`(script ((type "text/javascript") (src ,script))))))))
|
||||
|
|
86
src/site.rkt
86
src/site.rkt
|
@ -593,46 +593,72 @@
|
|||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(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
|
||||
((class "packages sortable"))
|
||||
((class "packages sortable") (data-todokey ,num-todos))
|
||||
(thead
|
||||
(tr
|
||||
(th 'nbsp)
|
||||
(th "Package")
|
||||
(th "Description")
|
||||
(th "Build")))
|
||||
(th "Build")
|
||||
(th ((style "display: none")) 'nbsp))) ;; todokey
|
||||
(tbody
|
||||
,@(maybe-splice (null? package-names)
|
||||
`(tr (td ((colspan "4"))
|
||||
(div ((class "alert alert-info"))
|
||||
"No packages found."))))
|
||||
,@(for/list ((pkg (package-batch-detail package-names)))
|
||||
`(tr
|
||||
(td (span ((class "last-updated-negated") (style "display: none"))
|
||||
,(~a (- (package-last-updated pkg))))
|
||||
,@(maybe-splice
|
||||
(< (- now (package-last-updated pkg)) recent-seconds)
|
||||
`(span ((class "label label-info")) "New")))
|
||||
(td (h2 ,(package-link (package-name pkg)))
|
||||
,(authors-list (package-authors pkg)))
|
||||
(td (p ,(package-description pkg))
|
||||
,@(maybe-splice
|
||||
(or (pair? (package-docs pkg)) (package-readme-url pkg))
|
||||
`(div
|
||||
(span ((class "doctags-label")) "Docs: ")
|
||||
,(doc-links (package-docs pkg))
|
||||
,@(maybe-splice (package-readme-url pkg)
|
||||
" "
|
||||
`(a ((href ,(package-readme-url pkg)))
|
||||
"README"))
|
||||
))
|
||||
,@(maybe-splice
|
||||
(pair? (package-tags pkg))
|
||||
`(div
|
||||
(span ((class "doctags-label")) "Tags: ")
|
||||
,(tag-links (package-tags pkg)))))
|
||||
,(build-status-td pkg))))))
|
||||
,@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
|
||||
((data-todokey ,todokey))
|
||||
(td (span ((class "last-updated-negated") (style "display: none"))
|
||||
,(~a (- (package-last-updated pkg))))
|
||||
,@(maybe-splice
|
||||
(< (- now (package-last-updated pkg)) recent-seconds)
|
||||
`(span ((class "label label-info")) "New")))
|
||||
(td (h2 ,(package-link (package-name pkg)))
|
||||
,(authors-list (package-authors pkg)))
|
||||
(td (p ,(package-description pkg))
|
||||
,@(maybe-splice
|
||||
(or has-docs? has-readme?)
|
||||
`(div
|
||||
(span ((class "doctags-label")) "Docs: ")
|
||||
,(doc-links (package-docs pkg))
|
||||
,@(maybe-splice has-readme?
|
||||
" "
|
||||
`(a ((href ,(package-readme-url pkg)))
|
||||
"README"))))
|
||||
,@(maybe-splice
|
||||
has-tags?
|
||||
`(div
|
||||
(span ((class "doctags-label")) "Tags: ")
|
||||
,(tag-links (package-tags 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)
|
||||
;; Build the index page cell for summarizing a package's build status.
|
||||
|
@ -660,6 +686,7 @@
|
|||
(match-define (list u p l) e)
|
||||
(if u `(span ,p ,(buildhost-link u l)) `(span)))))
|
||||
|
||||
|
||||
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
||||
|
||||
(define (main-page request)
|
||||
|
@ -700,6 +727,7 @@
|
|||
,(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\")"))
|
||||
(p ((class "package-count") (id "todo-msg")) "") ;; filled in by client-side JS.
|
||||
,(package-summary-table package-name-list))
|
||||
`(div ((class "jumbotron"))
|
||||
(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