Skip to content

Commit

Permalink
override error message for unsafely shared widgets
Browse files Browse the repository at this point in the history
  • Loading branch information
Omer Lachish committed Jul 15, 2019
1 parent c2206f0 commit fd874ca
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion client/app/pages/dashboards/public-dashboard-page.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,14 @@ const PublicDashboardPage = {
loadDashboard($http, $route).then((data) => {
this.dashboard = new Dashboard(data);
this.dashboard.widgets = Dashboard.prepareDashboardWidgets(this.dashboard.widgets);
this.dashboard.widgets.forEach(widget => widget.load(!!refreshRate));
this.dashboard.widgets.forEach((widget) => {
widget.load(!!refreshRate).catch((error) => {
const isSafe = widget.getQuery() ? widget.getQuery().is_safe : true;
if (!isSafe) {
error.errorMessage = 'This query contains potentially unsafe parameters and cannot be executed on a publicly shared dashboard.';
}
});
});
this.filters = []; // TODO: implement (@/services/dashboard.js:collectDashboardFilters)
this.filtersOnChange = (allFilters) => {
this.filters = allFilters;
Expand Down

0 comments on commit fd874ca

Please sign in to comment.