Skip to content

Commit 8c16c4c

Browse files
committed
Fix "back" button when an error occurs for an ActionDialog
1 parent 8b2b85c commit 8c16c4c

1 file changed

Lines changed: 19 additions & 21 deletions

File tree

webapp/components/topbar/dialogs/ActionDialog.js

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ class ActionDialog extends React.Component {
6363
classes,
6464
errorMessage,
6565
errorDetails,
66-
errorCanGoBack,
6766
} = this.props;
6867

6968
let action;
@@ -73,15 +72,25 @@ class ActionDialog extends React.Component {
7372
if (errorMessage === '') {
7473
title = this.props.title;
7574
action = (
76-
<Button
77-
id="appBarPerformActionButton"
78-
key="appBarPerformActionButton"
79-
variant="contained"
80-
color="primary"
81-
onClick={this.performAction}
75+
<>
76+
<Button
77+
onClick={this.cancelDialog}
78+
style={styles.cancel}
79+
key="CANCEL"
8280
>
83-
{this.props.buttonLabel}
81+
CANCEL
8482
</Button>
83+
<Button
84+
id="appBarPerformActionButton"
85+
key="appBarPerformActionButton"
86+
variant="contained"
87+
color="primary"
88+
onClick={this.performAction}
89+
>
90+
{this.props.buttonLabel}
91+
</Button>
92+
</>
93+
8594
);
8695

8796
content = this.props.children;
@@ -90,10 +99,10 @@ class ActionDialog extends React.Component {
9099
<Button
91100
variant="contained"
92101
color="primary"
93-
key={errorCanGoBack? "CLOSE": "BACK"}
102+
key="CLOSE"
94103
onClick={() => this.handleClickGoBack()}
95104
>
96-
{errorCanGoBack? "CLOSE": "BACK"}
105+
CLOSE
97106
</Button>
98107
);
99108

@@ -103,16 +112,6 @@ class ActionDialog extends React.Component {
103112
}
104113
}
105114

106-
const cancelButton = (errorMessage === '') ? (
107-
<Button
108-
onClick={this.cancelDialog}
109-
style={styles.cancel}
110-
key="CANCEL"
111-
>
112-
CANCEL
113-
</Button>
114-
) : <></>
115-
116115
return (
117116
<Dialog
118117
fullWidth
@@ -126,7 +125,6 @@ class ActionDialog extends React.Component {
126125
{content}
127126
</DialogContent>
128127
<DialogActions>
129-
{cancelButton}
130128
{action}
131129
</DialogActions>
132130
</Dialog>

0 commit comments

Comments
 (0)