mirror of
https://github.com/apache/superset.git
synced 2026-04-21 00:54:44 +00:00
Dashboard refactory (#3581)
Create Chart component for all chart fetching and rendering, and apply redux architecture in dashboard view.
This commit is contained in:
59
superset/assets/javascripts/components/StackTraceMessage.jsx
Normal file
59
superset/assets/javascripts/components/StackTraceMessage.jsx
Normal file
@@ -0,0 +1,59 @@
|
||||
/* eslint-disable react/no-danger */
|
||||
import React from 'react';
|
||||
import PropTypes from 'prop-types';
|
||||
import { Alert, Collapse } from 'react-bootstrap';
|
||||
|
||||
const propTypes = {
|
||||
message: PropTypes.string,
|
||||
queryResponse: PropTypes.object,
|
||||
showStackTrace: PropTypes.bool,
|
||||
};
|
||||
const defaultProps = {
|
||||
showStackTrace: false,
|
||||
};
|
||||
|
||||
class StackTraceMessage extends React.PureComponent {
|
||||
constructor(props) {
|
||||
super(props);
|
||||
|
||||
this.state = {
|
||||
showStackTrace: props.showStackTrace,
|
||||
};
|
||||
}
|
||||
|
||||
hasTrace() {
|
||||
return this.props.queryResponse && this.props.queryResponse.stacktrace;
|
||||
}
|
||||
|
||||
render() {
|
||||
const msg = (
|
||||
<div>
|
||||
<p
|
||||
dangerouslySetInnerHTML={{ __html: this.props.message }}
|
||||
/>
|
||||
</div>);
|
||||
|
||||
return (
|
||||
<div className={`stack-trace-container${this.hasTrace() ? ' has-trace' : ''}`}>
|
||||
<Alert
|
||||
bsStyle="warning"
|
||||
onClick={() => this.setState({ showStackTrace: !this.state.showStackTrace })}
|
||||
>
|
||||
{msg}
|
||||
</Alert>
|
||||
{this.hasTrace() &&
|
||||
<Collapse in={this.state.showStackTrace}>
|
||||
<pre>
|
||||
{this.props.queryResponse.stacktrace}
|
||||
</pre>
|
||||
</Collapse>
|
||||
}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
StackTraceMessage.propTypes = propTypes;
|
||||
StackTraceMessage.defaultProps = defaultProps;
|
||||
|
||||
export default StackTraceMessage;
|
||||
Reference in New Issue
Block a user