1
1
import React , { useEffect , useState } from 'react' ;
2
2
import { useLocation } from 'react-router-dom' ;
3
3
import { params } from '../utils/query' ;
4
- import { Button , Tooltip , Card } from 'antd' ;
4
+ import { Button , Tooltip , Card , Space } from 'antd' ;
5
5
import TestBreadcrumb from './TestBreadcrumb' ;
6
- import { GithubOutlined } from '@ant-design/icons' ;
6
+ import { GithubOutlined , CopyOutlined } from '@ant-design/icons' ;
7
7
import { getParams } from '../utils/query' ;
8
8
import { fetchData } from '../utils/Utils' ;
9
- import renderDuration from './Duration' ;
10
- import { getGitDiffLinks } from '../utils/Utils' ;
9
+ import { CopyToClipboard } from 'react-copy-to-clipboard' ;
11
10
12
11
import './table.css' ;
13
12
14
- import moment from 'moment' ;
15
- const DAY_FORMAT = 'MMM DD YYYY, hh:mm a' ;
16
-
17
13
const GitNewissue = ( ) => {
18
14
const [ state , setState ] = useState ( {
19
15
body : '' ,
@@ -24,7 +20,6 @@ const GitNewissue = () => {
24
20
useEffect ( ( ) => {
25
21
async function updateData ( ) {
26
22
const { testId, buildId } = getParams ( location . search ) ;
27
- const originUrl = window . location . origin ;
28
23
// fetch build data
29
24
const buildDataRes = fetchData ( `/api/getData?_id=${ buildId } ` ) ;
30
25
// fetch test data
@@ -115,18 +110,28 @@ const GitNewissue = () => {
115
110
bordered = { true }
116
111
style = { { width : '100%' } }
117
112
extra = {
118
- < Tooltip title = { `Create new issue at ${ issueUrl } ` } >
119
- < a
120
- href = { `${ issueUrl } issues/new${ urlParams } ` }
121
- target = "_blank"
122
- rel = "noopener noreferrer"
123
- >
124
- < Button size = "large" >
125
- < GithubOutlined />
126
- Create New Git Issue
127
- </ Button >
128
- </ a >
129
- </ Tooltip >
113
+ < div >
114
+ < Space >
115
+ < Tooltip title = { `Create new issue at ${ issueUrl } ` } >
116
+ < a
117
+ href = { `${ issueUrl } issues/new${ urlParams } ` }
118
+ target = "_blank"
119
+ rel = "noopener noreferrer"
120
+ >
121
+ < Button size = "large" >
122
+ < GithubOutlined />
123
+ Create New Git Issue
124
+ </ Button >
125
+ </ a >
126
+ </ Tooltip >
127
+ < CopyToClipboard text = { body } >
128
+ < Button size = "large" >
129
+ < CopyOutlined />
130
+ Copy
131
+ </ Button >
132
+ </ CopyToClipboard >
133
+ </ Space >
134
+ </ div >
130
135
}
131
136
>
132
137
< pre className = "card-body" > { body } </ pre >
0 commit comments