Hide the second toast when adding a new visualization straight from dashboard (#11621) (#11650)

* Hide the second toast when adding a new visualization straight from dashboard

* fix tests that assume two notifications

* fix another tests that assumes two toasts
This commit is contained in:
Stacey Gammon 2017-05-08 12:14:40 -04:00 committed by GitHub
parent 28c692a177
commit 91623d7095
3 changed files with 9 additions and 5 deletions

View file

@ -157,10 +157,12 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
};
// called by the saved-object-finder when a user clicks a vis
$scope.addVis = function (hit) {
$scope.addVis = function (hit, showToast = true) {
pendingVisCount++;
dashboardState.addNewPanel(hit.id, 'visualization');
notify.info(`Visualization successfully added to your dashboard`);
if (showToast) {
notify.info(`Visualization successfully added to your dashboard`);
}
};
$scope.addSearch = function (hit) {
@ -293,7 +295,11 @@ app.directive('dashboardApp', function (Notifier, courier, AppState, timefilter,
});
if ($route.current.params && $route.current.params[DashboardConstants.NEW_VISUALIZATION_ID_PARAM]) {
$scope.addVis({ id: $route.current.params[DashboardConstants.NEW_VISUALIZATION_ID_PARAM] });
// Hide the toast message since they will already see a notification from saving the visualization,
// and one is sufficient (especially given how the screen jumps down a bit for each unique notification).
const showToast = false;
$scope.addVis({ id: $route.current.params[DashboardConstants.NEW_VISUALIZATION_ID_PARAM] }, showToast);
kbnUrl.removeParam(DashboardConstants.ADD_VISUALIZATION_TO_DASHBOARD_MODE_PARAM);
kbnUrl.removeParam(DashboardConstants.NEW_VISUALIZATION_ID_PARAM);
}

View file

@ -135,7 +135,6 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.visualize.clickNewSearch();
await PageObjects.visualize.saveVisualization('visualization from add new link');
await PageObjects.header.clickToastOK();
await PageObjects.header.clickToastOK();
const visualizations = PageObjects.dashboard.getTestVisualizations();
return retry.tryForTime(10000, async function () {

View file

@ -206,7 +206,6 @@ export default function ({ getService, getPageObjects }) {
await PageObjects.visualize.clickNewSearch();
await PageObjects.visualize.saveVisualization('new viz panel');
await PageObjects.header.clickToastOK();
await PageObjects.header.clickToastOK();
await PageObjects.dashboard.clickCancelOutOfEditMode();