1
0
forked from ALHP/ALHP.GO

added package(-base) stats to footer

This commit is contained in:
2021-11-23 22:04:50 +01:00
parent d70b523aa9
commit cd4cdadb66
3 changed files with 26 additions and 5 deletions

21
main.go
View File

@@ -337,6 +337,9 @@ func (b *BuildManager) htmlWorker() {
type tpl struct {
March []March
Generated string
Latest int
Failed int
Skipped int
}
for {
@@ -401,6 +404,24 @@ func (b *BuildManager) htmlWorker() {
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")
check(err)

View File

@@ -109,9 +109,11 @@
{{end}}
</div>
<footer class="text-center text-lg-start bg-dark text-muted mt-3 fixed-bottom">
<div class="text-center p-2" style="background-color: rgba(0, 0, 0, 0.05)">
{{.Generated}}
<footer class="text-center text-lg-start bg-dark mt-3 fixed-bottom">
<div class="p-2 text-center">
{{.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>
</footer>

View File

@@ -322,8 +322,6 @@ func (p *BuildPackage) prepareKernelPatches() error {
return err
}
log.Debug(newPKGBUILD)
return nil
}