diff options
| author | Dmitry Vyukov <dvyukov@google.com> | 2022-05-03 14:13:39 +0200 |
|---|---|---|
| committer | Dmitry Vyukov <dvyukov@google.com> | 2022-05-03 14:52:52 +0200 |
| commit | 76133fa61c38f5d8438a67be1372b75677a042f0 (patch) | |
| tree | bc4ee54a80e36aa65b49d6ba157d15593f322d77 | |
| parent | 7ee63e2c851a71312555a948cdc60dcdc9aaa27e (diff) | |
dashboard/app: don't show Uptime is manager is inactive
Currnetly for inactive managers we show "Active", say, 10 days ago in red,
but still show Uptime. It's wrong and confusing. Don't show Uptime for
inactive managers.
| -rw-r--r-- | dashboard/app/main.go | 9 | ||||
| -rw-r--r-- | dashboard/app/templates.html | 2 |
2 files changed, 6 insertions, 5 deletions
diff --git a/dashboard/app/main.go b/dashboard/app/main.go index 79308a9a1..897ed3ec0 100644 --- a/dashboard/app/main.go +++ b/dashboard/app/main.go @@ -90,7 +90,6 @@ type uiManager struct { FailedBuildBugLink string FailedSyzBuildBugLink string LastActive time.Time - LastActiveBad bool // highlight LastActive in red CurrentUpTime time.Duration MaxCorpus int64 MaxCover int64 @@ -1075,6 +1074,10 @@ func loadManagers(c context.Context, accessLevel AccessLevel, ns, manager string if accessLevel < AccessUser { link = "" } + uptime := mgr.CurrentUpTime + if now.Sub(mgr.LastAlive) > 6*time.Hour { + uptime = 0 + } ui := &uiManager{ Now: timeNow(c), Namespace: mgr.Namespace, @@ -1085,8 +1088,7 @@ func loadManagers(c context.Context, accessLevel AccessLevel, ns, manager string FailedBuildBugLink: bugLink(mgr.FailedBuildBug), FailedSyzBuildBugLink: bugLink(mgr.FailedSyzBuildBug), LastActive: mgr.LastAlive, - LastActiveBad: now.Sub(mgr.LastAlive) > 6*time.Hour, - CurrentUpTime: mgr.CurrentUpTime, + CurrentUpTime: uptime, MaxCorpus: stats.MaxCorpus, MaxCover: stats.MaxCover, TotalFuzzingTime: stats.TotalFuzzingTime, @@ -1100,7 +1102,6 @@ func loadManagers(c context.Context, accessLevel AccessLevel, ns, manager string ui.FailedBuildBugLink = "" ui.FailedSyzBuildBugLink = "" ui.CurrentUpTime = 0 - ui.LastActiveBad = false ui.TotalExecsBad = false } results = append(results, ui) diff --git a/dashboard/app/templates.html b/dashboard/app/templates.html index 27b16b120..4be0a7ac2 100644 --- a/dashboard/app/templates.html +++ b/dashboard/app/templates.html @@ -204,7 +204,7 @@ Use of this source code is governed by Apache 2 LICENSE that can be found in the {{range $mgr := .}} <tr> <td>{{link $mgr.Link $mgr.Name}}</td> - <td class="stat {{if $mgr.LastActiveBad}}bad{{end}}">{{formatLateness $mgr.Now $mgr.LastActive}}</td> + <td class="stat {{if not $mgr.CurrentUpTime}}bad{{end}}">{{formatLateness $mgr.Now $mgr.LastActive}}</td> <td class="stat">{{formatDuration $mgr.CurrentUpTime}}</td> <td class="stat">{{formatStat $mgr.MaxCorpus}}</td> <td class="stat"> |
