From 6d3cc34a37eaafdc870e5c6c24aaa1ba1bc6a22a Mon Sep 17 00:00:00 2001 From: Maxime Beauchemin Date: Mon, 12 Jun 2017 21:04:46 -0700 Subject: [PATCH] [dashboard] notify instead of modal onSave (#2941) * [dashboard] notify instead of modal onSave * Addressing comments --- superset/assets/javascripts/dashboard/Dashboard.jsx | 8 ++++++-- .../javascripts/dashboard/components/SaveModal.jsx | 13 ++++--------- 2 files changed, 10 insertions(+), 11 deletions(-) diff --git a/superset/assets/javascripts/dashboard/Dashboard.jsx b/superset/assets/javascripts/dashboard/Dashboard.jsx index 483749c03e174..8b0a0e1c69114 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 @@ -332,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, }); }, }); diff --git a/superset/assets/javascripts/dashboard/components/SaveModal.jsx b/superset/assets/javascripts/dashboard/components/SaveModal.jsx index 7fb4e86b3464c..a22f4ac7725e0 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); }, }); }