mirror of
https://github.com/goharbor/harbor.git
synced 2024-12-20 07:37:38 +01:00
List simple tags when detail set to false
Signed-off-by: cd1989 <chende@caicloud.io>
This commit is contained in:
parent
4f7e225e69
commit
da370bb331
@ -1263,11 +1263,16 @@ paths:
|
|||||||
type: string
|
type: string
|
||||||
required: true
|
required: true
|
||||||
description: Relevant repository name.
|
description: Relevant repository name.
|
||||||
- name: label_ids
|
- name: label_id
|
||||||
in: query
|
in: query
|
||||||
type: string
|
type: string
|
||||||
required: false
|
required: false
|
||||||
description: A list of comma separated label IDs.
|
description: A label ID.
|
||||||
|
- name: detail
|
||||||
|
in: query
|
||||||
|
type: boolean
|
||||||
|
required: false
|
||||||
|
description: Bool value indicating whether return detailed information of the tag, such as vulnerability scan info, if set to false, only tag name is returned.
|
||||||
tags:
|
tags:
|
||||||
- Products
|
- Products
|
||||||
responses:
|
responses:
|
||||||
|
@ -576,11 +576,31 @@ func (ra *RepositoryAPI) GetTags() {
|
|||||||
tags = ts
|
tags = ts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
detail, err := ra.GetBool("detail", true)
|
||||||
|
if !detail && err == nil {
|
||||||
|
ra.Data["json"] = simpleTags(tags)
|
||||||
|
ra.ServeJSON()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
ra.Data["json"] = assembleTagsInParallel(client, repoName, tags,
|
ra.Data["json"] = assembleTagsInParallel(client, repoName, tags,
|
||||||
ra.SecurityCtx.GetUsername())
|
ra.SecurityCtx.GetUsername())
|
||||||
ra.ServeJSON()
|
ra.ServeJSON()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func simpleTags(tags []string) []*models.TagResp {
|
||||||
|
var tagsResp []*models.TagResp
|
||||||
|
for _, tag := range tags {
|
||||||
|
tagsResp = append(tagsResp, &models.TagResp{
|
||||||
|
TagDetail: models.TagDetail{
|
||||||
|
Name: tag,
|
||||||
|
},
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
return tagsResp
|
||||||
|
}
|
||||||
|
|
||||||
// get config, signature and scan overview and assemble them into one
|
// get config, signature and scan overview and assemble them into one
|
||||||
// struct for each tag in tags
|
// struct for each tag in tags
|
||||||
func assembleTagsInParallel(client *registry.Repository, repository string,
|
func assembleTagsInParallel(client *registry.Repository, repository string,
|
||||||
|
@ -140,7 +140,7 @@ export class TagDefaultService extends TagService {
|
|||||||
queryParams = queryParams = new RequestQueryParams();
|
queryParams = queryParams = new RequestQueryParams();
|
||||||
}
|
}
|
||||||
|
|
||||||
queryParams = queryParams.set("detail", "1");
|
queryParams = queryParams.set("detail", "true");
|
||||||
let url: string = `${this._baseUrl}/${repositoryName}/tags`;
|
let url: string = `${this._baseUrl}/${repositoryName}/tags`;
|
||||||
|
|
||||||
return this.http
|
return this.http
|
||||||
|
Loading…
Reference in New Issue
Block a user