@@ -2,6 +2,13 @@ import React, {useEffect, useState} from 'react';
2
2
import { util } from 'zod' ;
3
3
import { BlobReference } from '@/graphql/__generated__/graphql' ;
4
4
import { LogViewerCard } from "@/components/LogViewer" ;
5
+ import { env } from 'next-runtime-env' ;
6
+ import { Button , Card , Space , Tooltip } from 'antd' ;
7
+ import ButtonGroup from 'antd/es/button/button-group' ;
8
+ import { DownloadOutlined , WarningOutlined } from '@ant-design/icons' ;
9
+ import Link from 'next/link' ;
10
+ import styles from "@/components/LogViewer/index.module.css"
11
+ import DownloadButton from '@/components/DownloadButton' ;
5
12
6
13
interface Props {
7
14
blobReference : BlobReference ;
@@ -10,8 +17,26 @@ interface Props {
10
17
11
18
const DEFAULT_TAIL_BYTES = 10_000 ;
12
19
20
+
21
+
13
22
/* eslint-disable consistent-return */
14
23
const LogOutput : React . FC < Props > = ( { blobReference, tailBytes = DEFAULT_TAIL_BYTES } ) => {
24
+ // if (blobReference.ephemeralURL != "" && env('NEXT_PUBLIC_BROWSER_URL')) {
25
+ // const url = new URL(blobReference.ephemeralURL, env('NEXT_PUBLIC_BROWSER_URL'))
26
+ // var logDownload = <Space direction="horizontal" size="small">
27
+ // <Card>
28
+ // <ButtonGroup>
29
+ // <Button>
30
+ // <DownloadOutlined/>
31
+ // <Link href={url.toString()} download="test.log" target="_self">Download Log File</Link>
32
+ // </Button>
33
+ // <Tooltip title="Depending on the configuration of your remote cache, this link may point to ephemeral content and it could disappear.">
34
+ // <Button icon={<WarningOutlined/>} danger/>
35
+ // </Tooltip>
36
+ // </ButtonGroup>
37
+ // </Card>
38
+ // </Space>
39
+ // }
15
40
const [ contents , setContents ] = useState < string > ( "" ) ;
16
41
useEffect ( ( ) => {
17
42
fetch ( blobReference . downloadURL , {
@@ -39,6 +64,21 @@ const LogOutput: React.FC<Props> = ({blobReference, tailBytes = DEFAULT_TAIL_BYT
39
64
validContent = selectedLines . join ( '\n' )
40
65
}
41
66
67
+ if ( blobReference . ephemeralURL != "" && env ( 'NEXT_PUBLIC_BROWSER_URL' ) ) {
68
+ console . log ( "blobReference.ephemeralURL=" , blobReference . ephemeralURL )
69
+ const url = new URL ( blobReference . ephemeralURL , env ( 'NEXT_PUBLIC_BROWSER_URL' ) )
70
+ return < Space direction = "horizontal" size = "small" >
71
+ < Card >
72
+ < ButtonGroup >
73
+ < DownloadButton url = { url . toString ( ) } enabled = { true } buttonLabel = "Download Log File" fileName = "output.log" />
74
+ < Tooltip title = "Depending on the configuration of your remote cache, this link may point to ephemeral content and it could disappear." >
75
+ < Button icon = { < WarningOutlined /> } danger />
76
+ </ Tooltip >
77
+ </ ButtonGroup >
78
+ </ Card >
79
+ </ Space >
80
+ }
81
+
42
82
return < LogViewerCard log = { validContent } /> ;
43
83
} ;
44
84
0 commit comments