Add link to job details and tooltip to commit status in repo list in dashboard (#26326)

Tooltip:

![image](237cb545-7844-424b-b995-1008eaaaedec)

Link to the target job:

![image](0c11a97f-6517-47f2-8773-f381488c084e)
This commit is contained in:
yp05327 2023-08-21 16:26:10 +09:00 committed by GitHub
parent 3be80a863b
commit f6e7798405
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 36 additions and 10 deletions

View file

@ -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