Skip to content

fix : project logs flags#703

Open
Sypher845 wants to merge 3 commits intogoharbor:mainfrom
Sypher845:fix/project-logs-flags
Open

fix : project logs flags#703
Sypher845 wants to merge 3 commits intogoharbor:mainfrom
Sypher845:fix/project-logs-flags

Conversation

@Sypher845
Copy link
Contributor

Fixes #702
--page, --page-size, --query, --sort flags now work as expected.
In cmd/harbor/root/project/logs.go , now the listFlag (opts) is passed.

resp, err = api.LogsProject(projectName, opts)

Also the LogsProject() now handles the logic of sending the required params

func LogsProject(projectName string, opts ...ListFlags) (*project.GetLogExtsOK, error) {
	ctx, client, err := utils.ContextWithClient()
	if err != nil {
		return nil, err
	}

	var listFlags ListFlags
	if len(opts) > 0 {
		listFlags = opts[0]
	}

	response, err := client.Project.GetLogExts(ctx, &project.GetLogExtsParams{
		ProjectName: projectName,
		Page:        &listFlags.Page,
		PageSize:    &listFlags.PageSize,
		Q:           &listFlags.Q,
		Sort:        &listFlags.Sort,
		Context:     ctx,
	})
	if err != nil {
		return nil, err
	}

	return response, nil
}

@Sypher845 Sypher845 changed the title fix : project logs flags not have effect fix : project logs flags Feb 14, 2026
Copy link
Collaborator

@qcserestipy qcserestipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this contribution! The code already looks good. Before merging please add the additional validation of input flags.

@Sypher845
Copy link
Contributor Author

@qcserestipy done!

@codecov
Copy link

codecov bot commented Feb 16, 2026

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 7.46%. Comparing base (60ad0bd) to head (f33b22f).
⚠️ Report is 110 commits behind head on main.

Files with missing lines Patch % Lines
pkg/api/project_handler.go 0.00% 8 Missing ⚠️
cmd/harbor/root/project/logs.go 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##             main    #703      +/-   ##
=========================================
- Coverage   10.99%   7.46%   -3.53%     
=========================================
  Files         173     261      +88     
  Lines        8671   13021    +4350     
=========================================
+ Hits          953     972      +19     
- Misses       7612   11940    +4328     
- Partials      106     109       +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes issue #702 by enabling the --page, --page-size, --query, and --sort flags for the project logs command. Previously, these flags were defined but not actually passed to the API handler, rendering them ineffective.

Changes:

  • Modified LogsProject() function in pkg/api/project_handler.go to accept variadic ListFlags parameter and pass pagination/filtering options to the Harbor API
  • Updated project logs command to pass the opts to LogsProject() and added validation for the page number

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
pkg/api/project_handler.go Added variadic opts ...ListFlags parameter to LogsProject() function and passed Page, PageSize, Q, and Sort fields to the GetLogExts API call
cmd/harbor/root/project/logs.go Added page number validation and passed opts to the LogsProject() API call

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@Sypher845 Sypher845 force-pushed the fix/project-logs-flags branch from 484a344 to 60bfc3a Compare February 18, 2026 13:35
Copy link
Collaborator

@qcserestipy qcserestipy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thank you

Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
Signed-off-by: Sypher845 <suyashpatil845@gmail.com>
@Sypher845 Sypher845 force-pushed the fix/project-logs-flags branch from 8c3369f to f33b22f Compare March 9, 2026 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: project logs command flags have no effect

3 participants