From dee7b9a5f8125855b692329d449c19b5008c9861 Mon Sep 17 00:00:00 2001 From: Nathan Reese Date: Tue, 2 Apr 2019 10:07:52 -0600 Subject: [PATCH] [Maps] update map name in breadcrumb when changed (#34287) --- .../maps/public/angular/map_controller.js | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) diff --git a/x-pack/plugins/maps/public/angular/map_controller.js b/x-pack/plugins/maps/public/angular/map_controller.js index 2b4616becf02b..6ea9e984785c1 100644 --- a/x-pack/plugins/maps/public/angular/map_controller.js +++ b/x-pack/plugins/maps/public/angular/map_controller.js @@ -51,7 +51,7 @@ const app = uiModules.get('app/maps', []); app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage, AppState, globalState, Private) => { - const savedMap = $scope.map = $route.current.locals.map; + const savedMap = $route.current.locals.map; let unsubscribe; const store = createMapStore(); @@ -203,13 +203,18 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage } }); - // TODO subscribe to store change and change when store updates title - chrome.breadcrumbs.set([ - { text: i18n.translate('xpack.maps.mapController.mapsBreadcrumbLabel', { - defaultMessage: 'Maps' - }), href: '#' }, - { text: $scope.map.title } - ]); + const updateBreadcrumbs = () => { + chrome.breadcrumbs.set([ + { + text: i18n.translate('xpack.maps.mapController.mapsBreadcrumbLabel', { + defaultMessage: 'Maps' + }), + href: '#' + }, + { text: savedMap.title } + ]); + }; + updateBreadcrumbs(); addHelpMenuToAppChrome(chrome); @@ -243,6 +248,8 @@ app.controller('GisMapController', ($scope, $route, config, kbnUrl, localStorage 'data-test-subj': 'saveMapSuccess', }); + updateBreadcrumbs(); + if (savedMap.id !== $route.current.params.id) { $scope.$evalAsync(() => { kbnUrl.change(`map/{{id}}`, { id: savedMap.id });