From e2aa79e86fb713cd42dadb9b40db7de2fffcc1c4 Mon Sep 17 00:00:00 2001 From: Giovanni Harting <539@idlegandalf.com> Date: Sun, 21 Nov 2021 18:27:03 +0100 Subject: [PATCH] better dark mode --- config_dist.yaml | 10 ++++++++++ main.go | 2 +- tpl/packages.html | 51 +++++++++++++++-------------------------------- utils.go | 24 ++++++++++++++++++++++ 4 files changed, 51 insertions(+), 36 deletions(-) diff --git a/config_dist.yaml b/config_dist.yaml index 627e514..8bd3a03 100644 --- a/config_dist.yaml +++ b/config_dist.yaml @@ -35,6 +35,16 @@ blacklist: - llvm - rust +status: + class: + skipped: "secondary" + queued: "warning" + latest: "primary" + failed: "danger" + signing: "success" + building: "info" + unknown: "dark" + build: worker: 4 makej: 8 diff --git a/main.go b/main.go index 222063a..70bb51b 100644 --- a/main.go +++ b/main.go @@ -348,7 +348,7 @@ func (b *BuildManager) htmlWorker() { addPkg := Pkg{ Pkgbase: pkg.Pkgbase, Status: strings.ToUpper(pkg.Status.String()), - Class: pkg.Status.String(), + Class: statusId2string(pkg.Status), Skip: pkg.SkipReason, Version: pkg.RepoVersion, Svn2GitVersion: pkg.Version, diff --git a/tpl/packages.html b/tpl/packages.html index 7a12300..a580e04 100644 --- a/tpl/packages.html +++ b/tpl/packages.html @@ -7,41 +7,22 @@ ALHP Status - + + + + + - + -
+
{{range $march := .March}}

{{$march.Name}}

{{range $repo := $march.Repos}} -
+

- + @@ -91,19 +72,19 @@ {{range $pkg := $repo.Packages}} - - -
Pkgbase Status
{{$pkg.Pkgbase}} {{$pkg.Status}} {{$pkg.Skip}} + {{if $pkg.LTO}}{{end}} {{if $pkg.LTODisabled}}{{end}} {{if $pkg.LTOUnknown}}{{end}} {{$pkg.Svn2GitVersion}} {{$pkg.Version}} + {{with $pkg.Log}}{{end}} diff --git a/utils.go b/utils.go index 607bd32..2666faf 100644 --- a/utils.go +++ b/utils.go @@ -90,6 +90,11 @@ type Conf struct { Housekeeping struct { Interval string } + Status struct { + Class struct { + Skipped, Queued, Latest, Failed, Signing, Building, Unknown string + } + } } type Globs []string @@ -112,6 +117,25 @@ func updateLastUpdated() { check(os.WriteFile(filepath.Join(conf.Basedir.Repo, lastUpdate), []byte(strconv.FormatInt(time.Now().Unix(), 10)), 0644)) } +func statusId2string(s dbpackage.Status) string { + switch s { + case dbpackage.StatusSkipped: + return conf.Status.Class.Skipped + case dbpackage.StatusQueued: + return conf.Status.Class.Queued + case dbpackage.StatusLatest: + return conf.Status.Class.Latest + case dbpackage.StatusFailed: + return conf.Status.Class.Failed + case dbpackage.StatusSigning: + return conf.Status.Class.Signing + case dbpackage.StatusBuilding: + return conf.Status.Class.Building + default: + return conf.Status.Class.Unknown + } +} + func b3sum(filePath string) (string, error) { file, err := os.Open(filePath) if err != nil {