mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-27 19:17:47 +01:00
fix robot list issue
fixes #13985 Add sorting for listing the robot account Signed-off-by: Wang Yan <wangyan@vmware.com>
This commit is contained in:
parent
74d055b26b
commit
df8e7c45e3
@ -119,6 +119,9 @@ func (d *dao) List(ctx context.Context, query *q.Query) ([]*model.Robot, error)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if query.Sorting != "" {
|
||||
qs = qs.OrderBy(query.Sorting)
|
||||
}
|
||||
if _, err = qs.All(&robots); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -81,5 +81,9 @@ func (m *manager) Update(ctx context.Context, r *model.Robot, props ...string) e
|
||||
|
||||
// List ...
|
||||
func (m *manager) List(ctx context.Context, query *q.Query) ([]*model.Robot, error) {
|
||||
query = q.MustClone(query)
|
||||
if query.Sorting == "" {
|
||||
query.Sorting = "name"
|
||||
}
|
||||
return m.dao.List(ctx, query)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user