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

View File

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