Skip to content

Commit

Permalink
Merge pull request #7588 from tylersmalley/7563-default-index
Browse files Browse the repository at this point in the history
Handle indexes with no default
  • Loading branch information
tylersmalley authored Jun 29, 2016
2 parents 61dd6e1 + 5f5a7be commit a97184d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
25 changes: 18 additions & 7 deletions src/plugins/kibana/public/management/sections/indices/_edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit a97184d

Please sign in to comment.