go.tools/dashboard: option to show only "first-class" ports

LGTM=rsc
R=rsc, minux.ma, iant, oleku.konko
CC=golang-codereviews
https://golang.org/cl/81730043
This commit is contained in:
Andrew Gerrand 2014-03-31 08:54:14 +11:00
parent 4775a5ed46
commit 58edf2a69d
2 changed files with 41 additions and 11 deletions

View File

@ -175,6 +175,14 @@ func isRace(s string) bool {
return strings.Contains(s, "-race-") || strings.HasSuffix(s, "-race") return strings.Contains(s, "-race-") || strings.HasSuffix(s, "-race")
} }
func unsupportedOS(os string) bool {
if os == "race" {
return false
}
p, ok := osPriority[os]
return !ok || p > 0
}
// Priorities for specific operating systems. // Priorities for specific operating systems.
var osPriority = map[string]int{ var osPriority = map[string]int{
"darwin": 0, "darwin": 0,
@ -239,15 +247,17 @@ var uiTemplate = template.Must(
) )
var tmplFuncs = template.FuncMap{ var tmplFuncs = template.FuncMap{
"buildDashboards": buildDashboards,
"builderOS": builderOS,
"builderSpans": builderSpans,
"builderSubheading": builderSubheading, "builderSubheading": builderSubheading,
"builderTitle": builderTitle, "builderTitle": builderTitle,
"builderSpans": builderSpans,
"buildDashboards": buildDashboards,
"repoURL": repoURL, "repoURL": repoURL,
"shortDesc": shortDesc, "shortDesc": shortDesc,
"shortHash": shortHash, "shortHash": shortHash,
"shortUser": shortUser, "shortUser": shortUser,
"tail": tail, "tail": tail,
"unsupportedOS": unsupportedOS,
} }
func splitDash(s string) (string, string) { func splitDash(s string) (string, string) {

View File

@ -56,7 +56,7 @@
.dashboards, .paginate { .dashboards, .paginate {
padding: 0.5em; padding: 0.5em;
} }
.dashboards a, .paginate a { .dashboards > a, .paginate a {
padding: 0.5em; padding: 0.5em;
background: #eee; background: #eee;
color: blue; color: blue;
@ -68,6 +68,19 @@
color: #C00; color: #C00;
} }
</style> </style>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.min.js"></script>
<script>
var showUnsupported = window.location.hash.substr(1) != "short";
function redraw() {
showUnsupported = !$("#showshort").prop('checked');
$('.unsupported')[showUnsupported?'show':'hide']();
window.location.hash = showUnsupported?'':'short';
}
$(document).ready(function() {
$("#showshort").attr('checked', !showUnsupported).change(redraw);
redraw();
})
</script>
</head> </head>
<body> <body>
<h1>{{$.Dashboard.Name}} Build Status</h1> <h1>{{$.Dashboard.Name}} Build Status</h1>
@ -75,6 +88,10 @@
{{range buildDashboards}} {{range buildDashboards}}
<a href="{{.RelPath}}">{{.Name}}</a> <a href="{{.RelPath}}">{{.Name}}</a>
{{end}} {{end}}
<label>
<input type=checkbox id="showshort">
show only <a href="http://golang.org/wiki/PortingPolicy">first-class ports</a>
</label>
</nav> </nav>
{{with $.Package.Name}}<h2>{{.}}</h2>{{end}} {{with $.Package.Name}}<h2>{{.}}</h2>{{end}}
@ -83,7 +100,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" span="{{.N}}"></colgroup> <colgroup class="col-result{{if (unsupportedOS .OS)}} 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>
@ -98,7 +115,7 @@
<th>&nbsp;</th> <th>&nbsp;</th>
{{end}} {{end}}
{{range $.Builders | builderSpans}} {{range $.Builders | builderSpans}}
<th colspan="{{.N}}">{{.OS}}</th> <th {{if (unsupportedOS .OS)}}class="unsupported"{{end}} colspan="{{.N}}">{{.OS}}</th>
{{end}} {{end}}
<th></th> <th></th>
<th></th> <th></th>
@ -112,8 +129,11 @@
<th>&nbsp;</th> <th>&nbsp;</th>
{{end}} {{end}}
{{range $.Builders}} {{range $.Builders}}
<th class="result arch" title="{{.}}">{{builderSubheading .}}</th> <th class="result arch{{if (unsupportedOS (builderOS .))}} unsupported{{end}}" title="{{.}}">{{builderSubheading .}}</th>
{{end}} {{end}}
<th></th>
<th></th>
<th></th>
</tr> </tr>
{{range $c := $.Commits}} {{range $c := $.Commits}}
{{range $i, $h := $c.ResultGoHashes}} {{range $i, $h := $c.ResultGoHashes}}
@ -127,7 +147,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"> <td class="result{{if (unsupportedOS (builderOS .))}} unsupported{{end}}">
{{with $c.Result . $h}} {{with $c.Result . $h}}
{{if .OK}} {{if .OK}}
<span class="ok">ok</span> <span class="ok">ok</span>
@ -177,7 +197,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" span="{{.N}}"></colgroup> <colgroup class="col-result{{if (unsupportedOS .OS)}} 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>
@ -189,7 +209,7 @@
<th></th> <th></th>
<th></th> <th></th>
{{range $.Builders | builderSpans}} {{range $.Builders | builderSpans}}
<th colspan="{{.N}}">{{.OS}}</th> <th {{if (unsupportedOS .OS)}}class="unsupported"{{end}} colspan="{{.N}}">{{.OS}}</th>
{{end}} {{end}}
<th></th> <th></th>
<th></th> <th></th>
@ -199,7 +219,7 @@
<th></th> <th></th>
<th></th> <th></th>
{{range $.Builders}} {{range $.Builders}}
<th class="result arch" title="{{.}}">{{builderSubheading .}}</th> <th class="result arch{{if (unsupportedOS (builderOS .))}} unsupported{{end}}" title="{{.}}">{{builderSubheading .}}</th>
{{end}} {{end}}
<th></th> <th></th>
<th></th> <th></th>
@ -213,7 +233,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"> <td class="result{{if (unsupportedOS (builderOS .))}} 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>