Skip to content
This repository has been archived by the owner on Dec 13, 2020. It is now read-only.

Commit

Permalink
Fix duplicate calls to quickAction while selection still not completed
Browse files Browse the repository at this point in the history
  • Loading branch information
wiadev committed Jul 29, 2017
1 parent 45d1d5c commit f64443d
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
3 changes: 1 addition & 2 deletions src/components/Container.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,6 @@ class Container extends Component {
{rawModal.visible &&
<RawModal
modalTitle={modalTitle}
modalDescription={this.modalDescription}
modalDescription={modalDescription}
windowType={rawModal.type}
viewId={rawModal.viewId}
Expand All @@ -100,7 +99,7 @@ class Container extends Component {
selectedWindowType={selectedWindowType}
setModalTitle={setModalTitle}
setModalDescription={setModalDescription}
fetchQuickActionsOnInit={true}
fetchQuickActionsOnInit={!(includedView.windowType && includedView.viewId)}
modalDescription={this.modalDescription}
isModal={true}
processStatus={processStatus}
Expand Down
40 changes: 24 additions & 16 deletions src/components/app/DocumentList.js
Original file line number Diff line number Diff line change
Expand Up @@ -524,6 +524,11 @@ class DocumentList extends Component {
/>
}

let showQuickActions = true;
if (isModal && !inBackground && !selectionValid) {
showQuickActions = false;
}

if(layout && data) {
return (
<div
Expand Down Expand Up @@ -560,22 +565,25 @@ class DocumentList extends Component {
clearFilters={this.clearStaticFilters}
/>}
</div>
<QuickActions
{...{
selectedWindowType,
refresh,
processStatus
}}
ref={ (c) => this.quickActionsComponent = (c && c.getWrappedInstance()) }
selected={selected}
viewId={viewId}
windowType={windowType}
fetchOnInit={fetchQuickActionsOnInit}
disabled={hasIncluded}
shouldNotUpdate={inBackground && !hasIncluded}
inBackground={disablePaginationShortcuts}
inModal={inModal}
/>

{showQuickActions && (
<QuickActions
{...{
selectedWindowType,
refresh,
processStatus
}}
ref={ (c) => this.quickActionsComponent = (c && c.getWrappedInstance()) }
selected={selected}
viewId={viewId}
windowType={windowType}
fetchOnInit={fetchQuickActionsOnInit}
disabled={hasIncluded}
shouldNotUpdate={inBackground && !hasIncluded}
inBackground={disablePaginationShortcuts}
inModal={inModal}
/>
)}
</div>}
<div className="document-list-body">
<Table
Expand Down
10 changes: 3 additions & 7 deletions src/components/app/QuickActions.js
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ class QuickActions extends Component {
loading: true
});

let result = dispatch(
dispatch(
openModal(
action.caption, action.processId, 'process', null, null, false,
viewId, selected
Expand Down Expand Up @@ -196,9 +196,7 @@ class QuickActions extends Component {
onClick={(e) => {
e.preventDefault();

if (!disabledDuringProcessing) {
this.handleClick(actions[0])
}
this.handleClick(actions[0])
}}
title={actions[0].caption}
>
Expand All @@ -214,9 +212,7 @@ class QuickActions extends Component {
onMouseLeave={() => this.toggleTooltip(false)}
onClick={
() => {
if (!disabledDuringProcessing) {
this.toggleDropdown(!isDropdownOpen)
}
this.toggleDropdown(!isDropdownOpen)
}
}
>
Expand Down
4 changes: 3 additions & 1 deletion src/components/app/RawModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@ import counterpart from 'counterpart';

import Indicator from './Indicator';
import {
closeRawModal
closeRawModal,
closeModal
} from '../../actions/WindowActions';

import {
Expand Down Expand Up @@ -80,6 +81,7 @@ class RawModal extends Component {
const {dispatch, modalVisible} = this.props;

dispatch(closeRawModal());
dispatch(closeModal());

if (!modalVisible){
document.body.style.overflow = 'auto';
Expand Down

0 comments on commit f64443d

Please sign in to comment.