Skip to content

Commit

Permalink
Use Alert for visualization error (#1639)
Browse files Browse the repository at this point in the history
  • Loading branch information
vera-liu committed Nov 18, 2016
1 parent a8480f5 commit f64a205
Showing 1 changed file with 6 additions and 22 deletions.
Expand Up @@ -108,28 +108,12 @@ class ChartContainer extends React.Component {
// finished rendering callback
},

error(msg, xhr) {
let errorMsg = msg;
let errHtml = '';
try {
const o = JSON.parse(msg);
if (o.error) {
errorMsg = o.error;
}
} catch (e) {
// pass
}
errHtml = `<div class="alert alert-danger">${errorMsg}</div>`;
if (xhr) {
const extendedMsg = this.getErrorMsg(xhr);
if (extendedMsg) {
errHtml += `<div class="alert alert-danger">${extendedMsg}</div>`;
}
}
$(this.state.selector).html(errHtml);
this.render();
$('span.query').removeClass('disabled');
$('.query-and-save button').removeAttr('disabled');
clearError: () => {
this.props.actions.removeChartAlert();
},

error(msg) {
this.props.actions.chartUpdateFailed(msg);
},

d3format: (col, number) => {
Expand Down

0 comments on commit f64a205

Please sign in to comment.