Skip to content

Commit 087aaaa

Browse files
Add an 'x' button to close the error messages popup #1403
1 parent e7f4984 commit 087aaaa

File tree

5 files changed

+32
-6
lines changed

5 files changed

+32
-6
lines changed

dash-renderer/src/components/error/FrontEnd/FrontEndError.css

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,17 @@
22
margin-top: 10px;
33
}
44

5+
.dash-fe-error__icon-x {
6+
width: 16px;
7+
height: 16px;
8+
background-color: red;
9+
margin-left: 75px;
10+
border-radius: 4px;
11+
border: 1px solid;
12+
13+
}
14+
15+
516
.dash-fe-errors {
617
min-width: 386px;
718
max-width: 650px;

dash-renderer/src/components/error/FrontEnd/FrontEndErrorContainer.react.js

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React, {Component} from 'react';
22
import './FrontEndError.css';
3+
import OffIcon from '../icons/OffIcon.svg';
34
import PropTypes from 'prop-types';
45
import {FrontEndError} from './FrontEndError.react';
56

@@ -9,9 +10,9 @@ class FrontEndErrorContainer extends Component {
910
}
1011

1112
render() {
12-
const {errors, connected} = this.props;
13+
const {errors, connected, errorsOpened, clickHandler} = this.props;
1314
const errorsLength = errors.length;
14-
if (errorsLength === 0) {
15+
if (errorsLength === 0 || !errorsOpened) {
1516
return null;
1617
}
1718

@@ -34,17 +35,27 @@ class FrontEndErrorContainer extends Component {
3435
</strong>
3536
){connected ? null : '\u00a0 🚫 Server Unavailable'}
3637
</div>
38+
<div
39+
className='dash-error-card__message'
40+
onClick={() => clickHandler()}
41+
>
42+
<OffIcon className='dash-fe-error__icon-x' />
43+
</div>
3744
</div>
45+
3846
<div className='dash-error-card__list'>{errorElements}</div>
3947
</div>
4048
);
4149
}
4250
}
4351

4452
FrontEndErrorContainer.propTypes = {
53+
id: PropTypes.string,
4554
errors: PropTypes.array,
4655
connected: PropTypes.bool,
47-
inAlertsTray: PropTypes.any
56+
inAlertsTray: PropTypes.any,
57+
errorsOpened: PropTypes.any,
58+
clickHandler: PropTypes.func
4859
};
4960

5061
FrontEndErrorContainer.propTypes = {

dash-renderer/src/components/error/GlobalErrorOverlay.react.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default class GlobalErrorOverlay extends Component {
1111
}
1212

1313
render() {
14-
const {visible, error, errorsOpened} = this.props;
14+
const {visible, error, errorsOpened, clickHandler} = this.props;
1515

1616
let frontEndErrors;
1717
if (errorsOpened) {
@@ -21,6 +21,8 @@ export default class GlobalErrorOverlay extends Component {
2121
<FrontEndErrorContainer
2222
errors={errors}
2323
connected={error.backEndConnected}
24+
errorsOpened={errorsOpened}
25+
clickHandler={clickHandler}
2426
/>
2527
);
2628
}
@@ -41,5 +43,6 @@ GlobalErrorOverlay.propTypes = {
4143
children: PropTypes.object,
4244
visible: PropTypes.bool,
4345
error: PropTypes.object,
44-
errorsOpened: PropTypes.any
46+
errorsOpened: PropTypes.any,
47+
clickHandler: PropTypes.func
4548
};
Lines changed: 1 addition & 1 deletion
Loading

dash-renderer/src/components/error/menu/DebugMenu.react.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@ class DebugMenu extends Component {
147147
error={error}
148148
visible={errCount > 0}
149149
errorsOpened={errorsOpened}
150+
clickHandler={toggleErrors}
150151
>
151152
{this.props.children}
152153
</GlobalErrorOverlay>

0 commit comments

Comments
 (0)