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

Autocomplete git repository name #3372

Merged
merged 13 commits into from
Feb 14, 2019
Merged

Conversation

nwmac
Copy link
Contributor

@nwmac nwmac commented Jan 24, 2019

No description provided.

@nwmac nwmac self-assigned this Jan 24, 2019
@cfdreddbot
Copy link

✅ Hey nwmac! The commit authors and yourself have already signed the CLA.

@codecov
Copy link

codecov bot commented Jan 24, 2019

Codecov Report

Merging #3372 into v2-master will decrease coverage by 0.02%.
The diff coverage is 51.61%.

@@              Coverage Diff              @@
##           v2-master    #3372      +/-   ##
=============================================
- Coverage      70.46%   70.43%   -0.03%     
=============================================
  Files            660      660              
  Lines          29182    29209      +27     
  Branches        6661     6665       +4     
=============================================
+ Hits           20563    20574      +11     
- Misses          8619     8635      +16

if (prjParts.length > 1) {
url = `${gitLabAPIUrl}/users/${prjParts[0]}/projects?search=${prjParts[1]}`;
}
return this.http.get(url).pipe(
Copy link
Contributor

Choose a reason for hiding this comment

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

We should use angular's httpClient (https://angular.io/guide/http) as the old Http is deprecated. httpClient removes the need to do response.json()

if (prjParts.length > 1) {
url = `${this.gitHubURL}/search/repositories?q=${prjParts[1]}+in:name+user:${prjParts[0]}`;
}
return this.http.get(url).pipe(
Copy link
Contributor

Choose a reason for hiding this comment

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

Use httpClient (see my review comment below)

@@ -274,6 +281,31 @@ export class DeployApplicationStep2Component
this.subscriptions.push(setInitialSourceType$.subscribe());
this.subscriptions.push(setSourceTypeModel$.subscribe());
this.subscriptions.push(setProjectName.subscribe());

this.subscriptions.push(this.sourceSelectionForm.valueChanges.subscribe(form => {
Copy link
Contributor

Choose a reason for hiding this comment

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

You should be about to do something like

this.suggestedRepos$ = this.sourceSelectionForm.valueChanges.pipe(
map(form => form.projectName),
startWith(''),
pairwise(),
filter(([oldName, newName]) => oldName !=== newName),
switchMap(([oldName, newName]) => this.updateSuggestedRepositories(newName))
)

and avoid the need for the extra subscription and lastProjectName.

@KlapTrap KlapTrap added needs attention This PR needs attention and removed ready for review labels Jan 30, 2019
@nwmac nwmac added comments-addressed ready for review and removed needs attention This PR needs attention labels Feb 14, 2019
@KlapTrap KlapTrap merged commit 6465845 into v2-master Feb 14, 2019
@nwmac nwmac deleted the autocomplete-git-reponame branch June 12, 2019 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants