@@ -73,6 +73,7 @@ import { useOrganization } from "~/hooks/useOrganizations";
7373import { useProject } from "~/hooks/useProject" ;
7474import { useSearchParams } from "~/hooks/useSearchParam" ;
7575import { useHasAdminAccess } from "~/hooks/useUser" ;
76+ import { useCanViewLogsPage } from "~/hooks/useCanViewLogsPage" ;
7677import { redirectWithErrorMessage } from "~/models/message.server" ;
7778import { type Span , SpanPresenter , type SpanRun } from "~/presenters/v3/SpanPresenter.server" ;
7879import { logger } from "~/services/logger.server" ;
@@ -319,6 +320,7 @@ function RunBody({
319320 const { value, replace } = useSearchParams ( ) ;
320321 const tab = value ( "tab" ) ;
321322 const resetFetcher = useTypedFetcher < typeof resetIdempotencyKeyAction > ( ) ;
323+ const canViewLogsPage = useCanViewLogsPage ( ) ;
322324
323325 return (
324326 < div className = "grid h-full max-h-full grid-rows-[2.5rem_2rem_1fr_minmax(3.25rem,auto)] overflow-hidden bg-background-bright" >
@@ -1012,44 +1014,55 @@ function RunBody({
10121014 </ div >
10131015 < div className = "flex items-center" >
10141016 { run . logsDeletedAt === null ? (
1015- < div className = "flex" >
1017+ canViewLogsPage ? (
1018+ < div className = "flex" >
1019+ < LinkButton
1020+ to = { `${ v3LogsPath ( organization , project , environment ) } ?runId=${ runParam } &from=${
1021+ new Date ( run . createdAt ) . getTime ( ) - 60000
1022+ } `}
1023+ variant = "secondary/medium"
1024+ className = "rounded-r-none border-r-0"
1025+ >
1026+ View logs
1027+ </ LinkButton >
1028+ < Popover >
1029+ < PopoverTrigger asChild >
1030+ < Button
1031+ variant = "secondary/medium"
1032+ className = "rounded-l-none border-l-charcoal-700 px-1.5"
1033+ >
1034+ < ChevronUpIcon className = "size-4 transition group-hover/button:text-text-bright" />
1035+ </ Button >
1036+ </ PopoverTrigger >
1037+ < PopoverContent className = "min-w-[140px] p-1" align = "end" >
1038+ < PopoverMenuItem
1039+ to = { `${ v3LogsPath ( organization , project , environment ) } ?runId=${ runParam } &from=${
1040+ new Date ( run . createdAt ) . getTime ( ) - 60000
1041+ } `}
1042+ title = "View logs"
1043+ icon = { ArrowRightIcon }
1044+ leadingIconClassName = "text-blue-500"
1045+ />
1046+ < PopoverMenuItem
1047+ to = { v3RunDownloadLogsPath ( { friendlyId : runParam } ) }
1048+ title = "Download logs"
1049+ icon = { CloudArrowDownIcon }
1050+ leadingIconClassName = "text-indigo-500"
1051+ openInNewTab
1052+ />
1053+ </ PopoverContent >
1054+ </ Popover >
1055+ </ div >
1056+ ) : (
10161057 < LinkButton
1017- to = { ` ${ v3LogsPath ( organization , project , environment ) } ?runId= ${ runParam } &from= ${
1018- new Date ( run . createdAt ) . getTime ( ) - 60000
1019- } ` }
1058+ to = { v3RunDownloadLogsPath ( { friendlyId : runParam } ) }
1059+ LeadingIcon = { CloudArrowDownIcon }
1060+ leadingIconClassName = "text-indigo-400"
10201061 variant = "secondary/medium"
1021- className = "rounded-r-none border-r-0"
10221062 >
1023- View logs
1063+ Download logs
10241064 </ LinkButton >
1025- < Popover >
1026- < PopoverTrigger asChild >
1027- < Button
1028- variant = "secondary/medium"
1029- className = "rounded-l-none border-l-charcoal-700 px-1.5"
1030- >
1031- < ChevronUpIcon className = "size-4 transition group-hover/button:text-text-bright" />
1032- </ Button >
1033- </ PopoverTrigger >
1034- < PopoverContent className = "min-w-[140px] p-1" align = "end" >
1035- < PopoverMenuItem
1036- to = { `${ v3LogsPath ( organization , project , environment ) } ?runId=${ runParam } &from=${
1037- new Date ( run . createdAt ) . getTime ( ) - 60000
1038- } `}
1039- title = "View logs"
1040- icon = { ArrowRightIcon }
1041- leadingIconClassName = "text-blue-500"
1042- />
1043- < PopoverMenuItem
1044- to = { v3RunDownloadLogsPath ( { friendlyId : runParam } ) }
1045- title = "Download logs"
1046- icon = { CloudArrowDownIcon }
1047- leadingIconClassName = "text-indigo-500"
1048- openInNewTab
1049- />
1050- </ PopoverContent >
1051- </ Popover >
1052- </ div >
1065+ )
10531066 ) : null }
10541067 </ div >
10551068 </ div >
0 commit comments