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
|
BuildDate string
|
||||||
BuildDuration time.Duration
|
BuildDuration time.Duration
|
||||||
Checked string
|
Checked string
|
||||||
|
Log string
|
||||||
}
|
}
|
||||||
|
|
||||||
type Repo struct {
|
type Repo struct {
|
||||||
@@ -653,7 +654,8 @@ func (b *BuildManager) htmlWorker() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type tpl struct {
|
type tpl struct {
|
||||||
March []March
|
March []March
|
||||||
|
Generated time.Time
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
@@ -699,6 +701,10 @@ func (b *BuildManager) htmlWorker() {
|
|||||||
addPkg.Checked = pkg.Updated.UTC().Format(time.RFC3339)
|
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)
|
addRepo.Packages = append(addRepo.Packages, addPkg)
|
||||||
}
|
}
|
||||||
addMarch.Repos = append(addMarch.Repos, addRepo)
|
addMarch.Repos = append(addMarch.Repos, addRepo)
|
||||||
@@ -706,6 +712,8 @@ func (b *BuildManager) htmlWorker() {
|
|||||||
gen.March = append(gen.March, addMarch)
|
gen.March = append(gen.March, addMarch)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gen.Generated = time.Now().UTC()
|
||||||
|
|
||||||
statusTpl, err := template.ParseFiles("tpl/status.html")
|
statusTpl, err := template.ParseFiles("tpl/status.html")
|
||||||
check(err)
|
check(err)
|
||||||
|
|
||||||
@@ -899,6 +907,9 @@ func main() {
|
|||||||
log.Warningf("Failed to drop priority: %v", err)
|
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")
|
db, err = ent.Open("sqlite3", "file:"+conf.Basedir.Db+"?_fk=1&cache=shared")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicf("Failed to open database %s: %v", conf.Basedir.Db, err)
|
log.Panicf("Failed to open database %s: %v", conf.Basedir.Db, err)
|
||||||
@@ -911,9 +922,6 @@ func main() {
|
|||||||
log.Panicf("Automigrate failed: %v", err)
|
log.Panicf("Automigrate failed: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = os.MkdirAll(conf.Basedir.Repo, os.ModePerm)
|
|
||||||
check(err)
|
|
||||||
|
|
||||||
buildManager = BuildManager{
|
buildManager = BuildManager{
|
||||||
build: make(chan *BuildPackage, 10000),
|
build: make(chan *BuildPackage, 10000),
|
||||||
parse: make(chan *BuildPackage, 10000),
|
parse: make(chan *BuildPackage, 10000),
|
||||||
|
@@ -13,6 +13,12 @@
|
|||||||
</head>
|
</head>
|
||||||
<body>
|
<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">
|
<div class="container">
|
||||||
{{range $march := .March}}<h3>{{$march.Name}}</h3>
|
{{range $march := .March}}<h3>{{$march.Name}}</h3>
|
||||||
<div class="accordion" id="accordion-{{$march.Name}}">
|
<div class="accordion" id="accordion-{{$march.Name}}">
|
||||||
@@ -26,7 +32,8 @@
|
|||||||
{{$repo.Name}}-{{$march.Name}}
|
{{$repo.Name}}-{{$march.Name}}
|
||||||
</button>
|
</button>
|
||||||
</h2>
|
</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}}">
|
data-bs-parent="#accordion-{{$march.Name}}" id="collapse-{{$march.Name}}-{{$repo.Name}}">
|
||||||
<div class="accordion-body">
|
<div class="accordion-body">
|
||||||
<table class="table">
|
<table class="table">
|
||||||
@@ -48,9 +55,11 @@
|
|||||||
<td>{{$pkg.Skip}}</td>
|
<td>{{$pkg.Skip}}</td>
|
||||||
<td>{{$pkg.Svn2GitVersion}}</td>
|
<td>{{$pkg.Svn2GitVersion}}</td>
|
||||||
<td>{{$pkg.Version}}</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}}">
|
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>
|
</tr>
|
||||||
{{end}}
|
{{end}}
|
||||||
</tbody>
|
</tbody>
|
||||||
@@ -63,6 +72,12 @@
|
|||||||
{{end}}
|
{{end}}
|
||||||
</div>
|
</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"
|
<script crossorigin="anonymous"
|
||||||
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
|
integrity="sha384-MrcW6ZMFYlzcLA8Nl+NtUVF0sA7MsXsP1UyJoMp4YLEuNSfAP+JcXn/tWtIaxVXM"
|
||||||
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
|
src="https://cdn.jsdelivr.net/npm/bootstrap@5.0.2/dist/js/bootstrap.bundle.min.js"></script>
|
||||||
|
Reference in New Issue
Block a user