mirror of
https://github.com/goharbor/harbor.git
synced 2024-11-01 08:09:59 +01:00
Merge pull request #10165 from ywk253100/191205_sort_1.10
Sort the tag before returning the list when calling API
This commit is contained in:
commit
2e2c849aa6
@ -615,21 +615,24 @@ func (ra *RepositoryAPI) GetTags() {
|
|||||||
}
|
}
|
||||||
tags = ts
|
tags = ts
|
||||||
}
|
}
|
||||||
|
result := []*models.TagResp{}
|
||||||
detail, err := ra.GetBool("detail", true)
|
detail, err := ra.GetBool("detail", true)
|
||||||
if !detail && err == nil {
|
if !detail && err == nil {
|
||||||
ra.Data["json"] = simpleTags(tags)
|
result = simpleTags(tags)
|
||||||
ra.ServeJSON()
|
} else {
|
||||||
return
|
result = assembleTagsInParallel(
|
||||||
|
client,
|
||||||
|
project.ProjectID,
|
||||||
|
repoName,
|
||||||
|
tags,
|
||||||
|
ra.SecurityCtx.GetUsername(),
|
||||||
|
)
|
||||||
}
|
}
|
||||||
|
// sort by tag name
|
||||||
ra.Data["json"] = assembleTagsInParallel(
|
sort.Slice(result, func(i, j int) bool {
|
||||||
client,
|
return result[i].Name < result[j].Name
|
||||||
project.ProjectID,
|
})
|
||||||
repoName,
|
ra.Data["json"] = result
|
||||||
tags,
|
|
||||||
ra.SecurityCtx.GetUsername(),
|
|
||||||
)
|
|
||||||
ra.ServeJSON()
|
ra.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user