From 55435cef562926eae0c8160f5155253cb2293762 Mon Sep 17 00:00:00 2001 From: Ryan Patrick Kyle Date: Sun, 3 Nov 2019 23:21:49 -0500 Subject: [PATCH 1/6] :hammer: fix rendering of stack trace in R --- .../error/FrontEnd/FrontEndError.css | 9 +++++++++ .../error/FrontEnd/FrontEndError.react.js | 18 ++++++++++++++++-- 2 files changed, 25 insertions(+), 2 deletions(-) diff --git a/dash-renderer/src/components/error/FrontEnd/FrontEndError.css b/dash-renderer/src/components/error/FrontEnd/FrontEndError.css index b1a96a5ea5..e5f50d5490 100644 --- a/dash-renderer/src/components/error/FrontEnd/FrontEndError.css +++ b/dash-renderer/src/components/error/FrontEnd/FrontEndError.css @@ -114,3 +114,12 @@ overflow: hidden; display: inline-block; } + +.dash-be-error__str { + background-color: #fdf3f4; + min-width: 386px; + max-width: 650px; + overflow: auto; + display: inline-block; + white-space: pre-wrap; +} diff --git a/dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js b/dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js index 7dfddb0ab3..5314f07e0c 100644 --- a/dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js +++ b/dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js @@ -108,7 +108,9 @@ function UnconnectedErrorContent({error, base}) { )} {/* Backend Error */} - {typeof error.html !== 'string' ? null : ( + {typeof error.html !== 'string' ? null + : error.html.indexOf("
{/* Embed werkzeug debugger in an iframe to prevent @@ -140,7 +142,19 @@ function UnconnectedErrorContent({error, base}) { />
- )} + ) + : ( +
+
+ {error.html} +
+
+ ) + } ); } From e5d5921f3496fc32d833598c2b3327ad9aea1066 Mon Sep 17 00:00:00 2001 From: Ryan Patrick Kyle Date: Sun, 3 Nov 2019 23:40:21 -0500 Subject: [PATCH 2/6] :necktie: use prettier --- .../error/FrontEnd/FrontEndError.react.js | 197 ------------------ 1 file changed, 197 deletions(-) diff --git a/dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js b/dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js index 5314f07e0c..e69de29bb2 100644 --- a/dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js +++ b/dash-renderer/src/components/error/FrontEnd/FrontEndError.react.js @@ -1,197 +0,0 @@ -import {connect} from 'react-redux'; -import './FrontEndError.css'; -import {Component} from 'react'; -import CollapseIcon from '../icons/CollapseIcon.svg'; -import PropTypes from 'prop-types'; -import '../Percy.css'; -import {urlBase} from '../../../utils'; - -import werkzeugCss from '../werkzeug.css.txt'; - -class FrontEndError extends Component { - constructor(props) { - super(props); - this.state = { - collapsed: this.props.isListItem, - }; - } - - render() { - const {e, inAlertsTray} = this.props; - const {collapsed} = this.state; - - const cardClasses = - 'dash-error-card__content' + - (inAlertsTray ? ' dash-error-card--alerts-tray' : ''); - - /* eslint-disable no-inline-comments */ - const errorHeader = ( -
this.setState({collapsed: !collapsed})} - > - - ⛑️ - - {e.error.message || 'Error'} - - - - - {`${e.timestamp.toLocaleTimeString()}`} - - - {/* Special percy timestamp for visual testing. - * Hidden during regular usage. - */} - 00:00:00 PM - - - this.setState({collapsed: !collapsed})} - /> - -
- ); - /* eslint-enable no-inline-comments */ - - return collapsed ? ( -
{errorHeader}
- ) : ( -
- {errorHeader} - -
- ); - } -} - -/* eslint-disable no-inline-comments, no-magic-numbers */ -function UnconnectedErrorContent({error, base}) { - return ( -
- {/* - * 40 is a rough heuristic - if longer than 40 then the - * message might overflow into ellipses in the title above & - * will need to be displayed in full in this error body - */} - {typeof error.message !== 'string' || - error.message.length < 40 ? null : ( -
-
- {error.message} -
-
- )} - - {typeof error.stack !== 'string' ? null : ( -
-
-
- - - (This error originated from the built-in - JavaScript code that runs Dash apps. Click - to see the full stack trace or open your - browser's console.) - - - - {error.stack.split('\n').map(line => ( -

{line}

- ))} -
-
-
- )} - {/* Backend Error */} - {typeof error.html !== 'string' ? null - : error.html.indexOf(" -
- {/* Embed werkzeug debugger in an iframe to prevent - CSS leaking - werkzeug HTML includes a bunch - of CSS on base html elements like `` - */} - -