mirror of
https://github.com/goharbor/harbor.git
synced 2025-01-22 15:41:26 +01:00
change code
This commit is contained in:
parent
af55312664
commit
c972406d0f
@ -288,14 +288,3 @@ func (ra *RepositoryAPI) getUsername() (string, error) {
|
||||
|
||||
return "", nil
|
||||
}
|
||||
|
||||
//getTopTenRepos handles request GET /api/repositories/toprepos
|
||||
func (ra *RepositoryAPI) GetTopTenRepos() {
|
||||
repos, err := dao.GetTop10Repos()
|
||||
if err != nil {
|
||||
log.Errorf("error occured in get top 10 repos: v%", err)
|
||||
ra.CustomAbort(http.StatusInternalServerError, "internal server error")
|
||||
}
|
||||
ra.Data["json"] = repos
|
||||
ra.ServeJSON()
|
||||
}
|
||||
|
@ -147,16 +147,3 @@ func GetRecentLogs(userID, linesNum int, startTime, endTime string) ([]models.Ac
|
||||
}
|
||||
return recentLogList, nil
|
||||
}
|
||||
|
||||
//GetTop10Repos return top 10 accessed public repos
|
||||
func GetTop10Repos() ([]orm.ParamsList, error) {
|
||||
|
||||
o := GetOrmer()
|
||||
sql := "select log_id, access_log.user_id, access_log.project_id, repo_name, repo_tag, GUID, operation, op_time, COUNT(repo_name) as access_count from access_log left join project on access_log.project_id=project.project_id where project.public=1 and access_log.operation<>'create' group by repo_name order by access_count desc limit 10"
|
||||
var lists []orm.ParamsList
|
||||
_, err := o.Raw(sql).ValuesList(&lists)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return lists, nil
|
||||
}
|
||||
|
@ -64,7 +64,6 @@ func initRouters() {
|
||||
beego.Router("/api/repositories", &api.RepositoryAPI{})
|
||||
beego.Router("/api/repositories/tags", &api.RepositoryAPI{}, "get:GetTags")
|
||||
beego.Router("/api/repositories/manifests", &api.RepositoryAPI{}, "get:GetManifests")
|
||||
beego.Router("/api/repositories/toprepos", &api.RepositoryAPI{}, "get:GetTopTenRepos")
|
||||
beego.Router("api/logs", &api.LogAPI{})
|
||||
|
||||
//external service that hosted on harbor process:
|
||||
|
Loading…
Reference in New Issue
Block a user