Skip to content

Commit

Permalink
[Maps] update map name in breadcrumb when changed (elastic#34287) (el…
Browse files Browse the repository at this point in the history
  • Loading branch information
nreese authored Apr 2, 2019
1 parent 379dc9f commit 1d8ee92
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions x-pack/plugins/maps/public/angular/map_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -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 });
Expand Down

0 comments on commit 1d8ee92

Please sign in to comment.