mirror of
https://github.com/go-gitea/gitea.git
synced 2025-04-08 17:05:45 +02:00
feat: locale status for runner
This commit is contained in:
parent
91dfef0425
commit
243b769754
@ -13,6 +13,7 @@ import (
|
||||
repo_model "code.gitea.io/gitea/models/repo"
|
||||
user_model "code.gitea.io/gitea/models/user"
|
||||
"code.gitea.io/gitea/modules/timeutil"
|
||||
"code.gitea.io/gitea/modules/translation"
|
||||
"code.gitea.io/gitea/modules/util"
|
||||
|
||||
runnerv1 "code.gitea.io/actions-proto-go/runner/v1"
|
||||
@ -74,6 +75,10 @@ func (r *ActionRunner) StatusName() string {
|
||||
return strings.ToLower(strings.TrimPrefix(r.Status().String(), "RUNNER_STATUS_"))
|
||||
}
|
||||
|
||||
func (r *ActionRunner) StatusLocaleName(lang translation.Locale) string {
|
||||
return lang.Tr("actions.runners.status." + r.StatusName())
|
||||
}
|
||||
|
||||
func (r *ActionRunner) IsOnline() bool {
|
||||
status := r.Status()
|
||||
if status == runnerv1.RunnerStatus_RUNNER_STATUS_IDLE || status == runnerv1.RunnerStatus_RUNNER_STATUS_ACTIVE {
|
||||
|
@ -3271,6 +3271,10 @@ runners.delete_runner_failed = Failed to delete runner
|
||||
runners.delete_runner_header = Confirm to delete this runner
|
||||
runners.delete_runner_notice = If a task is running on this runner, it will be terminated and mark as failed. It may break building workflow.
|
||||
runners.delete_runner_confirm = Delete this runner
|
||||
runners.status.unspecified = Unknown
|
||||
runners.status.idle = Idle
|
||||
runners.status.active = Active
|
||||
runners.status.offline = Offline
|
||||
|
||||
status.unknown = "Unknown"
|
||||
status.waiting = "Waiting"
|
||||
|
@ -10,7 +10,7 @@
|
||||
<div class="runner-basic-info">
|
||||
<div class="field dib disabled">
|
||||
<label>{{.locale.Tr "actions.runners.status"}}</label>
|
||||
<span class="runner-status-{{if .Runner.IsOnline}}online{{else}}offline{{end}}">{{.Runner.StatusName}}</span>
|
||||
<span class="runner-status-{{if .Runner.IsOnline}}online{{else}}offline{{end}}">{{.Runner.StatusLocaleName $.locale}}</span>
|
||||
</div>
|
||||
<div class="field dib disabled">
|
||||
<label>{{.locale.Tr "actions.runners.latest_online"}}</label>
|
||||
|
@ -58,7 +58,7 @@
|
||||
{{range .Runners}}
|
||||
<tr>
|
||||
<td>
|
||||
<span class="runner-status-{{if .IsOnline}}online{{else}}offline{{end}}">{{.StatusName}}</span>
|
||||
<span class="runner-status-{{if .IsOnline}}online{{else}}offline{{end}}">{{.StatusLocaleName $.locale}}</span>
|
||||
</td>
|
||||
<td>
|
||||
{{if .Editable $.RunnerOnwerID $.RunnerRepoID}}
|
||||
|
Loading…
x
Reference in New Issue
Block a user