Commit 5e178524 authored by 杨明亮's avatar 杨明亮 Committed by xuehui
Browse files

copy parameters to clipboard in form of python dict. (#908)

* copy parameters in form of python dict.

* remove irrelevant files

* better ui and ux

* better ui
parent e7d31abd
......@@ -6,6 +6,7 @@
"antd": "^3.8.1",
"axios": "^0.18.0",
"babel-polyfill": "^6.26.0",
"copy-to-clipboard": "^3.0.8",
"echarts": "^4.1.0",
"echarts-for-react": "^2.0.14",
"react": "^16.4.2",
......
import * as React from 'react';
import * as copy from 'copy-to-clipboard';
import PaiTrialLog from '../public-child/PaiTrialLog';
import TrialLog from '../public-child/TrialLog';
import JSONTree from 'react-json-tree';
import { TableObj } from '../../static/interface';
import { Row, Tabs } from 'antd';
import { Row, Tabs, Button, message } from 'antd';
import JSONTree from 'react-json-tree';
const TabPane = Tabs.TabPane;
interface OpenRowProps {
......@@ -19,6 +20,15 @@ class OpenRow extends React.Component<OpenRowProps, {}> {
}
copyParams = (record: TableObj) => {
let params = JSON.stringify(record.description.parameters);
if (copy(params)) {
message.success('Success copy parameters to clipboard in form of python dict !', 3);
} else {
message.error('Failed !', 2);
}
}
render() {
const { trainingPlatform, record, logCollection } = this.props;
......@@ -42,12 +52,19 @@ class OpenRow extends React.Component<OpenRowProps, {}> {
{
isHasParameters
?
<div>
<JSONTree
hideRoot={true}
shouldExpandNode={() => true} // default expandNode
getItemString={() => (<span />)} // remove the {} items
data={openRowDataSource}
data={openRowDataSource.parameters}
/>
<Button
onClick={this.copyParams.bind(this, record)}
>
Copy as Python
</Button>
</div>
:
<div className="logpath">
<span className="logName">Error: </span>
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment