Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: adds labels for multiple selected artifacts #20873

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

antoine29
Copy link

@antoine29 antoine29 commented Aug 23, 2024

Thank you for contributing to Harbor!

Comprehensive Summary of your change

When selecting multiple artifacts and adding a label for these, only the first selected artifact gets labeled. Current frontend code is adding the label only to the first selected artifact. This PR is fixing this by iterating the array and adding the label to each selected artifact.

output

Issue being fixed

Fixes #20681

Please indicate you've done the following:

  • Well Written Title and Summary of the PR
  • Label the PR as needed. "release-note/ignore-for-release, release-note/new-feature, release-note/update, release-note/enhancement, release-note/community, release-note/breaking-change, release-note/docs, release-note/infra, release-note/deprecation"
  • Accepted the DCO. Commits without the DCO will delay acceptance.
  • Made sure tests are passing and test coverage is added if needed.
  • Considered the docs impact and opened a new docs issue or PR with docs changes if needed in website repository.

@antoine29 antoine29 requested a review from a team as a code owner August 23, 2024 04:27
@MinerYang MinerYang assigned wy65701436 and unassigned Vad1mo and OrlinVasilev Aug 26, 2024
@antoine29 antoine29 force-pushed the #20681-addsLabelToMultipleArtifacts branch 2 times, most recently from 2790574 to 7c4107b Compare August 27, 2024 01:47
@reasonerjt
Copy link
Contributor

reasonerjt commented Sep 2, 2024

@antoine29 Thanks for submitting the PR.
I don't have UI expertise so can't really comment on the code...
Could you explain how the errors are handled if the requests partially failed, i.e. some artifacts are labeled successfully but some failed?

@reasonerjt reasonerjt added the help wanted The issues that is valid but needs help from community label Sep 2, 2024
this.errorHandlerService.error(err);
},
});
this.selectedRow.forEach((artifact: Artifact) => {
Copy link
Contributor

@xuelichao xuelichao Sep 2, 2024

Choose a reason for hiding this comment

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

The refresh() method will be called when the first callback is called, this is not expected.
We should call the refresh() method only when all requests are completed.
Maybe 'forkJoin' function can match our requirements.

this.selectedRow will be reset to empty array when the refresh() method is called.
this.selectedRow = []

if all the iteration is not done after the first request get completed, it will call the refresh() to reset the
this.selectedRow = []
Add/Remove labels will not be triggered for the items that not iterated before the selectedRow was reset to []

@stonezdj stonezdj self-assigned this Sep 3, 2024
Copy link

codecov bot commented Sep 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 66.26%. Comparing base (c8c11b4) to head (7c4107b).
Report is 271 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main   #20873       +/-   ##
===========================================
+ Coverage   45.36%   66.26%   +20.89%     
===========================================
  Files         244     1046      +802     
  Lines       13333   114163   +100830     
  Branches     2719     2845      +126     
===========================================
+ Hits         6049    75653    +69604     
- Misses       6983    34386    +27403     
- Partials      301     4124     +3823     
Flag Coverage Δ
unittests 66.26% <ø> (+20.89%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

see 1286 files with indirect coverage changes

@antoine29
Copy link
Author

@xuelichao thanks for the feedback. I'll look at the 'forkjoin' operator.

@antoine29 antoine29 force-pushed the #20681-addsLabelToMultipleArtifacts branch from 7c4107b to f1c142d Compare September 19, 2024 02:59
Signed-off-by: anthony <[email protected]>
@antoine29 antoine29 force-pushed the #20681-addsLabelToMultipleArtifacts branch from f1c142d to 0e3caf9 Compare September 19, 2024 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/ui help wanted The issues that is valid but needs help from community
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add labels to many artifact with the UI
9 participants