Skip to content

Commit

Permalink
[dashboard] notify instead of modal onSave (apache#2941)
Browse files Browse the repository at this point in the history
* [dashboard] notify instead of modal onSave

* Addressing comments
  • Loading branch information
mistercrunch authored and Grace Guo committed Jun 13, 2017
1 parent cfbbc01 commit 6d3cc34
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
8 changes: 6 additions & 2 deletions superset/assets/javascripts/dashboard/Dashboard.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -60,7 +61,10 @@ function renderAlert() {

function initDashboardView(dashboard) {
render(
<Header dashboard={dashboard} />,
<div>
<AlertsWrapper />
<Header dashboard={dashboard} />
</div>,
document.getElementById('dashboard-header'),
);
// eslint-disable-next-line no-param-reassign
Expand Down Expand Up @@ -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: </ br>' + errorMsg,
body: 'Sorry, there was an error adding slices to this dashboard: ' + errorMsg,
});
},
});
Expand Down
13 changes: 4 additions & 9 deletions superset/assets/javascripts/dashboard/components/SaveModal.jsx
Original file line number Diff line number Diff line change
@@ -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');
Expand Down Expand Up @@ -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: </ br>' + errorMsg,
});
notify.error('Sorry, there was an error saving this dashboard: </ br>' + errorMsg);
},
});
}
Expand Down

0 comments on commit 6d3cc34

Please sign in to comment.