Skip to content
Snippets Groups Projects
Commit e7e7dfa4 authored by Tom Robinson's avatar Tom Robinson
Browse files

Ensure we show the generic error on dashboards, unless we're given a specific...

Ensure we show the generic error on dashboards, unless we're given a specific error in props (e.x. permissions)
parent 778f48a1
Branches
Tags
No related merge requests found
......@@ -2,7 +2,7 @@ import React, { Component, PropTypes } from "react";
import ReactDOM from "react-dom";
import visualizations, { getVisualizationRaw } from "metabase/visualizations";
import Visualization from "metabase/visualizations/components/Visualization.jsx";
import Visualization, { ERROR_MESSAGE_GENERIC, ERROR_MESSAGE_PERMISSION } from "metabase/visualizations/components/Visualization.jsx";
import ModalWithTrigger from "metabase/components/ModalWithTrigger.jsx";
import ChartSettings from "metabase/visualizations/components/ChartSettings.jsx";
......@@ -15,9 +15,6 @@ import cx from "classnames";
import _ from "underscore";
import { getIn } from "icepick";
const ERROR_MESSAGE_GENERIC = "There was a problem displaying this chart.";
const ERROR_MESSAGE_PERMISSION = "Sorry, you don't have permission to see this card."
export default class DashCard extends Component {
constructor(props, context) {
super(props, context);
......
......@@ -16,6 +16,9 @@ import { assoc, getIn } from "icepick";
import _ from "underscore";
import cx from "classnames";
export const ERROR_MESSAGE_GENERIC = "There was a problem displaying this chart.";
export const ERROR_MESSAGE_PERMISSION = "Sorry, you don't have permission to see this card."
@ExplicitSize
export default class Visualization extends Component {
constructor(props, context) {
......@@ -118,6 +121,12 @@ export default class Visualization extends Component {
}
}
}
// if on dashoard, and error didn't come from props replace it with the generic error message
if (isDashboard && error && this.props.error !== error) {
error = ERROR_MESSAGE_GENERIC;
}
if (!error) {
noResults = getIn(series, [0, "data", "rows", "length"]) === 0;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment