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 tetchell@redhat.com

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 <tetchell@redhat.com>
@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 <tetchell@redhat.com>
@codecov-io
Copy link

Codecov Report

Merging #4713 into master will increase coverage by 0.03%.
The diff coverage is 50.00%.

Impacted file tree graph

@@            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     
Impacted Files Coverage Δ
reposerver/repository/repository.go 59.88% <0.00%> (-1.07%) ⬇️
util/git/client.go 50.00% <71.42%> (+2.36%) ⬆️
controller/appcontroller.go 50.56% <0.00%> (-1.92%) ⬇️
pkg/apis/application/v1alpha1/types.go 56.84% <0.00%> (-1.09%) ⬇️
cmd/argocd/commands/cluster.go 11.53% <0.00%> (-0.50%) ⬇️
server/cluster/cluster.go 17.85% <0.00%> (-0.33%) ⬇️
server/application/application.go 28.93% <0.00%> (-0.17%) ⬇️
server/server.go 54.83% <0.00%> (ø)
cmd/argocd/commands/app.go 6.50% <0.00%> (+0.41%) ⬆️
util/kustomize/kustomize.go 64.28% <0.00%> (+2.00%) ⬆️
... and 2 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dd856e1...0de8121. Read the comment docs.

@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