cmd/coordinator: more UI tweaks

Change-Id: I65c5a200d8d28f84159e3f976ede1f17dc9dc872
Reviewed-on: https://go-review.googlesource.com/22827
Reviewed-by: Andrew Gerrand <adg@golang.org>
This commit is contained in:
Brad Fitzpatrick 2016-05-05 20:46:24 +00:00
Родитель 6417ab41e1
Коммит 72e4404a40
2 изменённых файлов: 30 добавлений и 17 удалений

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

@ -2757,21 +2757,27 @@ func (st *buildStatus) htmlStatusLine(full bool) template.HTML {
ts.ChangeTriple(), ts.ChangeID[:8])
}
var state string
if st.done.IsZero() {
buf.WriteString(", running")
state = "running"
} else if st.succeeded {
buf.WriteString(", succeeded")
state = "succeeded"
} else {
buf.WriteString(", failed")
state = "<font color='#700000'>failed</font>"
}
if full {
fmt.Fprintf(&buf, "; <a href='%s'>%s</a>; %s", st.logsURLLocked(), state, html.EscapeString(st.bc.String()))
} else {
fmt.Fprintf(&buf, "; <a href='%s'>%s</a>", st.logsURLLocked(), state)
}
fmt.Fprintf(&buf, "; <a href='%s'>build log</a>; %s", st.logsURLLocked(), html.EscapeString(st.bc.String()))
t := st.done
if t.IsZero() {
t = st.startTime
}
fmt.Fprintf(&buf, ", %v ago\n", time.Since(t))
fmt.Fprintf(&buf, ", %v ago", time.Since(t))
if full {
buf.WriteByte('\n')
st.writeEventsLocked(&buf, true)
}
return template.HTML(buf.String())

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

@ -58,7 +58,11 @@ func handleStatus(w http.ResponseWriter, r *http.Request) {
if errTryDeps != nil {
data.TrybotsErr = errTryDeps.Error()
} else {
data.Trybots = template.HTML(buf.String())
if buf.Len() == 0 {
data.Trybots = template.HTML("<i>(none)</i>")
} else {
data.Trybots = template.HTML("<pre>" + buf.String() + "</pre>")
}
}
buf.Reset()
@ -119,35 +123,38 @@ var statusTmpl = template.Must(template.New("status").Parse(`
<h2>Running</h2>
<p>{{printf "%d" .Total}} total builds active. Uptime {{printf "%s" .Uptime}}. Version {{.Version}}.
<h2 id=trybots>Trybot state</h2><pre>
{{if .TrybotsErr}}<b>trybots disabled:</b>: {{.TrybotsErr}}{{else}}{{.Trybots}}{{end}}
</pre>
<h2 id=trybots><a href='#trybots'>🔗</a> Active Trybot Runs</h2>
{{- if .TrybotsErr}}
<b>trybots disabled:</b>: {{.TrybotsErr}}
{{else}}
{{.Trybots}}
{{end}}
<h2 id=pools>Buildlet pools</h2>
<h2 id=remote><a href='#remote'>🔗</a> Remote buildlets</h3>
{{.RemoteBuildlets}}
<h2 id=pools><a href='#pools'>🔗</a> Buildlet pools</h2>
<ul>
<li>{{.GCEPoolStatus}}</li>
<li>{{.KubePoolStatus}}</li>
<li>{{.ReversePoolStatus}}</li>
</ul>
<h2 id=remote>Remote buildlets</h3>
{{.RemoteBuildlets}}
<h2 id=active>Active builds</h2>
<h2 id=active><a href='#active'>🔗</a> Active builds</h2>
<ul>
{{range .Active}}
<li><pre>{{.HTMLStatusLine}}</pre></li>
{{end}}
</ul>
<h2 id=completed>Recently completed</h2>
<h2 id=completed><a href='#completed'>🔗</a> Recently completed</h2>
<ul>
{{range .Recent}}
<li><pre>{{.HTMLStatusLine_done}}</pre></li>
<li><span>{{.HTMLStatusLine_done}}</span></li>
{{end}}
</ul>
<h2 id=disk>Disk Space</h2>
<h2 id=disk><a href='#disk'>🔗</a> Disk Space</h2>
<pre>{{.DiskFree}}</pre>
</body>