forked from ALHP/ALHP.GO
added navbar and footer to statuspage; fixed not able to create database
This commit is contained in:
16
main.go
16
main.go
@@ -640,6 +640,7 @@ func (b *BuildManager) htmlWorker() {
|
||||
BuildDate string
|
||||
BuildDuration time.Duration
|
||||
Checked string
|
||||
Log string
|
||||
}
|
||||
|
||||
type Repo struct {
|
||||
@@ -653,7 +654,8 @@ func (b *BuildManager) htmlWorker() {
|
||||
}
|
||||
|
||||
type tpl struct {
|
||||
March []March
|
||||
March []March
|
||||
Generated time.Time
|
||||
}
|
||||
|
||||
for {
|
||||
@@ -699,6 +701,10 @@ func (b *BuildManager) htmlWorker() {
|
||||
addPkg.Checked = pkg.Updated.UTC().Format(time.RFC3339)
|
||||
}
|
||||
|
||||
if pkg.Status == FAILED {
|
||||
addPkg.Log = fmt.Sprintf("logs/%s.log", pkg.Pkgbase)
|
||||
}
|
||||
|
||||
addRepo.Packages = append(addRepo.Packages, addPkg)
|
||||
}
|
||||
addMarch.Repos = append(addMarch.Repos, addRepo)
|
||||
@@ -706,6 +712,8 @@ func (b *BuildManager) htmlWorker() {
|
||||
gen.March = append(gen.March, addMarch)
|
||||
}
|
||||
|
||||
gen.Generated = time.Now().UTC()
|
||||
|
||||
statusTpl, err := template.ParseFiles("tpl/status.html")
|
||||
check(err)
|
||||
|
||||
@@ -899,6 +907,9 @@ func main() {
|
||||
log.Warningf("Failed to drop priority: %v", err)
|
||||
}
|
||||
|
||||
err = os.MkdirAll(conf.Basedir.Repo, os.ModePerm)
|
||||
check(err)
|
||||
|
||||
db, err = ent.Open("sqlite3", "file:"+conf.Basedir.Db+"?_fk=1&cache=shared")
|
||||
if err != nil {
|
||||
log.Panicf("Failed to open database %s: %v", conf.Basedir.Db, err)
|
||||
@@ -911,9 +922,6 @@ func main() {
|
||||
log.Panicf("Automigrate failed: %v", err)
|
||||
}
|
||||
|
||||
err = os.MkdirAll(conf.Basedir.Repo, os.ModePerm)
|
||||
check(err)
|
||||
|
||||
buildManager = BuildManager{
|
||||
build: make(chan *BuildPackage, 10000),
|
||||
parse: make(chan *BuildPackage, 10000),
|
||||
|
@@ -13,6 +13,12 @@
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<nav class="navbar navbar-light bg-info mb-3">
|
||||
<div class="container-fluid">
|
||||
<span class="navbar-brand mb-0 h1">ALHP Status</span>
|
||||
</div>
|
||||
</nav>
|
||||
|
||||
<div class="container">
|
||||
{{range $march := .March}}<h3>{{$march.Name}}</h3>
|
||||
<div class="accordion" id="accordion-{{$march.Name}}">
|
||||
@@ -26,7 +32,8 @@
|
||||
{{$repo.Name}}-{{$march.Name}}
|
||||
</button>
|
||||
</h2>
|
||||
<div aria-labelledby="heading-{{$march.Name}}-{{$repo.Name}}" class="accordion-collapse collapse show"
|
||||
<div aria-labelledby="heading-{{$march.Name}}-{{$repo.Name}}"
|
||||
class="accordion-collapse collapse show"
|
||||
data-bs-parent="#accordion-{{$march.Name}}" id="collapse-{{$march.Name}}-{{$repo.Name}}">
|
||||
<div class="accordion-body">
|
||||
<table class="table">
|
||||
@@ -48,9 +55,11 @@
|
||||
<td>{{$pkg.Skip}}</td>
|
||||
<td>{{$pkg.Svn2GitVersion}}</td>
|
||||
<td>{{$pkg.Version}}</td>
|
||||
<td><a data-bs-html="true" data-bs-placement="bottom" data-bs-toggle="tooltip" href="#"
|
||||
<td class="text-center">
|
||||
{{with $pkg.Log}}<a href="{{.}}"><i class="bi bi-file-text-fill"></i></a>{{end}}
|
||||
<a data-bs-html="true" data-bs-placement="bottom" data-bs-toggle="tooltip" href="#"
|
||||
title="{{if $pkg.BuildDate}}Build Date: {{$pkg.BuildDate}} {{end}}{{if $pkg.BuildDuration}}Build Duration: {{$pkg.BuildDuration}} {{end}}Check date: {{$pkg.Checked}}">
|
||||
<i class="bi bi-info-circle-fill"></i></a></td>
|
||||
<i class="bi bi-info-circle-fill"></i></a></td>
|
||||
</tr>
|
||||
{{end}}
|
||||
</tbody>
|
||||
@@ -63,6 +72,12 @@
|
||||
{{end}}
|
||||
</div>
|
||||
|
||||
<footer class="text-center text-lg-start bg-dark text-muted mt-3">
|
||||
<div class="text-center p-4" style="background-color: rgba(0, 0, 0, 0.05);">
|
||||
Generated: {{.Generated}}
|
||||
</div>
|
||||
</footer>
|
||||
|
||||
<script crossorigin="anonymous"
|
||||
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
|
||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||
|
Reference in New Issue
Block a user