MCPcopy Index your code
hub / github.com/OpenPipe/OpenPipe / TableHeader

Function TableHeader

app/src/components/requestLogs/TableRow.tsx:37–92  ·  view source on GitHub ↗
({ showOptions }: { showOptions?: boolean })

Source from the content-addressed store, hash-verified

35type LoggedCall = RouterOutputs["loggedCalls"]["list"]["calls"][0];
36
37export const TableHeader = ({ showOptions }: { showOptions?: boolean }) => {
38 const loggedCallsCount = useLoggedCallsCount();
39 const deselectedLogIds = useAppStore((s) => s.selectedLogs.deselectedLogIds);
40 const defaultToSelected = useAppStore((s) => s.selectedLogs.defaultToSelected);
41 const toggleAllSelected = useAppStore((s) => s.selectedLogs.toggleAllSelected);
42 const tagNames = useSelectedProject().data?.tagNames;
43 const visibleColumns = useAppStore((s) => s.columnVisibility.visibleColumns);
44
45 const totalNumLogsSelected = useTotalNumLogsSelected();
46
47 const isClientInitialized = useIsClientInitialized();
48 if (!isClientInitialized) return null;
49
50 return (
51 <Thead>
52 <Tr>
53 {showOptions && (
54 <Th pr={0}>
55 <HStack minW={16}>
56 <Checkbox
57 isChecked={defaultToSelected && !deselectedLogIds.size && totalNumLogsSelected > 0}
58 onChange={toggleAllSelected}
59 _hover={{ borderColor: "gray.300" }}
60 />
61 <Skeleton
62 startColor="gray.100"
63 endColor="gray.300"
64 isLoaded={!loggedCallsCount.isLoading}
65 minW={16}
66 >
67 <Text>
68 ({totalNumLogsSelected ? `${totalNumLogsSelected.toLocaleString()}/` : ""}
69 {(loggedCallsCount.data?.count ?? 0).toLocaleString()})
70 </Text>
71 </Skeleton>
72 </HStack>
73 </Th>
74 )}
75 {visibleColumns.has(StaticColumnKeys.SENT_AT) && <Th>Sent At</Th>}
76 {visibleColumns.has(StaticColumnKeys.MODEL) && <Th>Model</Th>}
77 {tagNames
78 ?.filter((tagName) => visibleColumns.has(tagName))
79 .map((tagName) => (
80 <Th key={tagName} textTransform={"none"}>
81 {tagName}
82 </Th>
83 ))}
84 {visibleColumns.has(StaticColumnKeys.DURATION) && <Th isNumeric>Duration</Th>}
85 {visibleColumns.has(StaticColumnKeys.INPUT_TOKENS) && <Th isNumeric>Input tokens</Th>}
86 {visibleColumns.has(StaticColumnKeys.OUTPUT_TOKENS) && <Th isNumeric>Output tokens</Th>}
87 {visibleColumns.has(StaticColumnKeys.COST) && <Th isNumeric>Cost</Th>}
88 {visibleColumns.has(StaticColumnKeys.STATUS_CODE) && <Th isNumeric>Status</Th>}
89 </Tr>
90 </Thead>
91 );
92};
93
94export const TableRow = ({

Callers

nothing calls this directly

Calls 4

useLoggedCallsCountFunction · 0.90
useSelectedProjectFunction · 0.90
useTotalNumLogsSelectedFunction · 0.90
useIsClientInitializedFunction · 0.90

Tested by

no test coverage detected