diff options
| author | Aleksandr Nogikh <nogikh@google.com> | 2022-12-20 19:05:40 +0100 |
|---|---|---|
| committer | Aleksandr Nogikh <wp32pw@gmail.com> | 2022-12-21 11:40:00 +0100 |
| commit | 4067838e6b16173af08e062ce434ecfc46d45bda (patch) | |
| tree | 5d234da236d448959e2e65a56abe4cec130b17f8 | |
| parent | de7c95dd3774c15f5f8dda0952bdfbb36966504e (diff) | |
dashboard: add link to the repos page
The `Instances` header currently leads to nowhere. Let's add there a
link to the tested repos.
| -rw-r--r-- | dashboard/app/main.go | 20 | ||||
| -rw-r--r-- | dashboard/app/templates.html | 4 |
2 files changed, 18 insertions, 6 deletions
diff --git a/dashboard/app/main.go b/dashboard/app/main.go index 02ac4ac57..6144abee6 100644 --- a/dashboard/app/main.go +++ b/dashboard/app/main.go @@ -68,10 +68,22 @@ type uiMainPage struct { Header *uiHeader Now time.Time Decommissioned bool - Managers []*uiManager + Managers *uiManagerList Groups []*uiBugGroup } +type uiManagerList struct { + RepoLink string + List []*uiManager +} + +func makeManagerList(managers []*uiManager, ns string) *uiManagerList { + return &uiManagerList{ + RepoLink: fmt.Sprintf("/%s/repos", ns), + List: managers, + } +} + type uiTerminalPage struct { Header *uiHeader Now time.Time @@ -115,7 +127,7 @@ type uiRepo struct { type uiAdminPage struct { Header *uiHeader Log []byte - Managers []*uiManager + Managers *uiManagerList RecentJobs *uiJobList PendingJobs *uiJobList RunningJobs *uiJobList @@ -295,7 +307,7 @@ func handleMain(c context.Context, w http.ResponseWriter, r *http.Request) error Decommissioned: config.Namespaces[hdr.Namespace].Decommissioned, Now: timeNow(c), Groups: groups, - Managers: managers, + Managers: makeManagerList(managers, hdr.Namespace), } return serveTemplate(w, "main.html", data) } @@ -418,7 +430,7 @@ func handleAdmin(c context.Context, w http.ResponseWriter, r *http.Request) erro data := &uiAdminPage{ Header: hdr, Log: errorLog, - Managers: managers, + Managers: makeManagerList(managers, hdr.Namespace), RecentJobs: &uiJobList{Title: "Recent jobs:", Jobs: recentJobs}, RunningJobs: &uiJobList{Title: "Running jobs:", Jobs: runningJobs}, PendingJobs: &uiJobList{Title: "Pending jobs:", Jobs: pendingJobs}, diff --git a/dashboard/app/templates.html b/dashboard/app/templates.html index f27f35e35..0c6340a96 100644 --- a/dashboard/app/templates.html +++ b/dashboard/app/templates.html @@ -169,7 +169,7 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the {{define "manager_list"}} {{if .}} <table class="list_table"> - <caption id="managers"><a class="plain" href="managers">Instances:</a></caption> + <caption id="managers">Instances [{{link .RepoLink "tested repos"}}]:</caption> <thead> <tr> <th>Name</th> @@ -200,7 +200,7 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the </tr> </thead> <tbody> - {{range $mgr := .}} + {{range $mgr := .List}} <tr> <td>{{link $mgr.Link $mgr.Name}}</td> <td class="stat {{if not $mgr.CurrentUpTime}}bad{{end}}">{{formatLateness $mgr.Now $mgr.LastActive}}</td> |
