Skip to content

Commit c1a8138

Browse files
committed
feat: page header for traces
1 parent 771db32 commit c1a8138

File tree

3 files changed

+66
-29
lines changed

3 files changed

+66
-29
lines changed

packages/web/app/src/pages/target-app-version.tsx

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import { useEffect, useState } from 'react';
2-
import ghost from '../../public/images/figures/ghost.svg?url';
32
import { LoaderCircleIcon } from 'lucide-react';
43
import { useClient, useQuery } from 'urql';
54
import { AppFilter } from '@/components/apps/AppFilter';
5+
import { NotFoundContent } from '@/components/common/not-found-content';
66
import { Page, TargetLayout } from '@/components/layouts/target';
77
import { Button } from '@/components/ui/button';
88
import { CardDescription } from '@/components/ui/card';
@@ -157,20 +157,10 @@ function TargetAppVersionContent(props: {
157157
return (
158158
<>
159159
<Meta title="App Version Not found" />
160-
<div className="flex h-full flex-1 flex-col items-center justify-center gap-2.5 py-6">
161-
<img
162-
src={ghost}
163-
alt="Ghost illustration"
164-
width="200"
165-
height="200"
166-
className="drag-none"
167-
/>
168-
<h2 className="text-xl font-bold">App Version not found.</h2>
169-
<h3 className="font-semibold">This app does not seem to exist anymore.</h3>
170-
<Button variant="secondary" className="mt-2" onClick={router.history.back}>
171-
Go back
172-
</Button>
173-
</div>
160+
<NotFoundContent
161+
heading="App Version not found."
162+
subheading="This app does not seem to exist anymore."
163+
/>
174164
</>
175165
);
176166
}

packages/web/app/src/pages/target-trace.tsx

Lines changed: 50 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,13 @@ import {
2222
import AutoSizer from 'react-virtualized-auto-sizer';
2323
import { useQuery } from 'urql';
2424
import { GraphQLHighlight } from '@/components/common/GraphQLSDLBlock';
25+
import { NotFoundContent } from '@/components/common/not-found-content';
2526
import { Page, TargetLayout } from '@/components/layouts/target';
2627
import { Badge } from '@/components/ui/badge';
2728
import { Button } from '@/components/ui/button';
29+
import { CardDescription } from '@/components/ui/card';
2830
import { Meta } from '@/components/ui/meta';
31+
import { SubPageLayoutHeader } from '@/components/ui/page-content-layout';
2932
import { ResizableHandle, ResizablePanel, ResizablePanelGroup } from '@/components/ui/resizable';
3033
import { ScrollArea } from '@/components/ui/scroll-area';
3134
import {
@@ -36,6 +39,7 @@ import {
3639
SheetHeader,
3740
SheetTitle,
3841
} from '@/components/ui/sheet';
42+
import { Skeleton } from '@/components/ui/skeleton';
3943
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip';
4044
import { FragmentType, graphql, useFragment } from '@/gql';
4145
import { useClipboard } from '@/lib/hooks';
@@ -1010,19 +1014,53 @@ function TargetInsightsNewPageContent(props: {
10101014
},
10111015
});
10121016

1013-
if (!result.data?.target?.trace) {
1014-
return null;
1015-
}
1016-
10171017
return (
1018-
<TraceSheet
1019-
organizationSlug={props.organizationSlug}
1020-
projectSlug={props.projectSlug}
1021-
targetSlug={props.targetSlug}
1022-
trace={result.data.target.trace}
1023-
activeSpanId={props.activeSpanId}
1024-
activeSpanTab={props.activeSpanTab}
1025-
/>
1018+
<div className="flex h-full flex-col space-y-4 pt-6">
1019+
<Meta title={`Trace ${props.traceId}`} />
1020+
<SubPageLayoutHeader
1021+
subPageTitle={
1022+
<span className="flex items-center">
1023+
<Link
1024+
to="/$organizationSlug/$projectSlug/$targetSlug/traces"
1025+
params={{
1026+
organizationSlug: props.organizationSlug,
1027+
projectSlug: props.projectSlug,
1028+
targetSlug: props.targetSlug,
1029+
}}
1030+
>
1031+
Traces
1032+
</Link>{' '}
1033+
<span className="inline-block px-2 italic text-gray-500">/</span>{' '}
1034+
{result.data?.target?.trace ? (
1035+
result.data.target.trace.id
1036+
) : (
1037+
<Skeleton className="inline-block h-5 w-[150px]" />
1038+
)}
1039+
</span>
1040+
}
1041+
description={
1042+
<>
1043+
<CardDescription>Insights into the requests made to your GraphQL API.</CardDescription>
1044+
</>
1045+
}
1046+
/>
1047+
{result.data?.target?.trace && (
1048+
<TraceSheet
1049+
organizationSlug={props.organizationSlug}
1050+
projectSlug={props.projectSlug}
1051+
targetSlug={props.targetSlug}
1052+
trace={result.data.target.trace}
1053+
activeSpanId={props.activeSpanId}
1054+
activeSpanTab={props.activeSpanTab}
1055+
/>
1056+
)}
1057+
{!result.data?.target?.trace && !result.fetching && (
1058+
<>
1059+
<Meta title="Trace Not found" />
1060+
<NotFoundContent heading="Trace not found." subheading="This trace does not exist." />
1061+
</>
1062+
)}
1063+
</div>
10261064
);
10271065
}
10281066

@@ -1036,7 +1074,6 @@ export function TargetTracePage(props: {
10361074
}) {
10371075
return (
10381076
<>
1039-
<Meta title={`Trace ${props.traceId}`} />
10401077
<TargetLayout
10411078
organizationSlug={props.organizationSlug}
10421079
projectSlug={props.projectSlug}

packages/web/app/src/pages/target-traces.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,15 @@ import { z } from 'zod';
1616
import { Page, TargetLayout, useTargetReference } from '@/components/layouts/target';
1717
import { Badge } from '@/components/ui/badge';
1818
import { Button } from '@/components/ui/button';
19+
import { CardDescription } from '@/components/ui/card';
1920
import {
2021
ChartConfig,
2122
ChartContainer,
2223
ChartTooltip,
2324
ChartTooltipContent,
2425
} from '@/components/ui/chart';
2526
import { Meta } from '@/components/ui/meta';
27+
import { SubPageLayoutHeader } from '@/components/ui/page-content-layout';
2628
import { QueryError } from '@/components/ui/query-error';
2729
import {
2830
Sheet,
@@ -1267,7 +1269,15 @@ function TargetTracesPageContent(props: SortProps & PaginationProps & FilterProp
12671269

12681270
return (
12691271
<div className="py-6">
1270-
<SidebarProvider>
1272+
<SubPageLayoutHeader
1273+
subPageTitle="Traces"
1274+
description={
1275+
<>
1276+
<CardDescription>Insights into the requests made to your GraphQL API.</CardDescription>
1277+
</>
1278+
}
1279+
/>
1280+
<SidebarProvider className="mt-4">
12711281
<Sidebar collapsible="none" className="bg-transparent">
12721282
<SidebarContent>
12731283
<Filters filter={props.filter} options={filterOptions} />

0 commit comments

Comments
 (0)