worker: minor improvements to main page

Move experiment section to bottom (it is relatively uninteresting).

Sort requests by age.

Change-Id: I7c0df9a9bfa4baa7b2960c5008c2e9ebc6a9d6ab
Reviewed-on: https://go-review.googlesource.com/c/pkgsite/+/568240
kokoro-CI: kokoro <noreply+kokoro@google.com>
LUCI-TryBot-Result: Go LUCI <golang-scoped@luci-project-accounts.iam.gserviceaccount.com>
Reviewed-by: Michael Matloob <matloob@golang.org>
This commit is contained in:
Jonathan Amsterdam 2024-03-01 16:08:31 -05:00
Родитель acdeec62f9
Коммит ea43129276
2 изменённых файлов: 32 добавлений и 31 удалений

Просмотреть файл

@ -7,6 +7,7 @@ package middleware
import (
"context"
"net/http"
"sort"
"sync"
"golang.org/x/pkgsite/internal"
@ -48,7 +49,7 @@ func RequestInfo() Middleware {
}
// ActiveRequests returns all requests that are currently being handled by the server,
// in no particular order.
// sorted by start time.
func ActiveRequests() []*internal.RequestInfo {
requestMapMu.Lock()
defer requestMapMu.Unlock()
@ -56,6 +57,7 @@ func ActiveRequests() []*internal.RequestInfo {
for _, ri := range requestMap {
ris = append(ris, ri)
}
sort.Slice(ris, func(i, j int) bool { return ris[i].Start.Before(ris[j].Start) })
return ris
}

Просмотреть файл

@ -80,36 +80,7 @@
</table>
</div>
<div class="Experiments">
<h3>Experiments</h3>
{{if .Experiments}}
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Rollout</th>
</tr>
</thead>
<tbody>
{{range .Experiments}}
<tr>
<td>{{.Name}}</td>
<td>{{.Description}}</td>
<td>{{.Rollout}}</td>
</tr>
{{end}}
</tbody>
</table>
<p>To update experiments, modify the {{.Env}}-config.yaml file and deploy with
the <code>-config-only</code> flag.</p>
{{else}}
<p>No experiments.</p>
{{end}}
<iframe class="Experiments-updateResult" name="experimentUpdateResult" id="experimentUpdateResult"></iframe>
</div>
<div>
<div>
<h3>Memory (all values in Mi)</h3>
<table>
<tr>
@ -215,6 +186,34 @@
</table>
</div>
<div class="Experiments">
<h3>Experiments</h3>
{{if .Experiments}}
<table>
<thead>
<tr>
<th>Name</th>
<th>Description</th>
<th>Rollout</th>
</tr>
</thead>
<tbody>
{{range .Experiments}}
<tr>
<td>{{.Name}}</td>
<td>{{.Description}}</td>
<td>{{.Rollout}}</td>
</tr>
{{end}}
</tbody>
</table>
<p>To update experiments, modify the {{.Env}}-config.yaml file and deploy with
the <code>-config-only</code> flag.</p>
{{else}}
<p>No experiments.</p>
{{end}}
<iframe class="Experiments-updateResult" name="experimentUpdateResult" id="experimentUpdateResult"></iframe>
</div>
</body>