mirror of
https://github.com/go-gitea/gitea.git
synced 2026-08-19 16:58:42 +00:00
Backport #38586 by @bircni Several small fixes to the Actions runner management UI. ### Runner task list links to the job, not the workflow run Relabeled the first column from "Run" to "Job"; it now shows the job ID and links to the specific job (`/actions/runs/{runID}/jobs/{jobID}`). Renamed locale key `task_list.run` to `task_list.job`. ### Missing "Disabled" translation The runner list rendered a grey label via `actions.runners.disabled`, but that key did not exist in `locale_en-US.json`, so the raw key string leaked into the UI. Replaced `"actions.runners.disabled"` with `"disabled"`. ### Status column sorting ignored active vs idle Sorting by status ordered purely on `last_online`, but the displayed status is computed from both `last_online` (offline) and `last_active` (idle vs active). As a result idle runners were interleaved with active ones. Sorting now ranks by the computed status (active → idle → offline). Disabled runners sink to the bottom of their status group (`is_disabled` as a secondary key), with `last_online`/`id` as stable tiebreakers so pagination stays deterministic. ### Status label colors Active and idle both rendered green. Idle is now yellow, active green, and offline/unknown grey; the separate grey "Disabled" badge is unchanged. This keeps connectivity visible even for disabled runners (e.g. a disabled runner still shows whether it is idle or offline). <img width="715" height="406" alt="image" src="https://github.com/user-attachments/assets/9ef06aa8-a870-4de5-9d94-603a58186908" /> Co-authored-by: bircni <bircni@icloud.com> Co-authored-by: Zettat123 <zettat123@gmail.com>
This commit is contained in:
@@ -270,15 +270,31 @@ func (opts FindRunnerOptions) ToConds() builder.Cond {
|
||||
return cond
|
||||
}
|
||||
|
||||
// runnerStatusOrderExpr builds an ORDER BY fragment that ranks runners by their
|
||||
// computed status (see ActionRunner.Status): active (0), idle (1), offline (2).
|
||||
// The thresholds are evaluated against the current time, mirroring ToConds, so
|
||||
// sorting by status groups active and idle runners instead of interleaving them
|
||||
// by raw last_online.
|
||||
func runnerStatusOrderExpr() string {
|
||||
now := time.Now()
|
||||
offlineThreshold := now.Add(-RunnerOfflineTime).Unix()
|
||||
idleThreshold := now.Add(-RunnerIdleTime).Unix()
|
||||
return fmt.Sprintf("CASE WHEN last_online <= %d THEN 2 WHEN last_active <= %d THEN 1 ELSE 0 END", offlineThreshold, idleThreshold)
|
||||
}
|
||||
|
||||
func (opts FindRunnerOptions) ToOrders() string {
|
||||
// A unique tiebreaker (id) is appended so that runners sharing the same
|
||||
// last_online or name keep a deterministic order across paginated queries,
|
||||
// otherwise the same runner may appear on more than one page.
|
||||
// status, last_online or name keep a deterministic order across paginated
|
||||
// queries, otherwise the same runner may appear on more than one page.
|
||||
statusRank := runnerStatusOrderExpr()
|
||||
switch opts.Sort {
|
||||
case "online":
|
||||
return "last_online DESC, id ASC"
|
||||
// Rank by computed status first so idle runners are not interleaved with
|
||||
// active ones; disabled runners sink to the bottom of their status group
|
||||
// (is_disabled ASC), then last_online breaks ties within a group.
|
||||
return statusRank + " ASC, is_disabled ASC, last_online DESC, id ASC"
|
||||
case "offline":
|
||||
return "last_online ASC, id ASC"
|
||||
return statusRank + " DESC, is_disabled ASC, last_online ASC, id ASC"
|
||||
case "alphabetically":
|
||||
return "name ASC, id ASC"
|
||||
case "reversealphabetically":
|
||||
@@ -288,7 +304,7 @@ func (opts FindRunnerOptions) ToOrders() string {
|
||||
case "oldest":
|
||||
return "id ASC"
|
||||
}
|
||||
return "last_online DESC, id ASC"
|
||||
return statusRank + " ASC, is_disabled ASC, last_online DESC, id ASC"
|
||||
}
|
||||
|
||||
// GetRunnerByUUID returns a runner via uuid
|
||||
|
||||
Reference in New Issue
Block a user