1
0
mirror of https://github.com/golang/go synced 2024-11-18 15:44:41 -07:00

go.tools/dashboard: display "-temp" builders last

LGTM=bradfitz
R=bradfitz
CC=golang-codereviews
https://golang.org/cl/133000043
This commit is contained in:
Andrew Gerrand 2014-08-26 14:49:16 +10:00
parent 89156360f9
commit 51353854a4
2 changed files with 25 additions and 12 deletions

View File

@ -159,6 +159,10 @@ func (s builderOrder) Less(i, j int) bool {
}
func builderPriority(builder string) int {
// Put -temp builders at the end, always.
if strings.HasSuffix(builder, "-temp") {
return 20
}
// Group race builders together.
if isRace(builder) {
return 1
@ -175,6 +179,13 @@ func isRace(s string) bool {
return strings.Contains(s, "-race-") || strings.HasSuffix(s, "-race")
}
func unsupported(builder string) bool {
if strings.HasSuffix(builder, "-temp") {
return true
}
return unsupportedOS(builderOS(builder))
}
func unsupportedOS(os string) bool {
if os == "race" {
return false
@ -257,7 +268,7 @@ var tmplFuncs = template.FuncMap{
"shortHash": shortHash,
"shortUser": shortUser,
"tail": tail,
"unsupportedOS": unsupportedOS,
"unsupported": unsupported,
}
func splitDash(s string) (string, string) {
@ -318,8 +329,9 @@ func builderArchChar(s string) string {
}
type builderSpan struct {
N int
OS string
N int
OS string
Unsupported bool
}
// builderSpans creates a list of tags showing
@ -330,10 +342,11 @@ func builderSpans(s []string) []builderSpan {
for len(s) > 0 {
i := 1
os := builderOSOrRace(s[0])
u := unsupportedOS(os) || strings.HasSuffix(s[0], "-temp")
for i < len(s) && builderOSOrRace(s[i]) == os {
i++
}
sp = append(sp, builderSpan{i, os})
sp = append(sp, builderSpan{i, os, u})
s = s[i:]
}
return sp

View File

@ -47,7 +47,7 @@
<table class="build">
<colgroup class="col-hash" {{if $.Package.Path}}span="2"{{end}}></colgroup>
{{range $.Builders | builderSpans}}
<colgroup class="col-result{{if (unsupportedOS .OS)}} unsupported{{end}}" span="{{.N}}"></colgroup>
<colgroup class="col-result{{if .Unsupported}} unsupported{{end}}" span="{{.N}}"></colgroup>
{{end}}
<colgroup class="col-user"></colgroup>
<colgroup class="col-time"></colgroup>
@ -62,7 +62,7 @@
<th>&nbsp;</th>
{{end}}
{{range $.Builders | builderSpans}}
<th {{if (unsupportedOS .OS)}}class="unsupported"{{end}} colspan="{{.N}}">{{.OS}}</th>
<th {{if .Unsupported}}class="unsupported"{{end}} colspan="{{.N}}">{{.OS}}</th>
{{end}}
<th></th>
<th></th>
@ -76,7 +76,7 @@
<th>&nbsp;</th>
{{end}}
{{range $.Builders}}
<th class="result arch{{if (unsupportedOS (builderOS .))}} unsupported{{end}}" title="{{.}}">{{builderSubheading .}}</th>
<th class="result arch{{if (unsupported .)}} unsupported{{end}}" title="{{.}}">{{builderSubheading .}}</th>
{{end}}
<th></th>
<th></th>
@ -94,7 +94,7 @@
<td class="hash"><a href="{{repoURL $.Dashboard.Name $h ""}}">{{shortHash $h}}</a></td>
{{end}}
{{range $.Builders}}
<td class="result{{if (unsupportedOS (builderOS .))}} unsupported{{end}}">
<td class="result{{if (unsupported .)}} unsupported{{end}}">
{{with $c.Result . $h}}
{{if .OK}}
<span class="ok">ok</span>
@ -146,7 +146,7 @@
<colgroup class="col-package"></colgroup>
<colgroup class="col-hash"></colgroup>
{{range $.Builders | builderSpans}}
<colgroup class="col-result{{if (unsupportedOS .OS)}} unsupported{{end}}" span="{{.N}}"></colgroup>
<colgroup class="col-result{{if .Unsupported}} unsupported{{end}}" span="{{.N}}"></colgroup>
{{end}}
<colgroup class="col-user"></colgroup>
<colgroup class="col-time"></colgroup>
@ -158,7 +158,7 @@
<th></th>
<th></th>
{{range $.Builders | builderSpans}}
<th {{if (unsupportedOS .OS)}}class="unsupported"{{end}} colspan="{{.N}}">{{.OS}}</th>
<th {{if .Unsupported}}class="unsupported"{{end}} colspan="{{.N}}">{{.OS}}</th>
{{end}}
<th></th>
<th></th>
@ -168,7 +168,7 @@
<th></th>
<th></th>
{{range $.Builders}}
<th class="result arch{{if (unsupportedOS (builderOS .))}} unsupported{{end}}" title="{{.}}">{{builderSubheading .}}</th>
<th class="result arch{{if (unsupported .)}} unsupported{{end}}" title="{{.}}">{{builderSubheading .}}</th>
{{end}}
<th></th>
<th></th>
@ -182,7 +182,7 @@
<a href="{{repoURL $.Dashboard.Name $h $pkg.Commit.PackagePath}}">{{shortHash $h}}</a>
</td>
{{range $.Builders}}
<td class="result{{if (unsupportedOS (builderOS .))}} unsupported{{end}}">
<td class="result{{if (unsupported .)}} unsupported{{end}}">
{{with $pkg.Commit.Result . $goHash}}
{{if .OK}}
<span class="ok">ok</span>