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 { ...@@ -20,6 +20,7 @@ type App struct {
// RegisterOnMux registers the app's URLs on mux. // RegisterOnMux registers the app's URLs on mux.
func (a *App) RegisterOnMux(mux *http.ServeMux) { func (a *App) RegisterOnMux(mux *http.ServeMux) {
mux.HandleFunc("/", a.index)
mux.HandleFunc("/search", a.search) mux.HandleFunc("/search", a.search)
mux.HandleFunc("/compare", a.compare) mux.HandleFunc("/compare", a.compare)
} }
...@@ -37,3 +38,8 @@ func (a *App) search(w http.ResponseWriter, r *http.Request) { ...@@ -37,3 +38,8 @@ func (a *App) search(w http.ResponseWriter, r *http.Request) {
//q := r.Form.Get("q") //q := r.Form.Get("q")
a.compare(w, r) 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 { ...@@ -222,6 +222,10 @@ func elideKeyValues(content string, keys map[string]bool) string {
} }
func (a *App) compareQuery(q string) *compareData { func (a *App) compareQuery(q string) *compareData {
if len(q) == 0 {
return &compareData{}
}
// Parse query // Parse query
prefix, queries := parseQueryString(q) prefix, queries := parseQueryString(q)
......
...@@ -89,6 +89,16 @@ td.count { ...@@ -89,6 +89,16 @@ td.count {
</form> </form>
</div> </div>
<div id="results"> <div id="results">
{{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}}
{{with .Error}} {{with .Error}}
<p>{{.}}</p> <p>{{.}}</p>
{{else}} {{else}}
...@@ -148,6 +158,7 @@ td.count { ...@@ -148,6 +158,7 @@ td.count {
{{.Benchstat}} {{.Benchstat}}
</div> </div>
{{end}} {{end}}
{{end}}
</div> </div>
</body> </body>
</html> </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