Use Gitlab path rather than project name
Signed-off-by: Severin Wischmann <severinwischmann@nianticlabs.com>
This commit is contained in:
@@ -79,8 +79,8 @@ describe('handleAutocompleteRequest', () => {
|
||||
|
||||
mockClient.Users.showCurrentUser.mockResolvedValue({ id: 3 });
|
||||
mockClient.Groups.allProjects.mockResolvedValue([
|
||||
{ name: 'repo1', id: 1 },
|
||||
{ name: 'repo2', id: 2 },
|
||||
{ name: 'Repo 1', path: 'repo-1', id: 1 },
|
||||
{ name: 'Repo 2', path: 'repo-2', id: 2 },
|
||||
]);
|
||||
|
||||
const result = await handleAutocompleteRequest({
|
||||
@@ -91,8 +91,8 @@ describe('handleAutocompleteRequest', () => {
|
||||
|
||||
expect(result).toEqual({
|
||||
results: [
|
||||
{ title: 'repo1', id: '1' },
|
||||
{ title: 'repo2', id: '2' },
|
||||
{ title: 'Repo 1', path: 'repo-1', id: '1' },
|
||||
{ title: 'Repo 2', path: 'repo-2', id: '2' },
|
||||
],
|
||||
});
|
||||
});
|
||||
|
||||
@@ -32,6 +32,7 @@ export function createHandleAutocompleteRequest(options: {
|
||||
}): Promise<{
|
||||
results: {
|
||||
title?: string;
|
||||
path?: string;
|
||||
id: string;
|
||||
}[];
|
||||
}> {
|
||||
@@ -97,6 +98,7 @@ export function createHandleAutocompleteRequest(options: {
|
||||
return {
|
||||
results: response.map(project => ({
|
||||
title: project.name.trim(),
|
||||
path: project.path,
|
||||
id: project.id.toString(),
|
||||
})),
|
||||
};
|
||||
|
||||
@@ -245,5 +245,5 @@ export interface ScaffolderApi {
|
||||
provider: string;
|
||||
resource: string;
|
||||
context?: Record<string, string>;
|
||||
}): Promise<{ results: { title?: string; id: string }[] }>;
|
||||
}): Promise<{ results: { title?: string; path?: string; id: string }[] }>;
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ export const GitlabRepoPicker = (
|
||||
.then(({ results }) => {
|
||||
onChange({
|
||||
availableRepos: results.map(r => {
|
||||
return { name: r.title!, id: r.id };
|
||||
return { name: r.title!, path: r.path, id: r.id };
|
||||
}),
|
||||
});
|
||||
})
|
||||
|
||||
@@ -244,7 +244,7 @@ export const RepoUrlPicker = (
|
||||
onChange={repo =>
|
||||
setState(prevState => ({
|
||||
...prevState,
|
||||
repoName: repo.name,
|
||||
repoName: repo.path || repo.name,
|
||||
id: repo.id || '',
|
||||
}))
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
export interface AvailableRepositories {
|
||||
name: string;
|
||||
path?: string;
|
||||
id?: string;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user