better dark mode

This commit is contained in:
2021-11-21 18:27:03 +01:00
parent 27359c91aa
commit e2aa79e86f
4 changed files with 51 additions and 36 deletions

View File

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

View File

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

View File

@@ -7,41 +7,22 @@
<title>ALHP Status</title>
<!-- Bootstrap CSS -->
<link crossorigin="anonymous" href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.0/dist/css/bootstrap.min.css"
integrity="sha384-KyZXEAg3QhqLMpG8r+8fhAXLRk2vvoC2f3B09zVXn8CA5QIVfZOJ3BCsw2P0p/We" rel="stylesheet"/>
<!-- The page supports both dark and light color schemes,
and the page author prefers / default is light. -->
<meta content="dark light" name="color-scheme">
<!-- Replace the Bootstrap CSS with the
Bootstrap-Dark Variant CSS -->
<link href="https://cdn.jsdelivr.net/npm/bootstrap-dark-5@1.1.3/dist/css/bootstrap-dark.min.css" rel="stylesheet">
<link href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.5.0/font/bootstrap-icons.css" rel="stylesheet"/>
<style>
.accordion:last-child {
padding-bottom: 8vh;
}
.table-latest {
--bs-table-bg: #172322;
}
.table-skipped {
--bs-table-bg: #2d2d2d;
}
.table-failed {
--bs-table-bg: #412323;
}
.table-queued {
--bs-table-bg: #8f833a;
}
.table-building {
--bs-table-bg: #375e9d;
}
.table-unknown {
--bs-table-bg: #969696;
}
</style>
</head>
<body class="bg-dark">
<body>
<nav class="navbar navbar-expand-lg sticky-top navbar-light bg-info mb-5">
<div class="container">
<div class="d-flex justify-content-start">
@@ -59,26 +40,26 @@
</div>
</nav>
<div class="container text-light">
<div class="container">
{{range $march := .March}}
<h3>{{$march.Name}}</h3>
<div class="accordion" id="accordion-{{$march.Name}}">
{{range $repo := $march.Repos}}
<div class="accordion-item bg-dark bg-opacity-25 border-light">
<div class="accordion-item bg-opacity-25">
<h2 class="accordion-header" id="heading-{{$march.Name}}-{{$repo.Name}}">
<button aria-controls="collapse-{{$march.Name}}-{{$repo.Name}}" aria-expanded="false"
class="accordion-button bg-opacity-50 bg-dark text-light border-light"
class="accordion-button"
data-bs-target="#collapse-{{$march.Name}}-{{$repo.Name}}"
data-bs-toggle="collapse"
type="button">{{$repo.Name}}-{{$march.Name}}
</button>
</h2>
<div aria-labelledby="heading-{{$march.Name}}-{{$repo.Name}}"
class="accordion-collapse collapse show border-light"
class="accordion-collapse collapse show"
data-bs-parent="#accordion-{{$march.Name}}" id="collapse-{{$march.Name}}-{{$repo.Name}}">
<div class="accordion-body overflow-auto">
<table class="table table-sorted">
<thead class="text-light">
<thead>
<tr>
<th scope="col">Pkgbase</th>
<th scope="col">Status</th>
@@ -91,19 +72,19 @@
</thead>
<tbody>
{{range $pkg := $repo.Packages}}
<tr class="table-dark table-{{$pkg.Class}}"
<tr class="table-{{$pkg.Class}}"
id="{{$repo.Name}}-{{$march.Name}}-{{$pkg.Pkgbase}}">
<td>{{$pkg.Pkgbase}}</td>
<td>{{$pkg.Status}}</td>
<td>{{$pkg.Skip}}</td>
<td class="text-center text-light">
<td class="text-center">
{{if $pkg.LTO}}<i class="bi bi-check-lg" title="build with LTO"></i>{{end}}
{{if $pkg.LTODisabled}}<i class="bi bi-x-lg" title="LTO explicit disabled"></i>{{end}}
{{if $pkg.LTOUnknown}}<i class="bi bi-hourglass" title="not build with LTO yet"></i>{{end}}
</td>
<td>{{$pkg.Svn2GitVersion}}</td>
<td>{{$pkg.Version}}</td>
<td class="text-end text-light">
<td class="text-end">
{{with $pkg.Log}}<a href="{{.}}"
><i class="bi bi-file-text-fill"></i></a
>{{end}}

View File

@@ -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 {