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