Update: update db-trace copy (#232)
* Update: update db-trace copy
* Update: update copyed => copied
diff --git a/src/components/Trace/TraceListDB/index.js b/src/components/Trace/TraceListDB/index.js
index 62ee941..5cb8792 100644
--- a/src/components/Trace/TraceListDB/index.js
+++ b/src/components/Trace/TraceListDB/index.js
@@ -16,7 +16,7 @@
*/
import React, { PureComponent } from 'react';
-import {List, Button } from 'antd';
+import {List, Button, message } from 'antd';
import Ellipsis from 'ant-design-pro/lib/Ellipsis';
import styles from './index.less';
@@ -33,6 +33,14 @@
}}
/>
<div className={styles.mainInfo}>
+ <a
+ style={{
+ margin: '0 10px',
+ }}
+ onClick={this.handleClick.bind(this, opName)}
+ >
+ Copy
+ </a>
<Ellipsis length={100} tooltip style={{ width: 'initial' }}>
{opName}
</Ellipsis>
@@ -42,6 +50,18 @@
);
};
+ handleClick = (i) => {
+ const input = document.createElement('input');
+ input.value = i;
+ message.info('copied');
+ document.body.appendChild(input);
+ input.select();
+ if (document.execCommand('Copy')) {
+ document.execCommand('Copy');
+ }
+ input.style.display = 'none';
+ }
+
renderDescription = (start, traceIds) => {
const { onClickTraceTag } = this.props;
return (