From 826db3a0de5b8893476ed159e296a4d8904399d9 Mon Sep 17 00:00:00 2001 From: Tyler Smalley Date: Wed, 22 Jun 2016 13:50:22 -0700 Subject: [PATCH] Require index for all routes under {discover,visualize,dashboard} Signed-off-by: Tyler Smalley Former-commit-id: af84452b6fdee4a55d3866fad4165509baa92f1c --- src/plugins/kibana/public/dashboard/index.js | 7 +++---- src/plugins/kibana/public/discover/controllers/discover.js | 4 +++- src/plugins/kibana/public/visualize/editor/editor.js | 1 - src/plugins/kibana/public/visualize/index.js | 7 ++++--- src/plugins/kibana/public/visualize/wizard/wizard.js | 4 +--- 5 files changed, 11 insertions(+), 12 deletions(-) diff --git a/src/plugins/kibana/public/dashboard/index.js b/src/plugins/kibana/public/dashboard/index.js index 4a1aac707f928..bd8953eeaa0cd 100644 --- a/src/plugins/kibana/public/dashboard/index.js +++ b/src/plugins/kibana/public/dashboard/index.js @@ -18,11 +18,8 @@ import uiRoutes from 'ui/routes'; import uiModules from 'ui/modules'; import indexTemplate from 'plugins/kibana/dashboard/index.html'; - - require('ui/saved_objects/saved_object_registry').register(require('plugins/kibana/dashboard/services/saved_dashboard_register')); - const app = uiModules.get('app/dashboard', [ 'elasticsearch', 'ngRoute', @@ -33,9 +30,11 @@ const app = uiModules.get('app/dashboard', [ ]); uiRoutes +.defaults(/dashboard/, { + requireDefaultIndex: true +}) .when('/dashboard', { template: indexTemplate, - requireDefaultIndex: true, resolve: { dash: function (savedDashboards, config) { return savedDashboards.get(); diff --git a/src/plugins/kibana/public/discover/controllers/discover.js b/src/plugins/kibana/public/discover/controllers/discover.js index 2d4b690af3308..053e13766eaf8 100644 --- a/src/plugins/kibana/public/discover/controllers/discover.js +++ b/src/plugins/kibana/public/discover/controllers/discover.js @@ -36,10 +36,12 @@ const app = uiModules.get('apps/discover', [ ]); uiRoutes +.defaults(/discover/, { + requireDefaultIndex: true +}) .when('/discover/:id?', { template: indexTemplate, reloadOnSearch: false, - requireDefaultIndex: true, resolve: { ip: function (Promise, courier, config, $location) { return courier.indexPatterns.getIds() diff --git a/src/plugins/kibana/public/visualize/editor/editor.js b/src/plugins/kibana/public/visualize/editor/editor.js index 1506650533142..580bbb0aec632 100644 --- a/src/plugins/kibana/public/visualize/editor/editor.js +++ b/src/plugins/kibana/public/visualize/editor/editor.js @@ -21,7 +21,6 @@ import editorTemplate from 'plugins/kibana/visualize/editor/editor.html'; uiRoutes .when('/visualize/create', { template: editorTemplate, - requireDefaultIndex: true, resolve: { savedVis: function (savedVisualizations, courier, $route, Private) { const visTypes = Private(RegistryVisTypesProvider); diff --git a/src/plugins/kibana/public/visualize/index.js b/src/plugins/kibana/public/visualize/index.js index 8942f9b4103e7..74924db7e2528 100644 --- a/src/plugins/kibana/public/visualize/index.js +++ b/src/plugins/kibana/public/visualize/index.js @@ -20,13 +20,14 @@ import uiRoutes from 'ui/routes'; uiRoutes -.when('/visualize', { - redirectTo: '/visualize/step/1', +.defaults(/visualize/, { requireDefaultIndex: true +}) +.when('/visualize', { + redirectTo: '/visualize/step/1' }); // preloading require('ui/saved_objects/saved_object_registry') .register(require('plugins/kibana/visualize/saved_visualizations/saved_visualization_register')); - diff --git a/src/plugins/kibana/public/visualize/wizard/wizard.js b/src/plugins/kibana/public/visualize/wizard/wizard.js index d895a3b0963bc..64d71203d56bb 100644 --- a/src/plugins/kibana/public/visualize/wizard/wizard.js +++ b/src/plugins/kibana/public/visualize/wizard/wizard.js @@ -18,8 +18,7 @@ const module = uiModules.get('app/visualize', ['kibana/courier']); /** Wizard Step 1 /********/ routes.when('/visualize/step/1', { - template: templateStep(1, require('plugins/kibana/visualize/wizard/step_1.html')), - requireDefaultIndex: true + template: templateStep(1, require('plugins/kibana/visualize/wizard/step_1.html')) }); module.controller('VisualizeWizardStep1', function ($scope, $route, $location, timefilter, Private) { @@ -37,7 +36,6 @@ module.controller('VisualizeWizardStep1', function ($scope, $route, $location, t /********/ routes.when('/visualize/step/2', { template: templateStep(2, require('plugins/kibana/visualize/wizard/step_2.html')), - requireDefaultIndex: true, resolve: { indexPatternIds: function (courier) { return courier.indexPatterns.getIds();