({ showOptions }: { showOptions?: boolean })
| 35 | type LoggedCall = RouterOutputs["loggedCalls"]["list"]["calls"][0]; |
| 36 | |
| 37 | export 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 | |
| 94 | export const TableRow = ({ |
nothing calls this directly
no test coverage detected