Skip to content

Commit a2eefd4

Browse files
committed
✨ Implement task: Repo selection failed with no intergrations
Task ID: 2348a2cd-5fd7-4637-91d9-1b7f6957cbfc Generated by PostHog Agent Plan Summary: I'll analyze the codebase to understand the issue with repo selection when no GitHub integration is set up. Let me start by exploring the relevant files. This commit implements the changes described in the task plan.
1 parent c85b632 commit a2eefd4

File tree

1 file changed

+53
-31
lines changed

1 file changed

+53
-31
lines changed

src/renderer/components/TaskDetail.tsx

Lines changed: 53 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import {
1313
import type { Task } from "@shared/types";
1414
import { format } from "date-fns";
1515
import { useEffect, useMemo, useRef, useState } from "react";
16+
import { useAuthStore } from "../stores/authStore";
1617
import { useIntegrationStore } from "../stores/integrationStore";
1718
import { useStatusBarStore } from "../stores/statusBarStore";
1819
import { useTabStore } from "../stores/tabStore";
@@ -40,6 +41,7 @@ export function TaskDetail({ task: initialTask }: TaskDetailProps) {
4041
const { repositories } = useIntegrationStore();
4142
const { updateTask, tasks } = useTaskStore();
4243
const { updateTabTitle, activeTabId } = useTabStore();
44+
const { user, apiHost } = useAuthStore();
4345
const workflows = useWorkflowStore((state) => state.workflows);
4446
const fetchWorkflows = useWorkflowStore((state) => state.fetchWorkflows);
4547
const workflowOptions = useMemo(
@@ -59,7 +61,11 @@ export function TaskDetail({ task: initialTask }: TaskDetailProps) {
5961
const { isRunning, logs, repoPath, runMode, progress } = taskState;
6062

6163
const [selectedRepo, setSelectedRepo] = useState<string>(() => {
62-
if (task.repository_config) {
64+
if (
65+
task.repository_config &&
66+
task.repository_config.organization &&
67+
task.repository_config.repository
68+
) {
6369
return `${task.repository_config.organization}/${task.repository_config.repository}`;
6470
}
6571
return "";
@@ -299,37 +305,53 @@ export function TaskDetail({ task: initialTask }: TaskDetailProps) {
299305
<DataList.Value>
300306
<Flex gap="2" align="center">
301307
{repositories.length > 0 ? (
302-
<Combobox
303-
items={repositories.map((repo) => ({
304-
value: `${repo.organization}/${repo.repository}`,
305-
label: `${repo.organization}/${repo.repository}`,
306-
}))}
307-
value={selectedRepo}
308-
onValueChange={handleRepositoryChange}
309-
placeholder="Select a repository..."
310-
searchPlaceholder="Search repositories..."
311-
emptyMessage="No repositories found"
312-
size="2"
313-
/>
314-
) : selectedRepo ? (
315-
<Code size="2">{selectedRepo}</Code>
308+
<>
309+
<Combobox
310+
items={repositories.map((repo) => ({
311+
value: `${repo.organization}/${repo.repository}`,
312+
label: `${repo.organization}/${repo.repository}`,
313+
}))}
314+
value={selectedRepo}
315+
onValueChange={handleRepositoryChange}
316+
placeholder="Select a repository..."
317+
searchPlaceholder="Search repositories..."
318+
emptyMessage="No repositories found"
319+
size="2"
320+
/>
321+
{selectedRepo && selectedRepo !== "__none__" && (
322+
<Button
323+
size="1"
324+
variant="ghost"
325+
onClick={() =>
326+
window.electronAPI.openExternal(
327+
`https://github.com/${selectedRepo}`,
328+
)
329+
}
330+
>
331+
<ExternalLinkIcon />
332+
</Button>
333+
)}
334+
</>
316335
) : (
317-
<Code size="2" color="gray">
318-
None
319-
</Code>
320-
)}
321-
{selectedRepo && selectedRepo !== "__none__" && (
322-
<Button
323-
size="1"
324-
variant="ghost"
325-
onClick={() =>
326-
window.electronAPI.openExternal(
327-
`https://github.com/${selectedRepo}`,
328-
)
329-
}
330-
>
331-
<ExternalLinkIcon />
332-
</Button>
336+
<Flex direction="column" gap="2">
337+
<Code size="2" color="gray">
338+
No GitHub integration configured
339+
</Code>
340+
{user?.team?.id && (
341+
<Button
342+
size="1"
343+
variant="outline"
344+
onClick={() =>
345+
window.electronAPI.openExternal(
346+
`${apiHost}/project/${user.team.id}/settings/environment-integrations`,
347+
)
348+
}
349+
>
350+
Set up GitHub integration
351+
<ExternalLinkIcon />
352+
</Button>
353+
)}
354+
</Flex>
333355
)}
334356
</Flex>
335357
</DataList.Value>

0 commit comments

Comments
 (0)