-
Notifications
You must be signed in to change notification settings - Fork 54
Feature: Template build details page #204
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
ben-fornefeld
merged 34 commits into
main
from
implement-template-build-details-page-eng-3335
Dec 18, 2025
Merged
Changes from 9 commits
Commits
Show all changes
34 commits
Select commit
Hold shift + click to select a range
03c44ea
squash merge impl-builds-page
ben-fornefeld e7a8a95
add router, layout and url config
ben-fornefeld acfc72c
abstract details row, create header component
ben-fornefeld 75c9a93
wip
ben-fornefeld 76ea19f
implement virtualized and prefetched logs viewer
ben-fornefeld b79738f
finalize
ben-fornefeld 0959eed
Merge branch 'main' into implement-template-build-details-page-eng-3335
ben-fornefeld 3ba7070
Refactor dashboard components and update configurations
ben-fornefeld 1949a44
handle build not found and log retention
ben-fornefeld 78994cf
truncate layout header
ben-fornefeld 28e4c8d
unswallow not found
ben-fornefeld a4c8c58
improve: first timestamp detection for logs
ben-fornefeld d62c21e
fix: copyablebuttoninline truncation
ben-fornefeld dedd6b7
chore: update infra openapi spec
ben-fornefeld 9ccabf4
refactor: use template build logs endpoint with correct pagination
ben-fornefeld 69b52b0
fix: log filtering
ben-fornefeld 7b03d7e
finalize
ben-fornefeld 910e8c8
feat: enhance log uniqueness with composite key
ben-fornefeld dbeefe4
Merge remote-tracking branch 'origin/main' into implement-template-bu…
ben-fornefeld 2bc0afa
chore
ben-fornefeld aaecc56
refactor: forward logs handling
ben-fornefeld 85dbb36
remove: log deduplication
ben-fornefeld 56fa42e
chore
ben-fornefeld 1d31a7e
remove: source setting on infra logs route
ben-fornefeld f40aa86
improve: builds table + move log retention message to build details page
ben-fornefeld a3822dd
improve: error handling for not found bulids + status message styling
ben-fornefeld 3fd76ee
refactor: zustand logs handling
ben-fornefeld c8d7915
improve: fetching and lodaing ui
ben-fornefeld 5dd9e33
chore
ben-fornefeld de4a968
improve: logs store
ben-fornefeld 64f4d2f
chore
ben-fornefeld 93598ff
fix: adjust log order and improve scrolling behavior in logs component
ben-fornefeld a998574
fix: enhance build logs fetching and display logic
ben-fornefeld 1c4739e
feat: update dashboard layout to support title segments with links
ben-fornefeld File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
src/app/dashboard/[teamIdOrSlug]/templates/[templateId]/builds/[buildId]/loading.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { default } from '@/features/dashboard/loading-layout' |
38 changes: 38 additions & 0 deletions
38
src/app/dashboard/[teamIdOrSlug]/templates/[templateId]/builds/[buildId]/page.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| import BuildHeader from '@/features/dashboard/build/header' | ||
| import Logs from '@/features/dashboard/build/logs' | ||
| import { getQueryClient, HydrateClient, trpc } from '@/trpc/server' | ||
| import { TRPCError } from '@trpc/server' | ||
| import { notFound } from 'next/navigation' | ||
|
|
||
| export default async function BuildPage({ | ||
| params, | ||
| }: PageProps<'/dashboard/[teamIdOrSlug]/templates/[templateId]/builds/[buildId]'>) { | ||
| const { teamIdOrSlug, templateId, buildId } = await params | ||
|
|
||
| const queryClient = getQueryClient() | ||
|
|
||
| try { | ||
| const data = await queryClient.fetchQuery( | ||
| trpc.builds.buildDetails.queryOptions({ | ||
| teamIdOrSlug, | ||
| templateId, | ||
| buildId, | ||
| }) | ||
| ) | ||
|
|
||
| if (!data.hasRetainedLogs) throw notFound() | ||
| } catch (error) { | ||
| if (error instanceof TRPCError && error.code === 'NOT_FOUND') { | ||
| throw notFound() | ||
| } | ||
| } | ||
|
|
||
| return ( | ||
| <HydrateClient> | ||
| <div className="h-full min-h-0 flex-1 p-3 md:p-6 flex flex-col gap-6"> | ||
| <BuildHeader params={params} /> | ||
| <Logs params={params} /> | ||
| </div> | ||
| </HydrateClient> | ||
| ) | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,100 @@ | ||
| import { PROTECTED_URLS } from '@/configs/urls' | ||
| import { | ||
| formatDurationCompact, | ||
| formatTimeAgoCompact, | ||
| } from '@/lib/utils/formatting' | ||
| import { cn } from '@/lib/utils/ui' | ||
| import CopyButtonInline from '@/ui/copy-button-inline' | ||
| import { Button } from '@/ui/primitives/button' | ||
| import { ArrowUpRight } from 'lucide-react' | ||
| import { useParams, useRouter } from 'next/navigation' | ||
| import { useEffect, useState } from 'react' | ||
| import { useTemplateTableStore } from '../templates/list/stores/table-store' | ||
|
|
||
| export function Template({ | ||
| template, | ||
| templateId, | ||
| className, | ||
| }: { | ||
| template: string | ||
| templateId: string | ||
| className?: string | ||
| }) { | ||
| const router = useRouter() | ||
| const { teamIdOrSlug } = | ||
| useParams< | ||
| Awaited<PageProps<'/dashboard/[teamIdOrSlug]/templates'>['params']> | ||
| >() | ||
|
|
||
| return ( | ||
| <Button | ||
| variant="link" | ||
| className={cn( | ||
| 'text-fg h-auto p-0 gap-1 font-sans prose-table normal-case max-w-full', | ||
| className | ||
| )} | ||
| onClick={(e) => { | ||
| e.stopPropagation() | ||
| e.preventDefault() | ||
|
|
||
| useTemplateTableStore.getState().setGlobalFilter(templateId) | ||
| router.push(PROTECTED_URLS.TEMPLATES_LIST(teamIdOrSlug)) | ||
| }} | ||
| > | ||
| <p className="truncate">{template}</p> | ||
| <ArrowUpRight className="size-3 min-w-3" /> | ||
| </Button> | ||
| ) | ||
| } | ||
|
|
||
| export function RanFor({ | ||
| startedAt, | ||
| finishedAt, | ||
| isBuilding, | ||
| }: { | ||
| startedAt: number | ||
| finishedAt: number | null | ||
| isBuilding: boolean | ||
| }) { | ||
| const [now, setNow] = useState(() => Date.now()) | ||
|
|
||
| useEffect(() => { | ||
| if (!isBuilding) return | ||
|
|
||
| const interval = setInterval(() => { | ||
| setNow(Date.now()) | ||
| }, 1000) | ||
|
|
||
| return () => clearInterval(interval) | ||
| }, [isBuilding]) | ||
|
|
||
| const duration = isBuilding | ||
| ? now - startedAt | ||
| : (finishedAt ?? now) - startedAt | ||
| const iso = finishedAt ? new Date(finishedAt).toISOString() : null | ||
|
|
||
| if (isBuilding || !iso) { | ||
| return ( | ||
| <span className="whitespace-nowrap text-fg-tertiary"> | ||
| {formatDurationCompact(duration)} | ||
| </span> | ||
| ) | ||
| } | ||
|
|
||
| return ( | ||
| <CopyButtonInline value={iso} className="whitespace-nowrap"> | ||
| {formatDurationCompact(duration)} | ||
| </CopyButtonInline> | ||
cursor[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| ) | ||
| } | ||
|
|
||
| export function StartedAt({ timestamp }: { timestamp: number }) { | ||
| const iso = new Date(timestamp).toISOString() | ||
| const elapsed = Date.now() - timestamp | ||
|
|
||
| return ( | ||
| <CopyButtonInline value={iso} className="whitespace-nowrap"> | ||
| {formatTimeAgoCompact(elapsed)} | ||
| </CopyButtonInline> | ||
| ) | ||
| } | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.