Skip to content

Commit 2cf5c44

Browse files
committed
cmd/coordinator: link "ok" results to build logs
Every now and then, it's highly desirable to be able to view build logs for a build even if it was successful. Those logs are kept as of CL 198197, but they just haven't been linked. At long last, add those links to the build dashboard(s)! 🎉 Keep the visual style of "ok" cells the same, aside that the mouse cursor becomes a hand with an index finger, rather than a text caret. This means this feature isn't very discoverable, but we can address that in the future. (I've experimented with giving the "ok" links an underline, but even a faint underline quickly leads to a large amount of overwhelming visual noise when there are hundreds of "ok" cells on many pages.) Apply the same change to the work-in-progress dashboard V2 page, to keep it in sync. (There are additional CSS changes to make it look more consistent with the current build.golang.org dashboard.) For golang/go#34119. Updates golang/go#34744. Change-Id: I27530e4103bbfd10e8cf09ae1a1cfce06c9bd748 Reviewed-on: https://go-review.googlesource.com/c/build/+/340435 Run-TryBot: Dmitri Shuralyov <[email protected]> TryBot-Result: Go Bot <[email protected]> Trust: Dmitri Shuralyov <[email protected]> Reviewed-by: Alexander Rakoczy <[email protected]>
1 parent db6862c commit 2cf5c44

File tree

5 files changed

+37
-6
lines changed

5 files changed

+37
-6
lines changed

cmd/coordinator/internal/dashboard/dashboard.html

+5-2
Original file line numberDiff line numberDiff line change
@@ -150,9 +150,12 @@ <h2 class="Dashboard-packageName">{{$.Package.Name}}</h2>
150150
<td class="Build-desc desc" title="{{$c.Desc}}">{{$c.Desc}}</td>
151151
{{range $b := $.Builders}}
152152
{{range $a := .Archs}}
153-
<td class="{{if not $a.FirstClass}} unsupported{{end}}" data-builder="{{$a.Name}}">
153+
<td class="Build-result {{if not $a.FirstClass}} unsupported{{end}}" data-builder="{{$a.Name}}">
154154
{{with $c.ResultForBuilder $a.Name}}
155-
{{if .OK}} ok {{end}}
155+
{{if .OK}}
156+
<a class="Build-resultOK" href="https://build.golang.org/log/{{.LogHash}}"
157+
title="Build log of {{$a.Name}} on commit {{shortHash $c.Hash}}.">ok</a>
158+
{{end}}
156159
{{end}}
157160
</td>
158161
{{end}}

cmd/coordinator/internal/dashboard/handler.go

+11-1
Original file line numberDiff line numberDiff line change
@@ -290,11 +290,21 @@ func formatGitAuthor(name, email string) string {
290290
}
291291

292292
var templ = template.Must(
293-
template.New("dashboard.html").ParseFiles(
293+
template.New("dashboard.html").Funcs(template.FuncMap{
294+
"shortHash": shortHash,
295+
}).ParseFiles(
294296
internal.FilePath("dashboard.html", "internal/dashboard", "cmd/coordinator/internal/dashboard"),
295297
),
296298
)
297299

300+
// shortHash returns a short version of a hash.
301+
func shortHash(hash string) string {
302+
if len(hash) > 7 {
303+
hash = hash[:7]
304+
}
305+
return hash
306+
}
307+
298308
// A Commit describes an individual commit in a package.
299309
//
300310
// Each Commit entity is a descendant of its associated Package entity.

cmd/coordinator/internal/legacydash/static/style.css

+4
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ table thead tr {
203203
.build .ok {
204204
font-size: 83%;
205205
}
206+
.build a.ok {
207+
color: #000;
208+
text-decoration: none;
209+
}
206210

207211
.build .desc, .build .time, .build .user {
208212
white-space: nowrap;

cmd/coordinator/internal/legacydash/ui.html

+4-2
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,8 @@ <h1>
133133
{{if .BuildingURL}}
134134
<a href="{{.BuildingURL}}"><img src="https://golang.org/favicon.ico" height=16 width=16 border=0></a>
135135
{{else if .OK}}
136-
<span class="ok{{if knownIssue $builderName}} noise{{end}}">ok</span>
136+
<a href="/log/{{.LogHash}}" class="ok{{if knownIssue $builderName}} noise{{end}}"
137+
title="Build log of {{$builderName}} on commit {{shortHash $c.Hash}}{{with $h}} (using Go commit {{shortHash .}}){{end}}.">ok</a>
137138
{{else if knownIssue $builderName}}
138139
<a href="/log/{{.LogHash}}" class="noise" title="Builder {{$builderName}} has a known issue. See golang.org/issue/{{knownIssue $builderName}}.">fail</a>
139140
{{else}}
@@ -237,7 +238,8 @@ <h2>
237238
{{if .BuildingURL}}
238239
<a href="{{.BuildingURL}}"><img src="https://golang.org/favicon.ico" height=16 width=16 border=0></a>
239240
{{else if .OK}}
240-
<span class="ok">ok</span>
241+
<a href="/log/{{.LogHash}}" class="ok"
242+
title="Build log of {{$builderName}} on commit {{shortHash $h}} (using Go commit {{shortHash $goHash}}).">ok</a>
241243
{{else}}
242244
<a href="/log/{{.LogHash}}" class="fail">fail</a>
243245
{{end}}

cmd/coordinator/style.css

+13-1
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,9 @@ table thead tr {
111111
table.Build tbody tr:nth-child(even) {
112112
background-color: #f4f4f4;
113113
}
114+
table.Build tbody tr.commit:hover {
115+
background-color: #ffff99;
116+
}
114117
.ShortHash {
115118
display: inline-block;
116119
font-family: monospace;
@@ -151,6 +154,7 @@ table.Build tbody tr:nth-child(even) {
151154
white-space: nowrap;
152155
}
153156
.Build-desc {
157+
font-size: 0.8125rem;
154158
max-width: 8.875rem;
155159
overflow: hidden;
156160
text-overflow: ellipsis;
@@ -162,8 +166,16 @@ table.Build tbody tr:nth-child(even) {
162166
}
163167
.Build-builderArchRow th,
164168
.Build-builderTagRow th {
165-
font-size: 0.5625rem;
169+
font-size: 0.625rem;
166170
font-weight: normal;
167171
text-align: center;
168172
white-space: nowrap;
169173
}
174+
.Build-result {
175+
text-align: center;
176+
}
177+
.Build-resultOK {
178+
font-size: 0.6875rem;
179+
color: #000;
180+
text-decoration: none;
181+
}

0 commit comments

Comments
 (0)