Skip to content

Commit

Permalink
Support copy in git new issue page (#940)
Browse files Browse the repository at this point in the history
resolves: #939

Signed-off-by: Lan Xia <Lan_Xia@ca.ibm.com>
  • Loading branch information
llxia authored Nov 22, 2024
1 parent 4f17b9c commit cb13a80
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 20 deletions.
22 changes: 22 additions & 0 deletions test-result-summary-client/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions test-result-summary-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"qs": "^6.11.1",
"react": "^18.2.0",
"react-app-rewired": "^2.2.1",
"react-copy-to-clipboard": "^5.1.0",
"react-day-picker": "^7.4.10",
"react-dom": "^18.2.0",
"react-grid-layout": "^0.16.6",
Expand Down
45 changes: 25 additions & 20 deletions test-result-summary-client/src/Build/GitNewIssue.jsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,15 @@
import React, { useEffect, useState } from 'react';
import { useLocation } from 'react-router-dom';
import { params } from '../utils/query';
import { Button, Tooltip, Card } from 'antd';
import { Button, Tooltip, Card, Space } from 'antd';
import TestBreadcrumb from './TestBreadcrumb';
import { GithubOutlined } from '@ant-design/icons';
import { GithubOutlined, CopyOutlined } from '@ant-design/icons';
import { getParams } from '../utils/query';
import { fetchData } from '../utils/Utils';
import renderDuration from './Duration';
import { getGitDiffLinks } from '../utils/Utils';
import { CopyToClipboard } from 'react-copy-to-clipboard';

import './table.css';

import moment from 'moment';
const DAY_FORMAT = 'MMM DD YYYY, hh:mm a';

const GitNewissue = () => {
const [state, setState] = useState({
body: '',
Expand All @@ -24,7 +20,6 @@ const GitNewissue = () => {
useEffect(() => {
async function updateData() {
const { testId, buildId } = getParams(location.search);
const originUrl = window.location.origin;
// fetch build data
const buildDataRes = fetchData(`/api/getData?_id=${buildId}`);
// fetch test data
Expand Down Expand Up @@ -115,18 +110,28 @@ const GitNewissue = () => {
bordered={true}
style={{ width: '100%' }}
extra={
<Tooltip title={`Create new issue at ${issueUrl}`}>
<a
href={`${issueUrl}issues/new${urlParams}`}
target="_blank"
rel="noopener noreferrer"
>
<Button size="large">
<GithubOutlined />
Create New Git Issue
</Button>
</a>
</Tooltip>
<div>
<Space>
<Tooltip title={`Create new issue at ${issueUrl}`}>
<a
href={`${issueUrl}issues/new${urlParams}`}
target="_blank"
rel="noopener noreferrer"
>
<Button size="large">
<GithubOutlined />
Create New Git Issue
</Button>
</a>
</Tooltip>
<CopyToClipboard text={body}>
<Button size="large">
<CopyOutlined />
Copy
</Button>
</CopyToClipboard>
</Space>
</div>
}
>
<pre className="card-body">{body}</pre>
Expand Down

0 comments on commit cb13a80

Please sign in to comment.