diff options
author | Russ Cox <rsc@golang.org> | 2011-12-22 10:22:38 -0500 |
---|---|---|
committer | Russ Cox <rsc@golang.org> | 2011-12-22 10:22:38 -0500 |
commit | 3ec38c5a23578d75856a3879c19efb36b60495df (patch) | |
tree | 2d58173f83647119bc7074056cf5eb0ffd6402f7 /misc | |
parent | e6387349590e606419e7b5827cbb09a5f331ccbe (diff) | |
download | go-3ec38c5a23578d75856a3879c19efb36b60495df.tar.gz |
dashboard: horizontal crunch
* group builders in to columns by OS
* drop builder suffix (moved to hover title)
* cut all domain names from email (full name+email in hover title)
* make ok smaller
This should easily give us room for netbsd and plan9,
even on small laptop screens.
Running at http://build-rsc.golang.org/.
R=golang-dev, bradfitz
CC=golang-dev
http://codereview.appspot.com/5501064
Diffstat (limited to 'misc')
-rw-r--r-- | misc/dashboard/app/build/ui.go | 96 | ||||
-rw-r--r-- | misc/dashboard/app/build/ui.html | 37 |
2 files changed, 117 insertions, 16 deletions
diff --git a/misc/dashboard/app/build/ui.go b/misc/dashboard/app/build/ui.go index f2bd02b96..0b55aa239 100644 --- a/misc/dashboard/app/build/ui.go +++ b/misc/dashboard/app/build/ui.go @@ -37,7 +37,7 @@ func uiHandler(w http.ResponseWriter, r *http.Request) { } // Used cached version of front page, if available. - if page == 0 { + if page == 0 && r.Host == "build.golang.org" { t, err := memcache.Get(c, uiCacheKey) if err == nil { w.Write(t.Value) @@ -78,7 +78,7 @@ func uiHandler(w http.ResponseWriter, r *http.Request) { } // Cache the front page. - if page == 0 { + if page == 0 && r.Host == "build.golang.org" { t := &memcache.Item{ Key: uiCacheKey, Value: buf.Bytes(), @@ -179,12 +179,84 @@ var uiTemplate = template.Must( ) var tmplFuncs = template.FuncMap{ - "builderTitle": builderTitle, - "repoURL": repoURL, - "shortDesc": shortDesc, - "shortHash": shortHash, - "shortUser": shortUser, - "tail": tail, + "builderOS": builderOS, + "builderArch": builderArch, + "builderArchShort": builderArchShort, + "builderArchChar": builderArchChar, + "builderTitle": builderTitle, + "builderSpans": builderSpans, + "repoURL": repoURL, + "shortDesc": shortDesc, + "shortHash": shortHash, + "shortUser": shortUser, + "tail": tail, +} + +func splitDash(s string) (string, string) { + i := strings.Index(s, "-") + if i >= 0 { + return s[:i], s[i+1:] + } + return s, "" +} + +// builderOS returns the os tag for a builder string +func builderOS(s string) string { + os, _ := splitDash(s) + return os +} + +// builderArch returns the arch tag for a builder string +func builderArch(s string) string { + _, arch := splitDash(s) + arch, _ = splitDash(arch) // chop third part + return arch +} + +// builderArchShort returns a short arch tag for a builder string +func builderArchShort(s string) string { + arch := builderArch(s) + switch arch { + case "amd64": + return "x64" + } + return arch +} + +// builderArchChar returns the architecture letter for a builder string +func builderArchChar(s string) string { + arch := builderArch(s) + switch arch { + case "386": + return "8" + case "amd64": + return "6" + case "arm": + return "5" + } + return arch +} + +type builderSpan struct { + N int + OS string +} + +// builderSpans creates a list of tags showing +// the builder's operating system names, spanning +// the appropriate number of columns. +func builderSpans(s []string) []builderSpan { + var sp []builderSpan + for len(s) > 0 { + i := 1 + os := builderOS(s[0]) + for i < len(s) && builderOS(s[i]) == os { + i++ + } + sp = append(sp, builderSpan{i, os}) + s = s[i:] + } + return sp } // builderTitle formats "linux-amd64-foo" as "linux amd64 foo". @@ -210,11 +282,11 @@ func shortHash(hash string) string { // shortUser returns a shortened version of a user string. func shortUser(user string) string { - if i, j := strings.Index(user, "<"), strings.Index(user, ">"); i != -1 && j > i { + if i, j := strings.Index(user, "<"), strings.Index(user, ">"); 0 <= i && i < j { user = user[i+1 : j] - if k := strings.Index(user, "@golang.org"); k != -1 { - user = user[:k] - } + } + if i := strings.Index(user, "@"); i >= 0 { + return user[:i] } return user } diff --git a/misc/dashboard/app/build/ui.html b/misc/dashboard/app/build/ui.html index 429b6ff05..1fb7b2527 100644 --- a/misc/dashboard/app/build/ui.html +++ b/misc/dashboard/app/build/ui.html @@ -35,11 +35,21 @@ } .build .result { text-align: center; - width: 50px; + width: 2em; + } + .col-hash, .col-result { + border-right: solid 1px #ccc; + } + .build .arch { + font-size: 66%; + font-weight: normal; } .build .time { color: #666; } + .build .ok { + font-size: 83%; + } .build .desc, .build .time, .build .user { white-space: nowrap; } @@ -66,10 +76,29 @@ {{if $.Commits}} <table class="build"> + <colgroup class="col-hash"></colgroup> + {{range $.Builders | builderSpans}} + <colgroup class="col-result" span="{{.N}}"></colgroup> + {{end}} + <colgroup class="col-user"></colgroup> + <colgroup class="col-time"></colgroup> + <colgroup class="col-desc"></colgroup> + <tr> + <!-- extra row to make alternating colors use dark for first result --> + </tr> + <tr> + <th> </th> + {{range $.Builders | builderSpans}} + <th colspan="{{.N}}">{{.OS}}</th> + {{end}} + <th></th> + <th></th> + <th></th> + </tr> <tr> <th> </th> {{range $.Builders}} - <th class="result">{{builderTitle .}}</th> + <th class="result arch" title="{{.}}">{{builderArchShort .}}</th> {{end}} </tr> {{range $c := $.Commits}} @@ -88,9 +117,9 @@ {{end}} </td> {{end}} - <td class="user">{{shortUser .User}}</td> + <td class="user" title="{{.User}}">{{shortUser .User}}</td> <td class="time">{{.Time.Time.Format "Mon 02 Jan 15:04"}}</td> - <td class="desc">{{shortDesc .Desc}}</td> + <td class="desc" title="{{.Desc}}">{{shortDesc .Desc}}</td> </tr> {{end}} </table> |