From dde991d1a3f505e74a3c9c42d420ea913662dd3d Mon Sep 17 00:00:00 2001 From: Stacey Gammon Date: Fri, 5 May 2017 11:24:11 -0400 Subject: [PATCH 1/3] Hide the second toast when adding a new visualization straight from dashboard --- .../kibana/public/dashboard/dashboard.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/src/core_plugins/kibana/public/dashboard/dashboard.js b/src/core_plugins/kibana/public/dashboard/dashboard.js index 5949c58a31669..75135095b5912 100644 --- a/src/core_plugins/kibana/public/dashboard/dashboard.js +++ b/src/core_plugins/kibana/public/dashboard/dashboard.js @@ -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); } From 103041aae0ddea29781e82df5e724dfe04a5cb6d Mon Sep 17 00:00:00 2001 From: Stacey Gammon Date: Fri, 5 May 2017 13:53:57 -0400 Subject: [PATCH 2/3] fix tests that assume two notifications --- test/functional/apps/dashboard/_dashboard.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/functional/apps/dashboard/_dashboard.js b/test/functional/apps/dashboard/_dashboard.js index a6e9e66247221..3c243003fd613 100644 --- a/test/functional/apps/dashboard/_dashboard.js +++ b/test/functional/apps/dashboard/_dashboard.js @@ -134,7 +134,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 () { From 7577c52cebdeeaf0c847a1b8f7bc8aad8e0eba3d Mon Sep 17 00:00:00 2001 From: Stacey Gammon Date: Mon, 8 May 2017 09:31:42 -0400 Subject: [PATCH 3/3] fix another tests that assumes two toasts --- test/functional/apps/dashboard/_view_edit.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/functional/apps/dashboard/_view_edit.js b/test/functional/apps/dashboard/_view_edit.js index 196514324e676..d9549fe64239f 100644 --- a/test/functional/apps/dashboard/_view_edit.js +++ b/test/functional/apps/dashboard/_view_edit.js @@ -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();