mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-26 20:26:13 +01:00
fix list robot account API return an internal error
Signed-off-by: wang yan <wangyan@vmware.com>
This commit is contained in:
parent
aeaf3a1281
commit
5e8f7297f5
@ -108,6 +108,7 @@ func (r *RobotAPI) Post() {
|
||||
return
|
||||
}
|
||||
robotReq.Visible = true
|
||||
robotReq.ProjectID = r.project.ProjectID
|
||||
|
||||
if err := validateRobotReq(r.project, &robotReq); err != nil {
|
||||
r.SendBadRequestError(err)
|
||||
@ -144,7 +145,7 @@ func (r *RobotAPI) List() {
|
||||
}
|
||||
|
||||
keywords := make(map[string]interface{})
|
||||
keywords["ProjectID"] = r.robot.ProjectID
|
||||
keywords["ProjectID"] = r.project.ProjectID
|
||||
keywords["Visible"] = true
|
||||
query := &q.Query{
|
||||
Keywords: keywords,
|
||||
|
@ -99,23 +99,3 @@ func (r *robotAccountDao) DeleteRobotAccount(id int64) error {
|
||||
_, err := dao.GetOrmer().QueryTable(&model.Robot{}).Filter("ID", id).Delete()
|
||||
return err
|
||||
}
|
||||
|
||||
func getRobotQuerySetter(query *model.RobotQuery) orm.QuerySeter {
|
||||
qs := dao.GetOrmer().QueryTable(&model.Robot{})
|
||||
|
||||
if query == nil {
|
||||
return qs
|
||||
}
|
||||
|
||||
if len(query.Name) > 0 {
|
||||
if query.FuzzyMatchName {
|
||||
qs = qs.Filter("Name__icontains", query.Name)
|
||||
} else {
|
||||
qs = qs.Filter("Name", query.Name)
|
||||
}
|
||||
}
|
||||
if query.ProjectID != 0 {
|
||||
qs = qs.Filter("ProjectID", query.ProjectID)
|
||||
}
|
||||
return qs
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user