Skip to content

Commit 8b2b85c

Browse files
committed
Remove "cancel" button for error messages
1 parent 5fbe78f commit 8b2b85c

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

webapp/components/topbar/dialogs/ActionDialog.js

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

6869
let action;
@@ -89,10 +90,10 @@ class ActionDialog extends React.Component {
8990
<Button
9091
variant="contained"
9192
color="primary"
92-
key="BACK"
93+
key={errorCanGoBack? "CLOSE": "BACK"}
9394
onClick={() => this.handleClickGoBack()}
9495
>
95-
BACK
96+
{errorCanGoBack? "CLOSE": "BACK"}
9697
</Button>
9798
);
9899

@@ -102,6 +103,16 @@ class ActionDialog extends React.Component {
102103
}
103104
}
104105

106+
const cancelButton = (errorMessage === '') ? (
107+
<Button
108+
onClick={this.cancelDialog}
109+
style={styles.cancel}
110+
key="CANCEL"
111+
>
112+
CANCEL
113+
</Button>
114+
) : <></>
115+
105116
return (
106117
<Dialog
107118
fullWidth
@@ -115,13 +126,7 @@ class ActionDialog extends React.Component {
115126
{content}
116127
</DialogContent>
117128
<DialogActions>
118-
<Button
119-
onClick={this.cancelDialog}
120-
style={styles.cancel}
121-
key="CANCEL"
122-
>
123-
CANCEL
124-
</Button>
129+
{cancelButton}
125130
{action}
126131
</DialogActions>
127132
</Dialog>

0 commit comments

Comments
 (0)