From 4067838e6b16173af08e062ce434ecfc46d45bda Mon Sep 17 00:00:00 2001 From: Aleksandr Nogikh Date: Tue, 20 Dec 2022 19:05:40 +0100 Subject: dashboard: add link to the repos page The `Instances` header currently leads to nowhere. Let's add there a link to the tested repos. --- dashboard/app/main.go | 20 ++++++++++++++++---- 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 .}} - + @@ -200,7 +200,7 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the - {{range $mgr := .}} + {{range $mgr := .List}} -- cgit mrf-deployment
Instances:Instances [{{link .RepoLink "tested repos"}}]:
Name
{{link $mgr.Link $mgr.Name}} {{formatLateness $mgr.Now $mgr.LastActive}}