From 7fb0bf210a496314f89ac88909e8d17a84ff615d Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Fri, 9 Jun 2017 18:09:02 -0700 Subject: [PATCH 1/2] [dashboard] notify instead of modal onSave --- superset/assets/javascripts/dashboard/Dashboard.jsx | 6 +++++- .../javascripts/dashboard/components/SaveModal.jsx | 13 ++++--------- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/superset/assets/javascripts/dashboard/Dashboard.jsx b/superset/assets/javascripts/dashboard/Dashboard.jsx index 3abde441c16ad..148e00ec6e852 100644 --- a/superset/assets/javascripts/dashboard/Dashboard.jsx +++ b/superset/assets/javascripts/dashboard/Dashboard.jsx @@ -7,6 +7,7 @@ import moment from 'moment'; import GridLayout from './components/GridLayout'; import Header from './components/Header'; import { appSetup } from '../common'; +import AlertsWrapper from '../components/AlertsWrapper'; import '../../stylesheets/dashboard.css'; @@ -60,7 +61,10 @@ function renderAlert() { function initDashboardView(dashboard) { render( -
, +
+ +
+
, document.getElementById('dashboard-header'), ); // eslint-disable-next-line no-param-reassign diff --git a/superset/assets/javascripts/dashboard/components/SaveModal.jsx b/superset/assets/javascripts/dashboard/components/SaveModal.jsx index a414308a08a34..8ae3b964c8fc6 100644 --- a/superset/assets/javascripts/dashboard/components/SaveModal.jsx +++ b/superset/assets/javascripts/dashboard/components/SaveModal.jsx @@ -1,7 +1,8 @@ +/* global notify */ import React from 'react'; import PropTypes from 'prop-types'; import { Button, FormControl, FormGroup, Radio } from 'react-bootstrap'; -import { getAjaxErrorMsg, showModal } from '../../modules/utils'; +import { getAjaxErrorMsg } from '../../modules/utils'; import ModalTrigger from '../../components/ModalTrigger'; const $ = window.$ = require('jquery'); @@ -53,19 +54,13 @@ class SaveModal extends React.PureComponent { if (saveType === 'newDashboard') { window.location = '/superset/dashboard/' + resp.id + '/'; } else { - showModal({ - title: 'Success', - body: 'This dashboard was saved successfully.', - }); + notify.success('This dashboard was saved successfully.'); } }, error(error) { saveModal.close(); const errorMsg = getAjaxErrorMsg(error); - showModal({ - title: 'Error', - body: 'Sorry, there was an error saving this dashboard: ' + errorMsg, - }); + notify.error('Sorry, there was an error saving this dashboard: ' + errorMsg); }, }); } From d6278e0441bd76c37fbeecdd076eb95a2c6f701c Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 12 Jun 2017 13:39:52 -0700 Subject: [PATCH 2/2] Addressing comments --- superset/assets/javascripts/dashboard/Dashboard.jsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/superset/assets/javascripts/dashboard/Dashboard.jsx b/superset/assets/javascripts/dashboard/Dashboard.jsx index 148e00ec6e852..3707458efe439 100644 --- a/superset/assets/javascripts/dashboard/Dashboard.jsx +++ b/superset/assets/javascripts/dashboard/Dashboard.jsx @@ -336,7 +336,7 @@ export function dashboardContainer(dashboard, datasources, userid) { const errorMsg = getAjaxErrorMsg(error); utils.showModal({ title: 'Error', - body: 'Sorry, there was an error adding slices to this dashboard: ' + errorMsg, + body: 'Sorry, there was an error adding slices to this dashboard: ' + errorMsg, }); }, });