Skip to content

Commit

Permalink
[New Project] Show account name in repo list – EXP-553 (#18668)
Browse files Browse the repository at this point in the history
* [New Project] Show account name in repo list

* rephrase BBS hint

Co-authored-by: George Tsiolis <[email protected]>

* adjust font weight

Co-authored-by: George Tsiolis <[email protected]>

---------

Co-authored-by: George Tsiolis <[email protected]>
  • Loading branch information
AlexTugarev and gtsiolis authored Sep 6, 2023
1 parent 9f63620 commit cb99ca5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand All @@ -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}`;
};
Original file line number Diff line number Diff line change
Expand Up @@ -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]);

Expand Down Expand Up @@ -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 ? (
Expand Down

0 comments on commit cb99ca5

Please sign in to comment.