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

feat: Add autocomplete for repo Revisions (#4645) #4713

Merged
merged 2 commits into from
Nov 2, 2020

Conversation

tetchel
Copy link
Contributor

@tetchel tetchel commented Oct 30, 2020

  • Introduces api/v1/repositories/{repo}/refs which returns branches and tags
  • Add new RevisionFormField component to Create and Edit Application pages

Signed-off-by: Tim Etchells [email protected]

Checklist:

  • Either (a) I've created an enhancement proposal and discussed it with the community, (b) this is a bug fix, or (c) this does not need to be in the release notes.
  • The title of the PR states what changed and the related issues number (used for the release note).
  • I've updated both the CLI and UI to expose my feature, or I plan to submit a second PR with them.
  • Does this PR require documentation updates?
  • I've updated documentation as required by this PR.
  • Optional. My organization is added to USERS.md.
  • I've signed the CLA and my build is green (troubleshooting builds).

Resolves #4645

See issue for screenshots

@tetchel tetchel marked this pull request as draft October 30, 2020 04:38
@tetchel tetchel changed the title Add autocomplete for repo Revisions feat: Add autocomplete for repo Revisions (#4645) Oct 30, 2020
- Introduces api/v1/repositories/{repo}/refs which returns branches and tags
- Add new RevisionFormField component to Create and Edit Application pages

Signed-off-by: Tim Etchells <[email protected]>
@tetchel tetchel marked this pull request as ready for review October 30, 2020 15:52
Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

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

Awesome change! Added few minor commentss

assert.NotContains(t, lsResult.Branches, testTag)
assert.NotContains(t, lsResult.Tags, testBranch)

//fmt.Printf("BRANCHES: %s\n", strings.Join(lsResult.Branches, ", "))
Copy link
Collaborator

Choose a reason for hiding this comment

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

Please remove commented code.

load={async (src: any): Promise<string[]> => {
if (src.repoURL) {
try {
const revisionsRes = await services.repos.revisions(src.repoURL);
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think it would be easy to read if we don't use async. E.g.

return services.repos.revisions(src.repoURL).
  then(revisionsRes =>[ 'HEAD' ].concat(revisionsRes.branches).concat(revisionsRes.tags) ).
  catch(() => []);

What do you think?

Copy link
Contributor Author

@tetchel tetchel Nov 1, 2020

Choose a reason for hiding this comment

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

Sure, doesn't matter to me

s.metricsServer.IncPendingRepoRequest(q.Repo.Repo)
defer s.metricsServer.DecPendingRepoRequest(q.Repo.Repo)

// TODO is locking necessary here? We are not modifying the repository, just running an ls-remote
Copy link
Collaborator

Choose a reason for hiding this comment

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

Locking is not required ( it is necessary only if we are touching local repo files). Please remove comment

return nil, err
}

// TODO check cache
Copy link
Collaborator

Choose a reason for hiding this comment

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

The ls-remote is used if every other repo server operation without caching. In fact it is used to find cache key. So I think caching is not required here and we can remove this comment.

Signed-off-by: Tim Etchells <[email protected]>
@codecov-io
Copy link

codecov-io commented Nov 1, 2020

Codecov Report

Attention: Patch coverage is 50.00000% with 20 lines in your changes missing coverage. Please review.

Project coverage is 41.13%. Comparing base (dd856e1) to head (0de8121).
Report is 4681 commits behind head on master.

Files with missing lines Patch % Lines
reposerver/repository/repository.go 0.00% 12 Missing ⚠️
util/git/client.go 71.42% 4 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #4713      +/-   ##
==========================================
+ Coverage   41.10%   41.13%   +0.03%     
==========================================
  Files         127      127              
  Lines       17367    17548     +181     
==========================================
+ Hits         7139     7219      +80     
- Misses       9202     9298      +96     
- Partials     1026     1031       +5     

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

@tetchel tetchel requested a review from alexmt November 1, 2020 21:22
Copy link
Collaborator

@alexmt alexmt left a comment

Choose a reason for hiding this comment

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

LGTM
👍

@alexmt alexmt merged commit 8603150 into argoproj:master Nov 2, 2020
terrycorley pushed a commit to terrycorley/argo-cd that referenced this pull request Nov 3, 2020
…zation-generators

* 'master' of github.com:argoproj/argo-cd:
  fix: RevisionFormField component crashes in 'refs' API returns no tags (argoproj#4735)
  docs: add Opensurvey to USERS.md (argoproj#4727)
  docs: correct parameters usage in CLI (argoproj#4725)
  fix: Repo-server has silent unmarshalling errors leading to empty applications (argoproj#4423) (argoproj#4708)
  fix: inject artificial delay between sync waves to better support health assessments (argoproj#4715)
  fix: exclude files listed under exclusions (argoproj#4686)
  feat: support resource actions on CRDs that use status subresources (argoproj#4690)
  feat: Add autocomplete for repo Revisions (argoproj#4645) (argoproj#4713)
  fix: webhook don't refresh apps pointing to HEAD (argoproj#4717)
  feat: Add support for ExecProvider cluster auth (argoproj#4600) (argoproj#4710)
  fix: adding helm values file in New App (argoproj#4635)
  docs: Instructions on `make verify-kube-connect` step when using k3d (argoproj#4687)
  feat:  Annotation based app paths detection in webhooks (argoproj#4699)
  fix: adding commonAnnotations for Kustomize (argoproj#4613)
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.

Display List of Git Branches as Drop Down
3 participants