mirror of
https://github.com/go-gitea/gitea.git
synced 2025-07-23 22:05:51 +02:00
feat: LocaleString for status
This commit is contained in:
parent
a6f8f10670
commit
91dfef0425
@ -3,7 +3,11 @@
|
|||||||
|
|
||||||
package actions
|
package actions
|
||||||
|
|
||||||
import runnerv1 "code.gitea.io/actions-proto-go/runner/v1"
|
import (
|
||||||
|
"code.gitea.io/gitea/modules/translation"
|
||||||
|
|
||||||
|
runnerv1 "code.gitea.io/actions-proto-go/runner/v1"
|
||||||
|
)
|
||||||
|
|
||||||
// Status represents the status of ActionRun, ActionRunJob, ActionTask, or ActionTaskStep
|
// Status represents the status of ActionRun, ActionRunJob, ActionTask, or ActionTaskStep
|
||||||
type Status int
|
type Status int
|
||||||
@ -35,6 +39,11 @@ func (s Status) String() string {
|
|||||||
return statusNames[s]
|
return statusNames[s]
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// LocaleString returns the locale string name of the Status
|
||||||
|
func (s Status) LocaleString(lang translation.Locale) string {
|
||||||
|
return lang.Tr("actions.status." + s.String())
|
||||||
|
}
|
||||||
|
|
||||||
// IsDone returns whether the Status is final
|
// IsDone returns whether the Status is final
|
||||||
func (s Status) IsDone() bool {
|
func (s Status) IsDone() bool {
|
||||||
return s.In(StatusSuccess, StatusFailure, StatusCancelled, StatusSkipped)
|
return s.In(StatusSuccess, StatusFailure, StatusCancelled, StatusSkipped)
|
||||||
|
@ -3271,3 +3271,12 @@ runners.delete_runner_failed = Failed to delete runner
|
|||||||
runners.delete_runner_header = Confirm to delete this 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_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.delete_runner_confirm = Delete this runner
|
||||||
|
|
||||||
|
status.unknown = "Unknown"
|
||||||
|
status.waiting = "Waiting"
|
||||||
|
status.running = "Running"
|
||||||
|
status.success = "Success"
|
||||||
|
status.failure = "Failure"
|
||||||
|
status.cancelled = "Cancelled"
|
||||||
|
status.skipped = "Skipped"
|
||||||
|
status.blocked = "Blocked"
|
||||||
|
@ -148,7 +148,7 @@ func ViewPost(ctx *context_module.Context) {
|
|||||||
resp.StateData.CurrentJobInfo.Title = current.Name
|
resp.StateData.CurrentJobInfo.Title = current.Name
|
||||||
resp.StateData.CurrentJobSteps = make([]ViewJobStep, 0)
|
resp.StateData.CurrentJobSteps = make([]ViewJobStep, 0)
|
||||||
resp.LogsData.StreamingLogs = make([]ViewStepLog, 0, len(req.StepLogCursors))
|
resp.LogsData.StreamingLogs = make([]ViewStepLog, 0, len(req.StepLogCursors))
|
||||||
resp.StateData.CurrentJobInfo.Detail = current.Status.String()
|
resp.StateData.CurrentJobInfo.Detail = current.Status.LocaleString(ctx.Locale)
|
||||||
if task != nil {
|
if task != nil {
|
||||||
steps := actions.FullSteps(task)
|
steps := actions.FullSteps(task)
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@
|
|||||||
{{range .Tasks}}
|
{{range .Tasks}}
|
||||||
<tr>
|
<tr>
|
||||||
<td><a href="{{.GetBuildViewLink}}" target="_blank">{{template "shared/actions/runner_id" .ID}}</a></td>
|
<td><a href="{{.GetBuildViewLink}}" target="_blank">{{template "shared/actions/runner_id" .ID}}</a></td>
|
||||||
<td><span class="ui label task-status-{{.Status.String}}">{{.Status.String}}</span></td>
|
<td><span class="ui label task-status-{{.Status.String}}">{{.Status.LocaleString $.locale}}</span></td>
|
||||||
<td>{{.GetRepoName}}</td>
|
<td>{{.GetRepoName}}</td>
|
||||||
<td><strong>
|
<td><strong>
|
||||||
<a href="{{.GetCommitLink}}" target="_blank">{{.GetCommitSHAShort}}</a>
|
<a href="{{.GetCommitLink}}" target="_blank">{{.GetCommitSHAShort}}</a>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user