mirror of
https://github.com/apache/superset.git
synced 2026-04-20 00:24:38 +00:00
Added Alert for ControlPanel and ChartContainer (#1626)
* Added Alert for ControlPanel and ChartContainer Done: - Add alert for Control Panel when fetch_datasource_metadata failes - Add alert for Chart Container when update_explore query fails * Changed color to warning-yellow * Solve linter issue * Fixed indent and delete error_redirect
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import $ from 'jquery';
|
||||
import React, { PropTypes } from 'react';
|
||||
import { connect } from 'react-redux';
|
||||
import { Panel } from 'react-bootstrap';
|
||||
import { Panel, Alert } from 'react-bootstrap';
|
||||
import visMap from '../../../visualizations/main';
|
||||
import { d3format } from '../../modules/utils';
|
||||
import ExploreActionButtons from '../../explore/components/ExploreActionButtons';
|
||||
@@ -24,6 +24,7 @@ const propTypes = {
|
||||
data: PropTypes.any,
|
||||
isChartLoading: PropTypes.bool,
|
||||
isStarred: PropTypes.bool.isRequired,
|
||||
alert: PropTypes.string,
|
||||
};
|
||||
|
||||
class ChartContainer extends React.Component {
|
||||
@@ -139,6 +140,9 @@ class ChartContainer extends React.Component {
|
||||
};
|
||||
}
|
||||
|
||||
removeAlert() {
|
||||
this.props.actions.removeChartAlert();
|
||||
}
|
||||
|
||||
renderVis() {
|
||||
visMap[this.props.viz_type](this.state.mockSlice).render();
|
||||
@@ -183,6 +187,16 @@ class ChartContainer extends React.Component {
|
||||
</div>
|
||||
}
|
||||
>
|
||||
{this.props.alert &&
|
||||
<Alert bsStyle="warning">
|
||||
{this.props.alert}
|
||||
<i
|
||||
className="fa fa-close pull-right"
|
||||
onClick={this.removeAlert.bind(this)}
|
||||
style={{ cursor: 'pointer' }}
|
||||
/>
|
||||
</Alert>
|
||||
}
|
||||
{!this.props.isChartLoading &&
|
||||
<div
|
||||
id={this.props.containerId}
|
||||
@@ -213,6 +227,7 @@ function mapStateToProps(state) {
|
||||
data: state.viz.data,
|
||||
isChartLoading: state.isChartLoading,
|
||||
isStarred: state.isStarred,
|
||||
alert: state.chartAlert,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user