diff --git a/src/plugins/kibana/public/management/sections/indices/_edit.js b/src/plugins/kibana/public/management/sections/indices/_edit.js index 4b3e5146bbadb..0bcabf7c4bae6 100644 --- a/src/plugins/kibana/public/management/sections/indices/_edit.js +++ b/src/plugins/kibana/public/management/sections/indices/_edit.js @@ -11,18 +11,29 @@ import editTemplate from 'plugins/kibana/management/sections/indices/_edit.html' import IngestProvider from 'ui/ingest'; uiRoutes -.when('/management/kibana/indices/:indexPatternId?', { +.when('/management/kibana/indices/:indexPatternId', { template: editTemplate, resolve: { - indexPattern: function ($route, config, courier) { - const params = $route.current.params; + indexPattern: function ($route, courier) { + return courier.indexPatterns + .get($route.current.params.indexPatternId) + .catch(courier.redirectWhenMissing('/management/data/index')); + } + } +}); + +uiRoutes +.when('/management/kibana/indices', { + resolve: { + redirect: function ($location, config) { + const defaultIndex = config.get('defaultIndex'); + let path = '/management/data/index'; - if (typeof params.indexPatternId === 'undefined') { - params.indexPatternId = config.get('defaultIndex'); + if (defaultIndex) { + path = `/management/kibana/indices/${defaultIndex}`; } - return courier.indexPatterns.get(params.indexPatternId) - .catch(courier.redirectWhenMissing('/management/data/index')); + $location.path(path).replace(); } } }); diff --git a/src/plugins/kibana/public/management/sections/indices/index.js b/src/plugins/kibana/public/management/sections/indices/index.js index 97cd61f4131f7..55d1da5a2b471 100644 --- a/src/plugins/kibana/public/management/sections/indices/index.js +++ b/src/plugins/kibana/public/management/sections/indices/index.js @@ -16,8 +16,7 @@ const indexPatternsResolutions = { // add a dependency to all of the subsection routes uiRoutes .defaults(/management\/kibana\/indices/, { - resolve: indexPatternsResolutions, - requireDefaultIndex: true + resolve: indexPatternsResolutions }); uiRoutes