Skip to content

Commit

Permalink
Fix: only show stack trace in development (elastic#666)
Browse files Browse the repository at this point in the history
Closes https://github.com/elastic/kibana-canvas/issues/625

Show the stack in development mode, but not in production mode

# Dev

![screenshot 2018-06-12 13 14 56](https://user-images.githubusercontent.com/404731/41314897-dba5980a-6e42-11e8-943a-620b1281e091.png)

# Production (build)

![screenshot 2018-06-12 13 14 00](https://user-images.githubusercontent.com/404731/41314909-e1967072-6e42-11e8-8e4f-479374789d65.png)

You'll need to create and run a build to test this.
  • Loading branch information
w33ble committed Jun 14, 2018
1 parent a1aa364 commit 8d3e0ba
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 16 deletions.
Expand Up @@ -4,8 +4,6 @@ import { FormControl } from 'react-bootstrap';
import './dropdown_filter.less';

export const DropdownFilter = ({ value, onChange, commit, choices }) => {
console.log(value);

return (
<form
onSubmit={e => {
Expand Down
29 changes: 15 additions & 14 deletions public/render_functions/error/show_debugging.js
Expand Up @@ -3,20 +3,21 @@ import PropTypes from 'prop-types';
import { withState } from 'recompose';
import { Button, Well } from 'react-bootstrap';

const ShowDebuggingComponent = ({ payload, expanded, setExpanded }) => (
<div>
<Button bsStyle="link" onClick={() => setExpanded(!expanded)}>
{expanded && <span className="fa fa-caret-down" />}
{!expanded && <span className="fa fa-caret-right" />}
&nbsp;See Details
</Button>
{expanded && (
<Well className="canvas_error-render--debug-payload">
<pre>{JSON.stringify(payload, null, 2)}</pre>
</Well>
)}
</div>
);
const ShowDebuggingComponent = ({ payload, expanded, setExpanded }) =>
process.env.NODE_ENV === 'production' ? null : (
<div>
<Button bsStyle="link" onClick={() => setExpanded(!expanded)}>
{expanded && <span className="fa fa-caret-down" />}
{!expanded && <span className="fa fa-caret-right" />}
&nbsp;See Details
</Button>
{expanded && (
<Well className="canvas_error-render--debug-payload">
<pre>{JSON.stringify(payload, null, 2)}</pre>
</Well>
)}
</div>
);

ShowDebuggingComponent.propTypes = {
expanded: PropTypes.bool.isRequired,
Expand Down

0 comments on commit 8d3e0ba

Please sign in to comment.