-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMergeDataPage.jsx
More file actions
73 lines (72 loc) · 2.18 KB
/
MergeDataPage.jsx
File metadata and controls
73 lines (72 loc) · 2.18 KB
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
import React, { Component } from 'react';
import { Button } from 'react-bootstrap';
import ProgressBar from 'react-bootstrap/ProgressBar';
import { observer } from 'mobx-react';
import { withTranslation } from 'react-i18next';
const MergeDataPage = observer(
class MergeDataPage extends Component {
constructor(props) {
super(props);
this.viewModel = props.viewModel;
this.state = {
isMerging: false,
percent: 0,
};
}
increasePercentPerSecond = () => {
if (this.state.percent < 99) {
this.setState({ percent: this.state.percent + 3 });
}
};
handleClick = async () => {
this.setState({ isMerging: true });
const increasePercent = setInterval(this.increasePercentPerSecond, 500);
const response = await this.viewModel.migratorData();
if (response) {
this.setState({ percent: 100 });
}
clearInterval(increasePercent);
this.setState({ isMerging: false });
};
render() {
const { previousStep, t } = this.props;
const { isMerging, percent } = this.state;
return (
<>
<div className="bg-white p-4 rounded-2 ">
<div className="row align-items-center">
<div className="col-2">
<Button
disabled={isMerging}
onClick={this.handleClick}
variant="success"
className="fw-semibold px-4"
>
{isMerging ? 'Merging...' : 'Merge Data'}
</Button>
</div>
<div className="col-10">
<ProgressBar
className="fw-bold"
striped
animated
variant="success"
now={percent}
label={`${percent}%`}
/>
</div>
</div>
</div>
<Button
onClick={previousStep}
variant="outline-secondary"
className=" fs-14 fw-semibold p-2 mt-4"
>
{t('txt_previous_step')}
</Button>
</>
);
}
}
);
export default withTranslation('common')(MergeDataPage);