diff --git a/client/actions/multiSelect.ts b/client/actions/multiSelect.ts index 834de3dd6..c07920b88 100644 --- a/client/actions/multiSelect.ts +++ b/client/actions/multiSelect.ts @@ -8,6 +8,7 @@ import {MULTISELECT, ITEM_TYPE, MODALS} from '../constants'; import eventsUi from './events/ui'; import planningUi from './planning/ui'; import {getItemType, gettext, getItemInArrayById, getErrorMessage, lockUtils} from '../utils'; +import {planningApi} from '../superdeskApi'; /** * Action Dispatcher to select an/all Event(s) @@ -180,6 +181,12 @@ const downloadEvents = (url, data) => { req.send(JSON.stringify(data)); }; +const bulkAddPlanningCoveragesToWorkflow = (items) => ( + (dispatch) => planningApi.planning.coverages.bulkAddCoverageToWorkflow(items) + .then(() => dispatch({ + type: MULTISELECT.ACTIONS.DESELECT_ALL_PLANNINGS, + })) +); const exportAsArticle = (items = [], download) => ( (dispatch, getState, {api, notify, gettext, superdesk, $location, $interpolate, desks}) => { @@ -312,6 +319,7 @@ const self = { itemBulkSpikeModal, itemBulkUnSpikeModal, exportAsArticle, + bulkAddPlanningCoveragesToWorkflow, }; export default self; diff --git a/client/components/MultiSelectActions.tsx b/client/components/MultiSelectActions.tsx index 9cfa4ef0a..60c4f7f66 100644 --- a/client/components/MultiSelectActions.tsx +++ b/client/components/MultiSelectActions.tsx @@ -8,7 +8,6 @@ import {eventUtils, planningUtils, gettext} from '../utils'; import {MAIN} from '../constants'; import {SlidingToolBar} from './UI/SubNav'; import {Button} from './UI'; -import {planningApi} from '../superdeskApi'; export class MultiSelectActionsComponent extends React.PureComponent { constructor(props) { @@ -95,7 +94,7 @@ export class MultiSelectActionsComponent extends React.PureComponent { key={0} hollow={true} onClick={() => { - planningApi.planning.coverages.bulkAddCoverageToWorkflow(this.getItemList()); + this.props.addToWorkflow(this.getItemList()); }} text={gettext('Add to workflow')} /> @@ -312,6 +311,7 @@ const mapDispatchToProps = (dispatch) => ({ spikeItems: (items) => dispatch(actions.multiSelect.itemBulkSpikeModal(items)), unspikeItems: (items) => dispatch(actions.multiSelect.itemBulkUnSpikeModal(items)), exportAsArticle: (items, download) => dispatch(actions.multiSelect.exportAsArticle(items, download)), + addToWorkflow: (items) => dispatch(actions.multiSelect.bulkAddPlanningCoveragesToWorkflow(items)), });