Skip to content

Commit 110b928

Browse files
committed
redirect to same url
1 parent 2162a1c commit 110b928

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

models/actions/runner.go

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,20 @@ func (r *ActionRunner) AllLabels() []string {
118118
return append(r.AgentLabels, r.CustomLabels...)
119119
}
120120

121+
// EditLink returns edit runner link
122+
// Should ensure attributes are loaded before call this function
123+
func (r *ActionRunner) EditLink() string {
124+
switch r.Type() {
125+
case RunnerTypeGlobal:
126+
return fmt.Sprintf("/admin/actions/runners/%d", r.ID)
127+
case RunnerTypeRepository:
128+
return fmt.Sprintf("%s/settings/actions/runners/%d", r.Repo.Link(), r.ID)
129+
case RunnerTypeOrganization:
130+
return fmt.Sprintf("%s/settings/actions/runners/%d", r.Owner.OrganisationLink(), r.ID)
131+
}
132+
return ""
133+
}
134+
121135
// Editable checks if the runner is editable by the user
122136
func (r *ActionRunner) Editable(doer, owner *user_model.User, repo *repo_model.Repository) (bool, error) {
123137
if doer == nil {

templates/shared/actions/runner_list.tmpl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
<td>{{if .LastOnline}}{{TimeSinceUnix .LastOnline $.locale}}{{else}}{{$.locale.Tr "never"}}{{end}}</td>
7373
<td class="runner-ops">
7474
{{if .Editable $.Context.Doer $.RunnerOwner $.RunnerRepo}}
75-
<a href="{{$.Link}}/{{.ID}}">{{svg "octicon-pencil"}}</a>
75+
<a href="{{.EditLink}}">{{svg "octicon-pencil"}}</a>
7676
{{else}}
7777
<div class="gt-ml-3" data-tooltip-content="{{$.locale.Tr "actions.runners.no_permission_to_edit"}}">{{svg "octicon-x"}}</div>
7878
{{end}}

0 commit comments

Comments
 (0)