mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-12 04:15:30 +00:00
Add repository weburl (#243)
This commit is contained in:
parent
fda7986617
commit
f4db3d226f
9 changed files with 21 additions and 8 deletions
|
|
@ -40,6 +40,7 @@ export const compileGithubConfig = async (
|
|||
external_codeHostType: 'github',
|
||||
external_codeHostUrl: hostUrl,
|
||||
cloneUrl: cloneUrl.toString(),
|
||||
webUrl: repo.html_url,
|
||||
name: repoName,
|
||||
imageUrl: repo.owner.avatar_url,
|
||||
isFork: repo.fork,
|
||||
|
|
@ -105,6 +106,7 @@ export const compileGitlabConfig = async (
|
|||
external_codeHostType: 'gitlab',
|
||||
external_codeHostUrl: hostUrl,
|
||||
cloneUrl: cloneUrl.toString(),
|
||||
webUrl: projectUrl,
|
||||
name: repoName,
|
||||
imageUrl: project.avatar_url,
|
||||
isFork: isFork,
|
||||
|
|
@ -166,6 +168,7 @@ export const compileGiteaConfig = async (
|
|||
external_codeHostType: 'gitea',
|
||||
external_codeHostUrl: hostUrl,
|
||||
cloneUrl: cloneUrl.toString(),
|
||||
webUrl: repo.html_url,
|
||||
name: repoName,
|
||||
imageUrl: repo.owner?.avatar_url,
|
||||
isFork: repo.fork!,
|
||||
|
|
@ -230,6 +233,7 @@ export const compileGerritConfig = async (
|
|||
external_codeHostType: 'gerrit',
|
||||
external_codeHostUrl: hostUrl,
|
||||
cloneUrl: cloneUrl.toString(),
|
||||
webUrl: webUrl,
|
||||
name: project.name,
|
||||
isFork: false,
|
||||
isArchived: false,
|
||||
|
|
|
|||
|
|
@ -0,0 +1,2 @@
|
|||
-- AlterTable
|
||||
ALTER TABLE "Repo" ADD COLUMN "webUrl" TEXT;
|
||||
|
|
@ -45,6 +45,7 @@ model Repo {
|
|||
isArchived Boolean
|
||||
metadata Json
|
||||
cloneUrl String
|
||||
webUrl String?
|
||||
connections RepoToConnection[]
|
||||
imageUrl String?
|
||||
repoIndexingStatus RepoIndexingStatus @default(NEW)
|
||||
|
|
|
|||
|
|
@ -430,6 +430,7 @@ export const getRepos = async (domain: string, filter: { status?: RepoIndexingSt
|
|||
repoId: repo.id,
|
||||
repoName: repo.name,
|
||||
repoCloneUrl: repo.cloneUrl,
|
||||
webUrl: repo.webUrl ?? undefined,
|
||||
linkedConnections: repo.connections.map(({ connection }) => ({
|
||||
id: connection.id,
|
||||
name: connection.name,
|
||||
|
|
|
|||
|
|
@ -89,8 +89,12 @@ export const NavigationMenu = async ({
|
|||
|
||||
<div className="flex flex-row items-center gap-2">
|
||||
<ProgressNavIndicator />
|
||||
{env.SOURCEBOT_AUTH_ENABLED === 'true' && (
|
||||
<>
|
||||
<WarningNavIndicator />
|
||||
<ErrorNavIndicator />
|
||||
</>
|
||||
)}
|
||||
<TrialNavIndicator subscription={subscription} />
|
||||
<form
|
||||
action={async () => {
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ export const RepositoryTable = ({ isAddNewRepoButtonVisible }: RepositoryTablePr
|
|||
connections: repo.linkedConnections,
|
||||
repoIndexingStatus: repo.repoIndexingStatus as RepoIndexingStatus,
|
||||
lastIndexed: repo.indexedAt?.toISOString() ?? "",
|
||||
url: repo.repoCloneUrl,
|
||||
url: repo.webUrl ?? repo.repoCloneUrl,
|
||||
})).sort((a, b) => {
|
||||
return new Date(b.lastIndexed).getTime() - new Date(a.lastIndexed).getTime();
|
||||
});
|
||||
|
|
|
|||
|
|
@ -105,14 +105,13 @@ const initSingleTenancy = async () => {
|
|||
name: key,
|
||||
orgId: SINGLE_TENANT_ORG_ID,
|
||||
}
|
||||
},
|
||||
select: {
|
||||
config: true,
|
||||
}
|
||||
});
|
||||
|
||||
const currentConnectionConfig = currentConnection ? currentConnection.config as unknown as ConnectionConfig : undefined;
|
||||
const syncNeededOnUpdate = currentConnectionConfig && JSON.stringify(currentConnectionConfig) !== JSON.stringify(newConnectionConfig);
|
||||
const syncNeededOnUpdate =
|
||||
(currentConnectionConfig && JSON.stringify(currentConnectionConfig) !== JSON.stringify(newConnectionConfig)) ||
|
||||
(currentConnection?.syncStatus === ConnectionSyncStatus.FAILED);
|
||||
|
||||
const connectionDb = await prisma.connection.upsert({
|
||||
where: {
|
||||
|
|
|
|||
|
|
@ -169,6 +169,7 @@ export const repositoryQuerySchema = z.object({
|
|||
repoId: z.number(),
|
||||
repoName: z.string(),
|
||||
repoCloneUrl: z.string(),
|
||||
webUrl: z.string().optional(),
|
||||
linkedConnections: z.array(z.object({
|
||||
id: z.number(),
|
||||
name: z.string(),
|
||||
|
|
|
|||
|
|
@ -63,7 +63,7 @@ export const getRepoQueryCodeHostInfo = (repo?: RepositoryQuery): CodeHostInfo |
|
|||
}
|
||||
|
||||
const displayName = repo.repoName.split('/').slice(-2).join('/');
|
||||
return _getCodeHostInfoInternal(repo.codeHostType, displayName, repo.repoCloneUrl);
|
||||
return _getCodeHostInfoInternal(repo.codeHostType, displayName, repo.webUrl ?? repo.repoCloneUrl);
|
||||
}
|
||||
|
||||
const _getCodeHostInfoInternal = (type: string, displayName: string, cloneUrl: string): CodeHostInfo | undefined => {
|
||||
|
|
@ -101,6 +101,7 @@ const _getCodeHostInfoInternal = (type: string, displayName: string, cloneUrl: s
|
|||
iconClassName: className,
|
||||
}
|
||||
}
|
||||
case 'gerrit':
|
||||
case 'gitiles': {
|
||||
const { src, className } = getCodeHostIcon('gerrit')!;
|
||||
return {
|
||||
|
|
|
|||
Loading…
Reference in a new issue