diff --git a/src/client/actions/ParticipantActions.js b/src/client/actions/ParticipantActions.js
index e9c2dc86..8a1c6042 100644
--- a/src/client/actions/ParticipantActions.js
+++ b/src/client/actions/ParticipantActions.js
@@ -49,7 +49,7 @@ export function getParticipantActions(alt, participantResource, errorActions) {
} else {
this.participantListUpdated(participantList);
}
- }, err => errorActions.error(err, 'Osallitujia ei voitu ladata'));
+ }, err => errorActions.error(err, 'Osallistujia ei voitu ladata'));
};
}
@@ -61,9 +61,12 @@ export function getParticipantActions(alt, participantResource, errorActions) {
}
updateParticipantPresences(ids, newValue, offset, limit, order, filter) {
- participantResource.raw('post', 'massAssign', { body: { ids: ids, newValue: newValue, fieldName: 'presence' } })
- .then(response => this.loadParticipantList(offset, limit, order, filter),
- err => errorActions.error(err, 'Osallistujien tilan päivitys epäonnistui'));
+ return dispatch => {
+ dispatch();
+ participantResource.raw('post', 'massAssign', { body: { ids: ids, newValue: newValue, fieldName: 'presence' } })
+ .then(response => this.loadParticipantList(offset, limit, order, filter),
+ err => errorActions.error(err, 'Osallistujien tilan päivitys epäonnistui'));
+ };
}
updateProperty(participantId, property, value) {
diff --git a/src/client/components/ParticipantListPage/ParticipantListPage.jsx b/src/client/components/ParticipantListPage/ParticipantListPage.jsx
index f74ee138..c5cf6501 100644
--- a/src/client/components/ParticipantListPage/ParticipantListPage.jsx
+++ b/src/client/components/ParticipantListPage/ParticipantListPage.jsx
@@ -1,6 +1,6 @@
import React from 'react';
import _ from 'lodash';
-import { Table, Grid, Row, Col, Input, Button } from 'react-bootstrap';
+import { Table, Grid, Row, Col, Input } from 'react-bootstrap';
import { getParticipantListUpdater } from './containers/ParticipantListUpdater';
import { getSortableHeaderCellContainer } from './containers/SortableHeaderCellContainer';
import { getListOffsetSelectorContainer } from './containers/ListOffsetSelectorContainer';
@@ -8,6 +8,7 @@ import { getParticipantRowsContainer } from './containers/ParticipantRowsContain
import { getQuickFilterContainer } from './containers/QuickFilterContainer';
import { getParticipantCount } from './containers/ParticipantCount';
import { getPresenceLabel } from '../../components';
+import { LoadingButton } from '../../components';
function getOrder(query) {
try {
@@ -35,22 +36,36 @@ function getLimit(query) {
return query.limit && Number(query.limit) || 200;
}
-export function getMassEdit() {
+export function getMassEdit(participantStore) {
class MassEdit extends React.Component {
constructor(props){
super(props);
- this.state = {};
+ this.state = { loading: false };
this.onSubmit = this.onSubmit.bind(this);
this.onChange = this.onChange.bind(this);
+ this.onStoreChanged = this.onStoreChanged.bind(this);
}
onSubmit(event) {
event.preventDefault();
if (this.state.value !== null && this.state.value !== 'null') {
+ this.setState({ value: this.state.value, loading: true });
this.props.onSubmit(this.state.value);
}
}
+ componentDidMount() {
+ participantStore.listen(this.onStoreChanged);
+ }
+
+ componentWillUnmount() {
+ participantStore.unlisten(this.onStoreChanged);
+ }
+
+ onStoreChanged() {
+ this.setState({ loading: false });
+ }
+
onChange(event){
event.persist();
this.setState({ value: event.target.value });
@@ -69,7 +84,7 @@ export function getMassEdit() {
-
+