Skip to content

Commit

Permalink
resolve issue with sort icons on admin/users and admin/runners (go-gi…
Browse files Browse the repository at this point in the history
…tea#24360)

Fixes go-gitea#24327 to avoid the sort icon changing the table header over
multiple lines and adds missing sort icons on the runners page.
  • Loading branch information
jladbrook authored Sep 12, 2023
1 parent e481638 commit e33f112
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
6 changes: 6 additions & 0 deletions models/actions/runner.go
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,12 @@ func (opts FindRunnerOptions) toOrder() string {
return "last_online ASC"
case "alphabetically":
return "name ASC"
case "reversealphabetically":
return "name DESC"
case "newest":
return "id DESC"
case "oldest":
return "id ASC"
}
return "last_online DESC"
}
Expand Down
1 change: 1 addition & 0 deletions routers/web/shared/actions/runners.go
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ func RunnersList(ctx *context.Context, opts actions_model.FindRunnerOptions) {
ctx.Data["RegistrationToken"] = token.Token
ctx.Data["RunnerOwnerID"] = opts.OwnerID
ctx.Data["RunnerRepoID"] = opts.RepoID
ctx.Data["SortType"] = opts.Sort

pager := context.NewPagination(int(count), opts.PageSize, opts.Page, 5)

Expand Down
15 changes: 12 additions & 3 deletions templates/shared/actions/runner_list.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,18 @@
<table class="ui very basic striped table unstackable">
<thead>
<tr>
<th data-sortt-asc="online" data-sortt-desc="offline">{{.locale.Tr "actions.runners.status"}}</th>
<th data-sortt-asc="alphabetically">{{.locale.Tr "actions.runners.id"}}</th>
<th>{{.locale.Tr "actions.runners.name"}}</th>
<th data-sortt-asc="online" data-sortt-desc="offline">
{{.locale.Tr "actions.runners.status"}}
{{SortArrow "online" "offline" .SortType false}}
</th>
<th data-sortt-asc="newest" data-sortt-desc="oldest">
{{.locale.Tr "actions.runners.id"}}
{{SortArrow "oldest" "newest" .SortType false}}
</th>
<th data-sortt-asc="alphabetically" data-sortt-desc="reversealphabetically">
{{.locale.Tr "actions.runners.name"}}
{{SortArrow "alphabetically" "reversealphabetically" .SortType false}}
</th>
<th>{{.locale.Tr "actions.runners.version"}}</th>
<th>{{.locale.Tr "actions.runners.owner_type"}}</th>
<th>{{.locale.Tr "actions.runners.labels"}}</th>
Expand Down

0 comments on commit e33f112

Please sign in to comment.