Skip to content
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
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,8 @@ worktrees
.superpowers
ui/src/generated/
ui/.vite/

# Python bytecode (added by lintel)
*.pyc
*.pyo
*.pyd
45 changes: 44 additions & 1 deletion ui/src/features/pipelines/pages/PipelineDetailPage.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { useEffect, useCallback } from 'react';
import { useParams, useNavigate, useSearchParams } from 'react-router';
import { useParams, useNavigate, useSearchParams, Link } from 'react-router';
import {
Title, Stack, Group, Badge, Text, Button, Paper, Loader, Center, Tabs, ScrollArea, Box,
Skeleton, Anchor,
} from '@mantine/core';
import { useMediaQuery } from '@mantine/hooks';
import { IconArrowLeft, IconPlayerStop, IconLayoutList, IconTrash } from '@tabler/icons-react';
Expand All @@ -12,6 +13,8 @@ import {
usePipelinesCancelPipeline,
usePipelinesDeletePipeline,
} from '@/generated/api/pipelines/pipelines';
import { useWorkItemsGetWorkItem } from '@/generated/api/work-items/work-items';
import { useBoardsListBoards } from '@/features/boards/api';
import { PipelineDAG } from '../components/PipelineDAG';
import type { DAGNode, DAGEdge } from '../components/PipelineDAG';
import { StepTimingBar } from '../components/StepTimingBar';
Expand Down Expand Up @@ -80,6 +83,31 @@ export function Component() {

const pipeline = (pipelineResp?.data ?? {}) as Record<string, unknown>;
const stages = (stagesResp?.data ?? []) as StageItem[];

// ── Work item subtitle: fetch work item when trigger_type starts with 'work_item:' ──
const workItemId = pipeline.work_item_id as string | undefined;
const isWorkItemTrigger = !!(
workItemId
&& (pipeline.trigger_type as string)?.startsWith('work_item:')
);

const {
data: workItemResp,
isLoading: isWorkItemLoading,
} = useWorkItemsGetWorkItem(workItemId ?? '', {
query: { enabled: isWorkItemTrigger },
});
const workItem = workItemResp?.data as
| { work_item_id: string; title: string; project_id: string }
| undefined;

// Fetch boards for the project to build the board link
const { data: boardsResp } = useBoardsListBoards(
isWorkItemTrigger ? (pipeline.project_id as string) : undefined,
);
const boardId = (
(boardsResp?.data ?? boardsResp) as { board_id: string }[] | undefined
)?.[0]?.board_id;
const cancelMut = usePipelinesCancelPipeline();
const deleteMut = usePipelinesDeletePipeline();
const handleActionComplete = useCallback(() => {
Expand Down Expand Up @@ -243,6 +271,21 @@ export function Component() {
{(pipeline.status as string) ?? 'unknown'}
</Badge>
</Group>
{isWorkItemTrigger && (
isWorkItemLoading
? <Skeleton data-testid="work-item-subtitle-skeleton" height={16} width={200} />
: workItem?.title && (
<Anchor
component={Link}
to={boardId ? `/boards/${boardId}?work_item=${workItem.work_item_id}` : '#'}
size="sm"
c="dimmed"
data-testid="work-item-subtitle"
>
{workItem.title}
</Anchor>
)
)}
<Group gap="sm" wrap="wrap">
{(pipeline.trigger_type as string)?.startsWith('chat:') && (
<Button
Expand Down
Loading