Publish loading indicator

This commit is contained in:
Ingo Schommer 2016-04-13 10:12:42 +12:00 committed by Damian Mooyman
parent aefc1a5c01
commit 37d3d22fbd
2 changed files with 14 additions and 0 deletions

View File

@ -115,6 +115,7 @@ class CampaignListContainer extends SilverStripeComponent {
<FormAction
label={i18n._t('Campaigns.PUBLISHCAMPAIGN')}
style={'success'}
loading={this.props.campaign.isPublishing}
handleClick={this.handlePublish}
/>
);
@ -212,6 +213,7 @@ class CampaignListContainer extends SilverStripeComponent {
CampaignListContainer.propTypes = {
publishApi: React.PropTypes.func.isRequired,
isPublishing: React.PropTypes.bool,
};
function mapStateToProps(state, ownProps) {
@ -222,6 +224,7 @@ function mapStateToProps(state, ownProps) {
}
return {
record: record || [],
campaign: state.campaign,
};
}

View File

@ -15,6 +15,17 @@ function campaignReducer(state = initialState, action) {
view: action.payload.view,
}));
case ACTION_TYPES.PUBLISH_CAMPAIGN_REQUEST:
return deepFreeze(Object.assign({}, state, {
isPublishing: true,
}));
case ACTION_TYPES.PUBLISH_CAMPAIGN_SUCCESS:
case ACTION_TYPES.PUBLISH_CAMPAIGN_FAILURE:
return deepFreeze(Object.assign({}, state, {
isPublishing: false,
}));
default:
return state;