Files
gitea/templates/shared/actions/job_queue_list.tmpl
T
bircni 3875db1974 feat(actions): add build queue view (#38585)
Adds a read-only Actions job queue: running jobs first, then waiting
jobs in the order a runner picks them up. It is shown instance-wide in
the admin Actions section with owner, repository and status filters, and
per repository in the Actions tab. Both lists refresh in place.

Pending work is currently only visible per repository and newest-first,
so nothing shows what is queued, in which order, or what occupies the
runners. Reordering the queue will be proposed separately.

A migration adds indexes for the runner pickup query and
repository-scoped status lookups.

* Fix #34198

<img width="1345" height="451" alt="image"
src="https://github.com/user-attachments/assets/7d52ff76-81b4-44e8-b583-d7d89c9dffcd"
/>
<img width="1809" height="1134" alt="image"
src="https://github.com/user-attachments/assets/4d56c0cb-bae7-4ce2-8f3c-75163b2bc7f4"
/>

---------

Co-authored-by: Zettat123 <zettat123@gmail.com>
Co-authored-by: silverwind <me@silverwind.io>
Co-authored-by: wxiaoguang <wxiaoguang@gmail.com>
2026-09-26 08:01:41 +00:00

94 lines
5.0 KiB
Handlebars

<div id="actions-job-queue" class="runner-container" data-global-init="initActionJobQueueList"
data-job-queue-refresh-link="{{.JobQueueRefreshLink}}"
data-job-queue-refresh-interval="{{.JobQueueRefreshIntervalMs}}"
>
<div class="ui top attached header flex-left-right">
<strong>{{ctx.Locale.Tr "actions.job_queue.title"}} ({{ctx.Locale.Tr "admin.total" .JobQueueTotal}})</strong>
<div class="ui secondary filter menu flex-text-block tw-m-0" id="actions-job-queue-filter">
{{if .ShowRepoColumn}}
<div class="ui{{if not .JobQueueFilterOwners}} disabled{{end}} dropdown jump item">
<span class="text">{{if .JobQueueFilterOwnerName}}{{.JobQueueFilterOwnerName}}{{else}}{{ctx.Locale.Tr "repo.owner"}}{{end}}</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
<div class="ui icon search input">
<i class="icon">{{svg "octicon-search"}}</i>
<input type="text" placeholder="{{ctx.Locale.Tr "repo.owner"}}">
</div>
<a class="item{{if not .JobQueueFilterOwnerID}} selected{{end}}" href="?status={{.JobQueueFilterStatus}}">{{ctx.Locale.Tr "actions.job_queue.filter_owner_no_select"}}</a>
{{range .JobQueueFilterOwners}}
<a class="item{{if eq .ID $.JobQueueFilterOwnerID}} selected{{end}}" href="?owner_id={{.ID}}&status={{$.JobQueueFilterStatus}}">{{.Name}}</a>
{{end}}
</div>
</div>
<div class="ui{{if not .JobQueueFilterRepos}} disabled{{end}} dropdown jump item">
<span class="text">{{if .JobQueueFilterRepoName}}{{.JobQueueFilterRepoName}}{{else}}{{ctx.Locale.Tr "repository"}}{{end}}</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
<div class="ui icon search input">
<i class="icon">{{svg "octicon-search"}}</i>
<input type="text" placeholder="{{ctx.Locale.Tr "repository"}}">
</div>
<a class="item{{if not .JobQueueFilterRepoID}} selected{{end}}" href="?owner_id={{.JobQueueFilterOwnerID}}&status={{.JobQueueFilterStatus}}">{{ctx.Locale.Tr "actions.job_queue.filter_repo_no_select"}}</a>
{{range .JobQueueFilterRepos}}
<a class="item{{if eq .ID $.JobQueueFilterRepoID}} selected{{end}}" href="?repo_id={{.ID}}&status={{$.JobQueueFilterStatus}}">{{.FullName}}</a>
{{end}}
</div>
</div>
{{end}}
<div class="ui dropdown jump item">
<span class="text">{{if .JobQueueFilterStatus}}{{ctx.Locale.Tr (printf "actions.status.%s" .JobQueueFilterStatus)}}{{else}}{{ctx.Locale.Tr "actions.runs.status"}}{{end}}</span>
{{svg "octicon-triangle-down" 14 "dropdown icon"}}
<div class="menu">
<a class="item{{if not .JobQueueFilterStatus}} selected{{end}}" href="?owner_id={{.JobQueueFilterOwnerID}}&repo_id={{.JobQueueFilterRepoID}}">{{ctx.Locale.Tr "actions.runs.status_no_select"}}</a>
{{range $status := .JobQueueFilterStatuses}}
<a class="item{{if eq $status $.JobQueueFilterStatus}} selected{{end}}" href="?owner_id={{$.JobQueueFilterOwnerID}}&repo_id={{$.JobQueueFilterRepoID}}&status={{$status}}">
<span class="flex-text-inline tw-gap-2">
{{template "repo/icons/action_status" (dict "Status" $status)}}
{{ctx.Locale.Tr (printf "actions.status.%s" $status)}}
</span>
</a>
{{end}}
</div>
</div>
</div>
</div>
<div class="ui attached table segment">
{{if .JobQueueJobs}}
<table class="ui very basic table unstackable">
<thead>
<tr>
<th>{{ctx.Locale.Tr "actions.runs.status"}}</th>
{{if .ShowRepoColumn}}<th>{{ctx.Locale.Tr "repository"}}</th>{{end}}
<th>{{ctx.Locale.Tr "actions.runners.task_list.job"}}</th>
<th>{{ctx.Locale.Tr "actions.job_queue.runs_on"}}</th>
<th>{{ctx.Locale.Tr "actions.runners.runner_title"}}</th>
<th>{{ctx.Locale.Tr "actions.runs.commit"}}</th>
<th>{{ctx.Locale.Tr "actions.job_queue.waiting_or_started"}}</th>
</tr>
</thead>
<tbody>
{{range $job := .JobQueueJobs}}
<tr>
<td>
<span class="flex-text-inline" data-tooltip-content="{{$job.Status.LocaleString ctx.Locale}}">
{{template "repo/icons/action_status" (dict "Status" $job.Status.String)}}
</span>
</td>
{{if $.ShowRepoColumn}}<td>{{if $job.Repo}}<a href="{{$job.Repo.Link}}">{{$job.Repo.FullName}}</a>{{end}}</td>{{end}}
<td>{{if $job.Run}}<a href="{{$job.Run.Link}}">{{$job.Name}} <span class="text grey">#{{$job.Run.Index}}</span></a>{{else}}{{$job.Name}}{{end}}</td>
<td><span class="flex-text-inline tw-flex-wrap">{{range $job.RunsOn}}<span class="ui label">{{.}}</span>{{end}}</span></td>
<td>{{index $.JobQueueRunners $job.TaskID}}</td>
<td>{{if and $job.Run $job.Repo}}<a href="{{$job.Repo.Link}}/commit/{{$job.Run.CommitSHA}}">{{ShortSha $job.Run.CommitSHA}}</a>{{end}}</td>
<td>{{if $job.Started}}{{DateUtils.TimeSince $job.Started}}{{else}}{{DateUtils.TimeSince $job.Updated}}{{end}}</td>
</tr>
{{end}}
</tbody>
</table>
{{else}}
<div class="tw-text-center tw-p-4">{{ctx.Locale.Tr "actions.job_queue.no_jobs"}}</div>
{{end}}
{{template "base/paginate" .}}
</div>
</div>