added navbar and footer to statuspage; fixed not able to create database

This commit is contained in:
2021-07-14 19:21:58 +02:00
parent f5f57bd3ef
commit 4b74fe7999
2 changed files with 30 additions and 7 deletions

16
main.go
View File

@@ -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),