Add some bars to the table on the branch package versions page

To provide a more visual view of when the package versions were available.
This commit is contained in:
Christopher Baines 2019-09-27 17:29:33 +01:00
parent 59c342ffde
commit 00ac080297

View file

@ -1122,13 +1122,30 @@
(th (@ (class "col-sm-4")) "From")
(th (@ (class "col-sm-4")) "To")))
(tbody
,@(map
,@(let* ((times-in-seconds
(map (lambda (d)
(time-second
(date->time-monotonic
(string->date d "~Y-~m-~d ~H:~M:~S"))))
(append (map third versions-by-revision-range)
(map fifth versions-by-revision-range))))
(earliest-date-seconds
(apply min
times-in-seconds))
(latest-date-seconds
(apply max
times-in-seconds))
(min-to-max-seconds
(- latest-date-seconds
earliest-date-seconds)))
(map
(match-lambda
((package-version first-guix-revision-commit
first-datetime
last-guix-revision-commit
last-datetime)
`(tr
`((tr
(@ (style "border-bottom: 0;"))
(td ,package-version)
(td (a (@ (href ,(string-append
"/revision/" first-guix-revision-commit)))
@ -1149,8 +1166,43 @@
last-guix-revision-commit
"/package/"
package-name "/" package-version)))
"(More information)")))))
versions-by-revision-range)))))))))
"(More information)")))
(tr
(td
(@ (colspan 3)
(style "border-top: 0; padding-top: 0;"))
(div
(@
(style
,(let* ((start-seconds
(time-second
(date->time-monotonic
(string->date first-datetime
"~Y-~m-~d ~H:~M:~S"))))
(end-seconds
(time-second
(date->time-monotonic
(string->date last-datetime
"~Y-~m-~d ~H:~M:~S"))))
(margin-left
(min
(* (/ (- start-seconds earliest-date-seconds)
min-to-max-seconds)
100)
98))
(width
(max
(- (* (/ (- end-seconds earliest-date-seconds)
min-to-max-seconds)
100)
margin-left)
2)))
(simple-format
#f
"margin-left: ~A%; width: ~A%; height: 10px; background: #DCDCDC;"
(rationalize margin-left 1)
(rationalize width 1)))))))))))
versions-by-revision-range))))))))))
(define (view-builds stats builds)
(layout