-
Notifications
You must be signed in to change notification settings - Fork 168
/
List.js
78 lines (75 loc) · 1.76 KB
/
List.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
import React from 'react';
import { Table, Button, Modal } from 'antd';
import { inject, observer } from 'mobx-react';
import IntegrationForm from './DataForm';
import PropTypes from 'prop-types';
@inject('integration')
@observer
class List extends React.Component {
static propTypes = {
integration: PropTypes.object,
};
state = { visible: false };
componentDidMount() {
this.props.integration.getIntegrationList();
}
addDataSource = () => {
this.setState({
visible: true,
});
};
handleOk = e => {
this.setState({
visible: false,
});
};
handleCancel = e => {
this.setState({
visible: false,
});
};
render() {
const { integration } = this.props;
const columns = [
{
title: intl.get('name'),
dataIndex: 'name',
key: 'name',
},
{
title: intl.get('integration.type'),
dataIndex: 'type',
key: 'type',
},
{
title: intl.get('integration.creationTime'),
dataIndex: 'time',
key: 'time',
},
];
return (
<div>
<div className="head-bar">
<h2>{intl.get('integration.datasource')}</h2>
<Button type="primary" onClick={this.addDataSource}>
{intl.get('operation.add')}
</Button>
</div>
<Table columns={columns} dataSource={integration.integrationList} />
<Modal
ref="modal"
title={intl.get('integration.adddatasource')}
visible={this.state.visible}
footer={null}
onCancel={this.handleCancel}
>
<IntegrationForm
onSubmit={this.handleOk}
onCancel={this.handleCancel}
/>
</Modal>
</div>
);
}
}
export default List;