Commit fd150b4c authored by Quentin Smith's avatar Quentin Smith

analysis: add readme text on empty search

Change-Id: I1d0d574a78559f08125d8aa03ea4f6ab7912e28c
Reviewed-on: https://go-review.googlesource.com/36028Reviewed-by: default avatarRuss Cox <rsc@golang.org>
parent 68e449c3
......@@ -20,6 +20,7 @@ type App struct {
// RegisterOnMux registers the app's URLs on mux.
func (a *App) RegisterOnMux(mux *http.ServeMux) {
mux.HandleFunc("/", a.index)
mux.HandleFunc("/search", a.search)
mux.HandleFunc("/compare", a.compare)
}
......@@ -37,3 +38,8 @@ func (a *App) search(w http.ResponseWriter, r *http.Request) {
//q := r.Form.Get("q")
a.compare(w, r)
}
// index redirects / to /search.
func (a *App) index(w http.ResponseWriter, r *http.Request) {
http.Redirect(w, r, "/search", http.StatusSeeOther)
}
......@@ -222,6 +222,10 @@ func elideKeyValues(content string, keys map[string]bool) string {
}
func (a *App) compareQuery(q string) *compareData {
if len(q) == 0 {
return &compareData{}
}
// Parse query
prefix, queries := parseQueryString(q)
......
......@@ -89,65 +89,76 @@ td.count {
</form>
</div>
<div id="results">
{{with .Error}}
<p>{{.}}</p>
{{if not .Q}}
<p>The Go Performance Dashboard provides a centralized
resource for sharing and analyzing benchmark results. To get
started, upload benchmark results using
<code>go get -u golang.org/x/perf/cmd/benchsave</code>
and
<code>benchsave old.txt new.txt</code>
or upload via the web at
<a href="https://perfdata-dot-golang-org.appspot.com/upload">https://perfdata-dot-golang-org.appspot.com/upload</a>.</p>
{{else}}
<table id="labels">
{{with .CommonLabels}}
<tbody>
<tr>
<th>label</th><th>common value</th>
</tr>
{{range $label, $value := .}}
{{with .Error}}
<p>{{.}}</p>
{{else}}
<table id="labels">
{{with .CommonLabels}}
<tbody>
<tr>
<th class="label">{{$label}}</th><td>{{$value}}</td>
<th>label</th><th>common value</th>
</tr>
{{end}}
</tbody>
{{end}}
<tbody class="diff">
<tr>
<th>label</th>
<th>values</th>
</tr>
{{range $label, $exists := .Labels}}
<tr class="diff">
<th class="label">{{$label}}</th>
<td>
{{range $index, $group := $.Groups}}
<div class="query">{{$group.Q}}:</div>
<table>
{{with index $group.LabelValues $label}}
{{range .TopN 4}}
<tr>
<td class="count">
{{.Count}}
</td>
<td>
{{if eq .Value ""}}
missing
{{else if eq .Value "…"}}
{{.Value}}
{{else}}
<a href="/search?q={{addToQuery $.Q (printf "%s:%s" $label .Value)}}">
{{printf "%q" .Value}}
</a>
{{end}}
</td>
</tr>
{{range $label, $value := .}}
<tr>
<th class="label">{{$label}}</th><td>{{$value}}</td>
</tr>
{{end}}
</tbody>
{{end}}
<tbody class="diff">
<tr>
<th>label</th>
<th>values</th>
</tr>
{{range $label, $exists := .Labels}}
<tr class="diff">
<th class="label">{{$label}}</th>
<td>
{{range $index, $group := $.Groups}}
<div class="query">{{$group.Q}}:</div>
<table>
{{with index $group.LabelValues $label}}
{{range .TopN 4}}
<tr>
<td class="count">
{{.Count}}
</td>
<td>
{{if eq .Value ""}}
missing
{{else if eq .Value "…"}}
{{.Value}}
{{else}}
<a href="/search?q={{addToQuery $.Q (printf "%s:%s" $label .Value)}}">
{{printf "%q" .Value}}
</a>
{{end}}
</td>
</tr>
{{end}}
{{end}}
{{end}}
</table>
</table>
{{end}}
</td>
</tr>
{{end}}
</td>
</tr>
{{end}}
</tbody>
</table>
<div id="benchstat">
{{.Benchstat}}
</div>
</tbody>
</table>
<div id="benchstat">
{{.Benchstat}}
</div>
{{end}}
{{end}}
</div>
</div>
</body>
</html>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment