Skip to content

Commit

Permalink
Merge branch 'main' into add-ru-language
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-akhmineev authored Oct 24, 2024
2 parents f605613 + e8722c0 commit 6512bf2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/pkg/reg/adapter/harbor/v2/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var _ adp.ArtifactRegistry = &adapter{}
func New(base *base.Adapter) adp.Adapter {
return &adapter{
Adapter: base,
client: &client{Client: base.Client},
client: &client{Client: base.Client, pageSize: 100},
}
}

Expand Down
9 changes: 7 additions & 2 deletions src/pkg/reg/adapter/harbor/v2/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import (

type client struct {
*base.Client
pageSize int64
}

func (c *client) listRepositories(project *base.Project) ([]*model.Repository, error) {
Expand All @@ -51,8 +52,12 @@ func (c *client) listRepositories(project *base.Project) ([]*model.Repository, e
func (c *client) listArtifacts(repo string) ([]*model.Artifact, error) {
project, repo := utils.ParseRepository(repo)
repo = repository.Encode(repo)
url := fmt.Sprintf("%s/projects/%s/repositories/%s/artifacts?with_label=true&with_accessory=true",
c.BasePath(), project, repo)
// set the default value to equal the value specified when the UI submits the request
if c.pageSize == 0 {
c.pageSize = 15
}
url := fmt.Sprintf("%s/projects/%s/repositories/%s/artifacts?page_size=%d&with_label=true&with_accessory=true",
c.BasePath(), project, repo, c.pageSize)
artifacts := []*artifact.Artifact{}
if err := c.C.GetAndIteratePagination(url, &artifacts); err != nil {
return nil, err
Expand Down

0 comments on commit 6512bf2

Please sign in to comment.