-
Notifications
You must be signed in to change notification settings - Fork 134
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
Conversation
✅ Hey nwmac! The commit authors and yourself have already signed the CLA. |
Codecov Report
@@ 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( |
There was a problem hiding this comment.
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( |
There was a problem hiding this comment.
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 => { |
There was a problem hiding this comment.
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.
No description provided.