Skip to content

resolve issue with sort icons on admin/users and admin/runners #24360

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Sep 12, 2023
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