forked from ALHP/ALHP.GO
added package(-base) stats to footer
This commit is contained in:
21
main.go
21
main.go
@@ -337,6 +337,9 @@ func (b *BuildManager) htmlWorker() {
|
|||||||
type tpl struct {
|
type tpl struct {
|
||||||
March []March
|
March []March
|
||||||
Generated string
|
Generated string
|
||||||
|
Latest int
|
||||||
|
Failed int
|
||||||
|
Skipped int
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@@ -401,6 +404,24 @@ func (b *BuildManager) htmlWorker() {
|
|||||||
|
|
||||||
gen.Generated = time.Now().UTC().Format(time.RFC1123)
|
gen.Generated = time.Now().UTC().Format(time.RFC1123)
|
||||||
|
|
||||||
|
var v []struct {
|
||||||
|
Status dbpackage.Status `json:"status"`
|
||||||
|
Count int `json:"count"`
|
||||||
|
}
|
||||||
|
|
||||||
|
db.DbPackage.Query().GroupBy(dbpackage.FieldStatus).Aggregate(ent.Count()).ScanX(context.Background(), &v)
|
||||||
|
|
||||||
|
for _, c := range v {
|
||||||
|
switch c.Status {
|
||||||
|
case dbpackage.StatusFailed:
|
||||||
|
gen.Failed = c.Count
|
||||||
|
case dbpackage.StatusSkipped:
|
||||||
|
gen.Skipped = c.Count
|
||||||
|
case dbpackage.StatusLatest:
|
||||||
|
gen.Latest = c.Count
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
statusTpl, err := template.ParseFiles("tpl/packages.html")
|
statusTpl, err := template.ParseFiles("tpl/packages.html")
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
|
@@ -109,9 +109,11 @@
|
|||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<footer class="text-center text-lg-start bg-dark text-muted mt-3 fixed-bottom">
|
<footer class="text-center text-lg-start bg-dark mt-3 fixed-bottom">
|
||||||
<div class="text-center p-2" style="background-color: rgba(0, 0, 0, 0.05)">
|
<div class="p-2 text-center">
|
||||||
{{.Generated}}
|
{{.Latest}} <span class="text-primary">build</span> {{.Skipped}} <span
|
||||||
|
class="text-secondary">skipped</span> {{.Failed}} <span class="text-danger">failed</span> || <span
|
||||||
|
class="text-muted">{{.Generated}}</span>
|
||||||
</div>
|
</div>
|
||||||
</footer>
|
</footer>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user