Skip to content

Repository weburl #243

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 24, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions packages/backend/src/repoCompileUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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!,
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
-- AlterTable
ALTER TABLE "Repo" ADD COLUMN "webUrl" TEXT;
1 change: 1 addition & 0 deletions packages/db/prisma/schema.prisma
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ model Repo {
isArchived Boolean
metadata Json
cloneUrl String
webUrl String?
connections RepoToConnection[]
imageUrl String?
repoIndexingStatus RepoIndexingStatus @default(NEW)
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
8 changes: 6 additions & 2 deletions packages/web/src/app/[domain]/components/navigationMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,12 @@ export const NavigationMenu = async ({

<div className="flex flex-row items-center gap-2">
<ProgressNavIndicator />
<WarningNavIndicator />
<ErrorNavIndicator />
{env.SOURCEBOT_AUTH_ENABLED === 'true' && (
<>
<WarningNavIndicator />
<ErrorNavIndicator />
</>
)}
<TrialNavIndicator subscription={subscription} />
<form
action={async () => {
Expand Down
2 changes: 1 addition & 1 deletion packages/web/src/app/[domain]/repos/repositoryTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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();
});
Expand Down
7 changes: 3 additions & 4 deletions packages/web/src/initialize.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down
1 change: 1 addition & 0 deletions packages/web/src/lib/schemas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down
3 changes: 2 additions & 1 deletion packages/web/src/lib/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 => {
Expand Down Expand Up @@ -101,6 +101,7 @@ const _getCodeHostInfoInternal = (type: string, displayName: string, cloneUrl: s
iconClassName: className,
}
}
case 'gerrit':
case 'gitiles': {
const { src, className } = getCodeHostIcon('gerrit')!;
return {
Expand Down