diff --git a/components/dashboard/src/projects/new-project/NewProjectRepoList.tsx b/components/dashboard/src/projects/new-project/NewProjectRepoList.tsx index 0221a909814b30..6d95cbd1083831 100644 --- a/components/dashboard/src/projects/new-project/NewProjectRepoList.tsx +++ b/components/dashboard/src/projects/new-project/NewProjectRepoList.tsx @@ -33,7 +33,7 @@ export const NewProjectRepoList: FC<Props> = ({ filteredRepos, noReposAvailable, (r.inUse ? " text-gray-400 dark:text-gray-500" : "text-gray-700") } > - {toSimpleName(r.name)} + {toSimpleName(r)} </div> {r.updatedAt && <p>Updated {dayjs(r.updatedAt).fromNow()}</p>} </div> @@ -44,13 +44,10 @@ export const NewProjectRepoList: FC<Props> = ({ filteredRepos, noReposAvailable, Select </Button> ) : ( - <p className="text-gray-500 font-medium"> - <a rel="noopener" className="gp-link" href={userLink(r)}> - @{r.inUse.userName} - </a>{" "} - already + <p className="text-gray-500"> + Project already <br /> - added this repo + exists. </p> )} </div> @@ -64,14 +61,6 @@ export const NewProjectRepoList: FC<Props> = ({ filteredRepos, noReposAvailable, ); }; -const toSimpleName = (fullName: string) => { - const splitted = fullName.split("/"); - if (splitted.length < 2) { - return fullName; - } - return splitted.shift() && splitted.join("/"); -}; - -const userLink = (r: ProviderRepository) => { - return `https://${new URL(r.cloneUrl).host}/${r.inUse?.userName}`; +const toSimpleName = (repo: ProviderRepository) => { + return `${repo.account}/${repo.name}`; }; diff --git a/components/dashboard/src/projects/new-project/NewProjectRepoSelection.tsx b/components/dashboard/src/projects/new-project/NewProjectRepoSelection.tsx index 0f770ad6325a13..7cf489f1d0b22f 100644 --- a/components/dashboard/src/projects/new-project/NewProjectRepoSelection.tsx +++ b/components/dashboard/src/projects/new-project/NewProjectRepoSelection.tsx @@ -85,7 +85,7 @@ export const NewProjectRepoSelection: FC<Props> = ({ selectedProvider, onProject : Array.from(reposInAccounts || []).filter( (r) => (!selectedAccount || r.account === selectedAccount) && - `${r.name}`.toLowerCase().includes(repoSearchFilter.toLowerCase().trim()), + `${r.account}/${r.name}`.toLowerCase().includes(repoSearchFilter.toLowerCase().trim()), ); }, [areGitHubWebhooksUnauthorized, enableBBSIncrementalSearch, repoSearchFilter, reposInAccounts, selectedAccount]); @@ -172,18 +172,15 @@ export const NewProjectRepoSelection: FC<Props> = ({ selectedProvider, onProject onSelectGitProvider={onChangeGitProvider} /> )} + <NewProjectSearchInput searchFilter={repoSearchFilter} onSearchFilterChange={setRepoSearchFilter} /> {enableBBSIncrementalSearch && ( <Alert type="info" className="text-sm -mx-4 my-2"> <div> - Repository search requires that search queries start with the first character(s) of the - given repository name. Wildcard search is not supported. - </div> - <div className="mt-1"> - <strong>Example:</strong> For “my-repo” search “my-re”, instead of “repo” + <span className="font-semibold">Bitbucket Server</span> supports only prefix search for + projects. </div> </Alert> )} - <NewProjectSearchInput searchFilter={repoSearchFilter} onSearchFilterChange={setRepoSearchFilter} /> </div> <div className="p-6 flex-col"> {isLoading ? (