Skip to content

Commit

Permalink
Show stack trace when clicking alert
Browse files Browse the repository at this point in the history
  • Loading branch information
mistercrunch committed Feb 15, 2017
1 parent c1fa690 commit 09f1f04
Showing 1 changed file with 31 additions and 11 deletions.
42 changes: 31 additions & 11 deletions superset/assets/javascripts/explorev2/components/ChartContainer.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import $ from 'jquery';
import React, { PropTypes } from 'react';
import { connect } from 'react-redux';
import { Panel, Alert } from 'react-bootstrap';
import { Panel, Alert, Collapse } from 'react-bootstrap';
import visMap from '../../../visualizations/main';
import { d3format } from '../../modules/utils';
import ExploreActionButtons from './ExploreActionButtons';
Expand Down Expand Up @@ -40,6 +40,7 @@ class ChartContainer extends React.PureComponent {
super(props);
this.state = {
selector: `#${props.containerId}`,
showStackTrace: false,
};
}

Expand Down Expand Up @@ -147,18 +148,37 @@ class ChartContainer extends React.PureComponent {
return title;
}

renderAlert() {
const msg = (
<div>
{this.props.alert}
<i
className="fa fa-close pull-right"
onClick={this.removeAlert.bind(this)}
style={{ cursor: 'pointer' }}
/>
</div>);
return (
<div>
<Alert
bsStyle="warning"
onClick={() => this.setState({ showStackTrace: !this.state.showStackTrace })}
>
{msg}
</Alert>
{this.props.queryResponse && this.props.queryResponse.stacktrace &&
<Collapse in={this.state.showStackTrace}>
<pre>
{this.props.queryResponse.stacktrace}
</pre>
</Collapse>
}
</div>);
}

renderChart() {
if (this.props.alert) {
return (
<Alert bsStyle="warning">
{this.props.alert}
<i
className="fa fa-close pull-right"
onClick={this.removeAlert.bind(this)}
style={{ cursor: 'pointer' }}
/>
</Alert>
);
return this.renderAlert();
}
const loading = this.props.chartStatus === 'loading';
return (
Expand Down

0 comments on commit 09f1f04

Please sign in to comment.