From 67a85b9831f86a78fe987037000c8f2e6bd9c7d7 Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Tue, 18 Apr 2017 13:29:02 -0700 Subject: [PATCH] Fix dashboard edit button is disabled (#2634) * Fix dashboard edit button is disabled * Addressing comments --- .../dashboard/components/Controls.jsx | 19 ++++++++++--------- .../dashboard/components/SaveModal.jsx | 1 - superset/views/core.py | 7 +++---- 3 files changed, 13 insertions(+), 14 deletions(-) diff --git a/superset/assets/javascripts/dashboard/components/Controls.jsx b/superset/assets/javascripts/dashboard/components/Controls.jsx index 4248a6055f..09b8937e24 100644 --- a/superset/assets/javascripts/dashboard/components/Controls.jsx +++ b/superset/assets/javascripts/dashboard/components/Controls.jsx @@ -43,7 +43,6 @@ class Controls extends React.PureComponent { } render() { const dashboard = this.props.dashboard; - const canSave = dashboard.dash_save_perm; const emailBody = `Checkout this dashboard: ${window.location.href}`; const emailLink = 'mailto:?Subject=Superset%20Dashboard%20' + `${dashboard.dashboard_title}&Body=${emailBody}`; @@ -81,11 +80,16 @@ class Controls extends React.PureComponent { onChange={this.changeCss.bind(this)} /> + @@ -93,14 +97,11 @@ class Controls extends React.PureComponent { dashboard={dashboard} css={this.state.css} triggerNode={ - + } /> - ); } diff --git a/superset/assets/javascripts/dashboard/components/SaveModal.jsx b/superset/assets/javascripts/dashboard/components/SaveModal.jsx index ade62bf6a4..88c8ad2089 100644 --- a/superset/assets/javascripts/dashboard/components/SaveModal.jsx +++ b/superset/assets/javascripts/dashboard/components/SaveModal.jsx @@ -107,7 +107,6 @@ class SaveModal extends React.PureComponent { { this.modal = modal; }} triggerNode={this.props.triggerNode} - isButton modalTitle="Save Dashboard" modalBody={ diff --git a/superset/views/core.py b/superset/views/core.py index 032d86155f..8c442f0a39 100755 --- a/superset/views/core.py +++ b/superset/views/core.py @@ -1641,14 +1641,13 @@ class Superset(BaseSupersetView): dashboard_data = dash.data dashboard_data.update({ 'standalone_mode': request.args.get("standalone") == "true", + 'dash_save_perm': dash_save_perm, + 'dash_edit_perm': dash_edit_perm, }) bootstrap_data = { 'user_id': g.user.get_id(), - 'dash_save_perm': dash_save_perm, - 'dash_edit_perm': dash_edit_perm, - 'dash_edit_perm': check_ownership(dash, raise_if_false=False), - 'dashboard_data': dash.data, + 'dashboard_data': dashboard_data, 'datasources': {ds.uid: ds.data for ds in datasources}, }