Skip to content

Commit 0d5333e

Browse files
authored
Merge pull request ECLK#323 from hsvikum/bug_fix_233
Bug Fix ECLK#233
2 parents 522ebc6 + 8eb8f85 commit 0d5333e

File tree

4 files changed

+34
-5
lines changed

4 files changed

+34
-5
lines changed

client/src/modules/election/ActiveElectionForm.jsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { setCallElectionData, postCallElectionData, openSnackbar, getFieldOption
2626
import { getTeams } from '../nomination/state/NominationAction';
2727
import { connect } from 'react-redux';
2828
import moment from 'moment';
29+
import CircularProgress from '@material-ui/core/CircularProgress';
2930

3031
const styles = theme => ({
3132
root: {
@@ -132,7 +133,8 @@ class ActiveElectionForm extends React.Component {
132133
errorTextApprovalStart: '',
133134
errorTextApprovalEnd: '',
134135
goNext: false,
135-
errorTextElectorates: ''
136+
errorTextElectorates: '',
137+
stepInProgress: false
136138
};
137139
}
138140
componentWillMount(){
@@ -277,9 +279,12 @@ class ActiveElectionForm extends React.Component {
277279
}
278280

279281
if (goNext) {
280-
this.setState(state => ({
281-
activeStep: state.activeStep + 1,
282-
}));
282+
this.setState({ stepInProgress: true });
283+
setTimeout(() => {
284+
this.setState(state => ({
285+
activeStep: state.activeStep + 1,
286+
}));
287+
}, 500);
283288
}
284289

285290
if (activeStep === 1) {
@@ -378,6 +383,12 @@ class ActiveElectionForm extends React.Component {
378383
this.setState({ open: false });
379384
};
380385

386+
onComponentLoaded = () => {
387+
if (this.state.stepInProgress) {
388+
this.setState({ stepInProgress: false });
389+
}
390+
}
391+
381392
getStepContent(step, values) {
382393
const { CallElectionData,rowHeaders } = this.props;
383394
var rowHeadersForRpp = rowHeaders.filter(x => x.team_party_type === "RPP");
@@ -396,6 +407,7 @@ class ActiveElectionForm extends React.Component {
396407
case 1:
397408
return <AllowNomination
398409
handleChange={this.handleChange}
410+
onComponentLoaded={this.onComponentLoaded}
399411
values={values}
400412
rowHeadersForRpp={rowHeadersForRpp}
401413
rowHeadersForIg={rowHeadersForIg}
@@ -452,6 +464,7 @@ class ActiveElectionForm extends React.Component {
452464
{activeStep === steps.length - 1 ? 'Finish' : 'Next'}
453465
</Button>
454466
</div>
467+
{ this.state.stepInProgress && <CircularProgress size={68} />}
455468
</div>
456469
</StepContent>
457470
</Step>

client/src/modules/election/AllowNomination.jsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,10 @@ class AllowNomination extends React.Component {
3737
e.preventDefault()
3838
}
3939

40+
componentWillReceiveProps() {
41+
const { onComponentLoaded } = this.props;
42+
onComponentLoaded();
43+
}
4044

4145
render() {
4246
const { classes,electionData,errorTextElectorates,rowHeadersForRpp,rowHeadersForIg } = this.props;

client/src/modules/election/Election_process_review_details.jsx

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ import AllowNomination from './AllowNominationView';
3939
import moment from 'moment';
4040
import { withRouter } from "react-router-dom";
4141
import { Redirect } from 'react-router-dom'
42+
import LinearProgress from '@material-ui/core/LinearProgress';
4243

4344

4445
const drawerWidth = 240;
@@ -191,7 +192,8 @@ class Dashboard extends React.Component {
191192
electionId: '',
192193
status: '',
193194
reviewNote: '',
194-
errorTextModule: ''
195+
errorTextModule: '',
196+
loaderInProgress: true
195197
};
196198

197199
componentDidMount() {
@@ -216,6 +218,10 @@ class Dashboard extends React.Component {
216218
this.setState({ open: false });
217219
};
218220

221+
componentWillReceiveProps() {
222+
this.setState({ loaderInProgress: false });
223+
}
224+
219225
changeElectionStatus = () => {
220226
const { onChangeApproval, openSnackbar, ElectionReviewData } = this.props;
221227

@@ -401,6 +407,9 @@ class Dashboard extends React.Component {
401407
<div style={{ width: '100%' }}>
402408
<Typography variant="h5" component="h2">{ElectionReviewData.name}</Typography>
403409
<br />
410+
<div>
411+
{ this.state.loaderInProgress && <LinearProgress/>}
412+
</div>
404413
<div className={classes.container}>
405414
<Card className={classes.card}>
406415
<CardContent>

client/src/modules/nomination/state/NominationAction.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import { openSnackbar } from '../../election/state/ElectionAction';
3232
import moment from "react-moment";
3333
import {saveAs} from 'file-saver';
3434
import { de } from "date-fns/locale";
35+
import store from '../../../state/store';
3536

3637
const nominationLoaded = (getNominations) => {
3738
return {
@@ -726,6 +727,8 @@ export const createAndDownloadNominationPaySlipPdf = function createAndDownloadN
726727
templateData['file'] = {"template": "nomination_payslip.js"}
727728
templateData['file']['paymentData'] = paymentData;
728729

730+
store.dispatch(openSnackbar({ message:`Download will begin shortly`}));
731+
729732
firstAPI.post(`/generate`, templateData)
730733
.then((res) => firstAPI.get(res.data.path, { responseType: 'blob' }))
731734
.then((res) => {

0 commit comments

Comments
 (0)