Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show loading state on remote boards copy #1750

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Show loading state on Dialog accept button and avoid close it on saving
  • Loading branch information
RodriSanchez1 committed Jul 25, 2024

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 084181ae9687adaec4ffb33ac7358846c39eb300
Original file line number Diff line number Diff line change
@@ -30,6 +30,7 @@ import TextField from '@material-ui/core/TextField';
import CircularProgress from '@material-ui/core/CircularProgress';
import Slide from '@material-ui/core/Slide';
import DialogContentText from '@material-ui/core/DialogContentText';
import LoadingIcon from '../../UI/LoadingIcon';

import IconButton from '../../UI/IconButton';
import { TAB_INDEXES } from './CommunicatorDialog.constants';
@@ -73,6 +74,8 @@ class CommunicatorDialogBoardItem extends React.Component {
? props.board.description
: ''
};

this.handleDialogClose = this.handleDialogClose.bind(this);
}

openMenu(e) {
@@ -149,14 +152,14 @@ class CommunicatorDialogBoardItem extends React.Component {

async handleBoardCopy(board) {
this.setState({
openCopyBoard: false,
loading: true
});
try {
await this.props.copyBoard(board);
} catch (err) {
} finally {
this.setState({
openCopyBoard: false,
loading: false
});
}
@@ -839,7 +842,9 @@ class CommunicatorDialogBoardItem extends React.Component {
</Dialog>

<Dialog
onClose={this.handleDialogClose.bind(this)}
onClose={() => {
if (!this.state.loading) this.handleDialogClose();
}}
aria-labelledby="board-copy-dialog"
open={this.state.openCopyBoard}
>
@@ -858,6 +863,7 @@ class CommunicatorDialogBoardItem extends React.Component {
<Button
onClick={this.handleDialogClose.bind(this)}
color="primary"
disabled={this.state.loading}
>
{intl.formatMessage(messages.close)}
</Button>
@@ -868,8 +874,13 @@ class CommunicatorDialogBoardItem extends React.Component {
}}
variant="contained"
color="primary"
disabled={this.state.loading}
>
{intl.formatMessage(messages.accept)}
{this.state.loading ? (
<LoadingIcon />
) : (
intl.formatMessage(messages.accept)
)}
</Button>
</PremiumFeature>
</DialogActions>