cmd/coordinator, perf: improve header consistency

I forgot there was another copy of the template in status.go.
Move at least coordinator's 2 copies of the header into one
common place; we can do more later.

Also update the perf header to be consistent and link back
to the coordinator status page for easier navigation.

For golang/go#48803.

Change-Id: Id3f789d529e349cde1557ed17dd713549f55b942
Reviewed-on: https://go-review.googlesource.com/c/build/+/414036
Reviewed-by: Dmitri Shuralyov <dmitshur@google.com>
Reviewed-by: Michael Pratt <mpratt@google.com>
TryBot-Result: Gopher Robot <gobot@golang.org>
Auto-Submit: Dmitri Shuralyov <dmitshur@golang.org>
Run-TryBot: Dmitri Shuralyov <dmitshur@golang.org>
diff --git a/cmd/coordinator/builders.go b/cmd/coordinator/builders.go
index 6a577c4..06c8323 100644
--- a/cmd/coordinator/builders.go
+++ b/cmd/coordinator/builders.go
@@ -44,7 +44,7 @@
 	}
 }
 
-var buildersTmpl = template.Must(template.New("builders").Funcs(template.FuncMap{
+var buildersTmpl = template.Must(baseTmpl.New("builders").Funcs(template.FuncMap{
 	"builderOwners": func(bc *dashboard.BuildConfig) template.HTML {
 		owners := bc.HostConfig().Owners
 		if len(owners) == 0 {
@@ -76,19 +76,7 @@
 <html>
 <head><link rel="stylesheet" href="/style.css"/><title>Go Farmer</title></head>
 <body>
-<header>
-	<h1>
-		<a href="/">Go Build Coordinator</a>
-	</h1>
-	<nav>
-		<ul>
-			<li><a href="https://build.golang.org/">Build Dashboard</a></li>
-			<li><a href="https://perf.golang.org/dashboard">Performance Dashboard</a></li>
-			<li><a href="/builders">Builders</a></li>
-		</ul>
-	</nav>
-	<div class="clear"></div>
-</header>
+{{template "build-header"}}
 
 <h2 id='builders'>Defined Builders</h2>
 
diff --git a/cmd/coordinator/status.go b/cmd/coordinator/status.go
index 6d3593e..aca3d0a 100644
--- a/cmd/coordinator/status.go
+++ b/cmd/coordinator/status.go
@@ -778,23 +778,27 @@
 	HealthCheckers    []*healthChecker
 }
 
-var statusTmpl = template.Must(template.New("status").Parse(`
-<!DOCTYPE html>
-<html>
-<head><link rel="stylesheet" href="/style.css"/><title>Go Farmer</title></head>
-<body>
-<header>
+// baseTmpl defines common templates for reuse in other coordinator templates.
+var baseTmpl = template.Must(template.New("").Parse(`{{define "build-header"}}<header>
 	<h1>
 		<a href="/">Go Build Coordinator</a>
 	</h1>
 	<nav>
 		<ul>
-			<li><a href="https://build.golang.org/">Dashboard</a></li>
+			<li><a href="https://build.golang.org/">Build Dashboard</a></li>
+			<li><a href="https://perf.golang.org/dashboard">Performance Dashboard</a></li>
 			<li><a href="/builders">Builders</a></li>
 		</ul>
 	</nav>
 	<div class="clear"></div>
-</header>
+</header>{{end}}`))
+
+var statusTmpl = template.Must(baseTmpl.New("status").Parse(`
+<!DOCTYPE html>
+<html>
+<head><link rel="stylesheet" href="/style.css"/><title>Go Farmer</title></head>
+<body>
+{{template "build-header"}}
 
 <h2>Running</h2>
 <p>{{printf "%d" .Total}} total builds; {{printf "%d" .ActiveBuilds}} active ({{.ActiveReverse}} reverse). Uptime {{printf "%s" .Uptime}}. Version {{.Version}}.
diff --git a/perf/app/dashboard/index.html b/perf/app/dashboard/index.html
index f8f7742..d7c0166 100644
--- a/perf/app/dashboard/index.html
+++ b/perf/app/dashboard/index.html
@@ -17,11 +17,11 @@
 <body class="Dashboard">
 <header class="Dashboard-topbar">
 	<h1>
-		<a href="./">Go Performance Dashboard</a>
+		<a href="https://farmer.golang.org/">Go Build Coordinator</a>
 	</h1>
 	<nav>
 		<ul>
-			<li><a href="https://build.golang.org">Build Dashboard</a></li>
+			<li><a href="https://build.golang.org/">Build Dashboard</a></li>
 			<li><a href="/dashboard">Performance Dashboard</a></li>
 			<li><a href="https://farmer.golang.org/builders">Builders</a></li>
 		</ul>