diff options
author | yp05327 <576951401@qq.com> | 2023-08-21 16:26:10 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-08-21 15:26:10 +0800 |
commit | f6e7798405ef9eb7b2936b112fd2a4ea1bab4082 (patch) | |
tree | e4197e509e5b3f0f7a7f87f0385a6e18b76fbc4a /models/git | |
parent | 3be80a863b6ef3671605a20800d8e2122d758ec5 (diff) | |
download | gitea-f6e7798405ef9eb7b2936b112fd2a4ea1bab4082.tar.gz gitea-f6e7798405ef9eb7b2936b112fd2a4ea1bab4082.zip |
Add link to job details and tooltip to commit status in repo list in dashboard (#26326)
Tooltip:
![image](https://github.com/go-gitea/gitea/assets/18380374/237cb545-7844-424b-b995-1008eaaaedec)
Link to the target job:
![image](https://github.com/go-gitea/gitea/assets/18380374/0c11a97f-6517-47f2-8773-f381488c084e)
Diffstat (limited to 'models/git')
-rw-r--r-- | models/git/commit_status.go | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/models/git/commit_status.go b/models/git/commit_status.go index e7616fb167..24fee8c3b4 100644 --- a/models/git/commit_status.go +++ b/models/git/commit_status.go @@ -22,6 +22,7 @@ import ( "code.gitea.io/gitea/modules/setting" api "code.gitea.io/gitea/modules/structs" "code.gitea.io/gitea/modules/timeutil" + "code.gitea.io/gitea/modules/translation" "xorm.io/builder" "xorm.io/xorm" @@ -191,6 +192,11 @@ func (status *CommitStatus) APIURL(ctx context.Context) string { return status.Repo.APIURL() + "/statuses/" + url.PathEscape(status.SHA) } +// LocaleString returns the locale string name of the Status +func (status *CommitStatus) LocaleString(lang translation.Locale) string { + return lang.Tr("repo.commitstatus." + status.State.String()) +} + // CalcCommitStatus returns commit status state via some status, the commit statues should order by id desc func CalcCommitStatus(statuses []*CommitStatus) *CommitStatus { var lastStatus *CommitStatus |