diff --git a/src/plugins/kibana/public/dashboard/index.js b/src/plugins/kibana/public/dashboard/index.js index e8322ea212c16..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,6 +30,9 @@ const app = uiModules.get('app/dashboard', [ ]); uiRoutes +.defaults(/dashboard/, { + requireDefaultIndex: true +}) .when('/dashboard', { template: indexTemplate, resolve: { diff --git a/src/plugins/kibana/public/discover/controllers/discover.js b/src/plugins/kibana/public/discover/controllers/discover.js index 87ce5f4f74e0b..053e13766eaf8 100644 --- a/src/plugins/kibana/public/discover/controllers/discover.js +++ b/src/plugins/kibana/public/discover/controllers/discover.js @@ -36,6 +36,9 @@ const app = uiModules.get('apps/discover', [ ]); uiRoutes +.defaults(/discover/, { + requireDefaultIndex: true +}) .when('/discover/:id?', { template: indexTemplate, reloadOnSearch: false, diff --git a/src/plugins/kibana/public/management/index.js b/src/plugins/kibana/public/management/index.js index 03e3884df165a..7b33fb4af0aed 100644 --- a/src/plugins/kibana/public/management/index.js +++ b/src/plugins/kibana/public/management/index.js @@ -20,7 +20,6 @@ uiRoutes }); require('ui/index_patterns/route_setup/load_default')({ - notRequiredRe: /^\/management\/data\//, whenMissingRedirectTo: '/management/data/index' }); diff --git a/src/plugins/kibana/public/management/sections/indices/index.js b/src/plugins/kibana/public/management/sections/indices/index.js index dd4c727506d8d..bd68680435f9c 100644 --- a/src/plugins/kibana/public/management/sections/indices/index.js +++ b/src/plugins/kibana/public/management/sections/indices/index.js @@ -16,7 +16,8 @@ const indexPatternsResolutions = { // add a dependency to all of the subsection routes uiRoutes .defaults(/management\/kibana\/indices/, { - resolve: indexPatternsResolutions + resolve: indexPatternsResolutions, + requireDefaultIndex: true }); uiRoutes diff --git a/src/plugins/kibana/public/management/sections/settings/index.html b/src/plugins/kibana/public/management/sections/settings/index.html index 08402cca6b9cd..6dbf8f335cdfa 100644 --- a/src/plugins/kibana/public/management/sections/settings/index.html +++ b/src/plugins/kibana/public/management/sections/settings/index.html @@ -15,9 +15,9 @@

Caution: You can break stuff here

- - - + + + diff --git a/src/plugins/kibana/public/management/styles/main.less b/src/plugins/kibana/public/management/styles/main.less index e01266211b569..9e4dafbec228e 100644 --- a/src/plugins/kibana/public/management/styles/main.less +++ b/src/plugins/kibana/public/management/styles/main.less @@ -144,8 +144,12 @@ kbn-management-objects { kbn-management-advanced { // super specific rule to override bootstrap's equally specific rule // https://github.com/twbs/bootstrap/blob/1f329f8f17aa989eabc6e94bdcab93e69ef0e463/less/tables.less#L35 - .table > tbody > tr > td { - vertical-align: middle; + .table { + table-layout: fixed; + + tbody > tr > td { + vertical-align: middle; + } } } diff --git a/src/plugins/kibana/public/visualize/index.js b/src/plugins/kibana/public/visualize/index.js index 88f684f59ccb9..74924db7e2528 100644 --- a/src/plugins/kibana/public/visualize/index.js +++ b/src/plugins/kibana/public/visualize/index.js @@ -20,6 +20,9 @@ import uiRoutes from 'ui/routes'; uiRoutes +.defaults(/visualize/, { + requireDefaultIndex: true +}) .when('/visualize', { redirectTo: '/visualize/step/1' }); @@ -28,4 +31,3 @@ uiRoutes require('ui/saved_objects/saved_object_registry') .register(require('plugins/kibana/visualize/saved_visualizations/saved_visualization_register')); - diff --git a/src/ui/public/index_patterns/route_setup/load_default.js b/src/ui/public/index_patterns/route_setup/load_default.js index 038dfea47eb07..270e163c06c92 100644 --- a/src/ui/public/index_patterns/route_setup/load_default.js +++ b/src/ui/public/index_patterns/route_setup/load_default.js @@ -10,7 +10,6 @@ let notify = new Notifier({ module.exports = function (opts) { opts = opts || {}; - let notRequiredRe = opts.notRequiredRe || null; let whenMissingRedirectTo = opts.whenMissingRedirectTo || null; let defaultRequiredToasts = null; @@ -18,21 +17,20 @@ module.exports = function (opts) { .addSetupWork(function loadDefaultIndexPattern(Private, Promise, $route, config, indexPatterns) { let getIds = Private(GetIdsProvider); let rootSearchSource = Private(CourierDataSourceRootSearchSourceProvider); - let path = _.get($route, 'current.$$route.originalPath'); + let route = _.get($route, 'current.$$route'); return getIds() .then(function (patterns) { let defaultId = config.get('defaultIndex'); let defined = !!defaultId; let exists = _.contains(patterns, defaultId); - let required = !notRequiredRe || !path.match(notRequiredRe); if (defined && !exists) { config.remove('defaultIndex'); defaultId = defined = false; } - if (!defined && required) { + if (!defined && route.requireDefaultIndex) { throw new NoDefaultIndexPattern(); } diff --git a/src/ui/public/routes/__tests__/_route_manager.js b/src/ui/public/routes/__tests__/_route_manager.js index 75685be9b093a..c854d88325400 100644 --- a/src/ui/public/routes/__tests__/_route_manager.js +++ b/src/ui/public/routes/__tests__/_route_manager.js @@ -100,5 +100,17 @@ describe('routes/route_manager', function () { expect($rp.when.secondCall.args[1]).to.have.property('reloadOnSearch', false); expect($rp.when.lastCall.args[1]).to.have.property('reloadOnSearch', true); }); + + it('sets route.requireDefaultIndex to false by default', function () { + routes.when('/nothing-set'); + routes.when('/no-index-required', { requireDefaultIndex: false }); + routes.when('/index-required', { requireDefaultIndex: true }); + routes.config($rp); + + expect($rp.when.callCount).to.be(3); + expect($rp.when.firstCall.args[1]).to.have.property('requireDefaultIndex', false); + expect($rp.when.secondCall.args[1]).to.have.property('requireDefaultIndex', false); + expect($rp.when.lastCall.args[1]).to.have.property('requireDefaultIndex', true); + }); }); }); diff --git a/src/ui/public/routes/route_manager.js b/src/ui/public/routes/route_manager.js index 832990ba6de6c..e06c9fc6e55d5 100644 --- a/src/ui/public/routes/route_manager.js +++ b/src/ui/public/routes/route_manager.js @@ -26,6 +26,10 @@ function RouteManager() { route.reloadOnSearch = false; } + if (route.requireDefaultIndex === void 0) { + route.requireDefaultIndex = false; + } + wrapRouteWithPrep(route, setup); $routeProvider.when(path, route); }); diff --git a/test/functional/apps/management/_creation_form_changes.js b/test/functional/apps/management/_creation_form_changes.js index fb3b8bf497fea..11c70be753e16 100644 --- a/test/functional/apps/management/_creation_form_changes.js +++ b/test/functional/apps/management/_creation_form_changes.js @@ -14,6 +14,9 @@ bdd.describe('user input reactions', function () { return esClient.deleteAndUpdateConfigDoc() .then(function () { return settingsPage.navigateTo(); + }) + .then(function () { + return settingsPage.clickExistingData(); }); }); diff --git a/test/functional/apps/management/_index_pattern_create_delete.js b/test/functional/apps/management/_index_pattern_create_delete.js index 1ad16594f7b3f..6d9972794a995 100644 --- a/test/functional/apps/management/_index_pattern_create_delete.js +++ b/test/functional/apps/management/_index_pattern_create_delete.js @@ -15,6 +15,9 @@ bdd.describe('creating and deleting default index', function describeIndexTests( return esClient.deleteAndUpdateConfigDoc() .then(function () { return settingsPage.navigateTo(); + }) + .then(function () { + return settingsPage.clickExistingData(); }); }); diff --git a/test/functional/apps/management/_index_pattern_results_sort.js b/test/functional/apps/management/_index_pattern_results_sort.js index 50e1ade1ac2ef..a85943805ea36 100644 --- a/test/functional/apps/management/_index_pattern_results_sort.js +++ b/test/functional/apps/management/_index_pattern_results_sort.js @@ -34,7 +34,10 @@ bdd.describe('index result field sort', function describeIndexTests() { columns.forEach(function (col) { bdd.describe('sort by heading - ' + col.heading, function indexPatternCreation() { bdd.before(function () { - return settingsPage.navigateTo(); + return settingsPage.navigateTo() + .then(function () { + return settingsPage.clickExistingData(); + }); }); bdd.beforeEach(function () { diff --git a/test/functional/apps/management/_initial_state.js b/test/functional/apps/management/_initial_state.js index c5cdc243cba3d..d1a4719b96a04 100644 --- a/test/functional/apps/management/_initial_state.js +++ b/test/functional/apps/management/_initial_state.js @@ -14,6 +14,9 @@ bdd.describe('initial state', function () { return esClient.deleteAndUpdateConfigDoc() .then(function () { return settingsPage.navigateTo(); + }) + .then(function () { + return settingsPage.clickExistingData(); }); }); diff --git a/test/functional/apps/management/_kibana_settings.js b/test/functional/apps/management/_kibana_settings.js index cf6c5da1e858e..eb5042a8e23ed 100644 --- a/test/functional/apps/management/_kibana_settings.js +++ b/test/functional/apps/management/_kibana_settings.js @@ -12,6 +12,12 @@ bdd.describe('creating and deleting default index', function describeIndexTests( bdd.before(function () { // delete .kibana index and then wait for Kibana to re-create it return esClient.deleteAndUpdateConfigDoc() + .then(function () { + return settingsPage.navigateTo(); + }) + .then(function () { + return settingsPage.clickExistingData(); + }) .then(function () { return settingsPage.createIndexPattern(); }) diff --git a/test/support/pages/settings_page.js b/test/support/pages/settings_page.js index 9aeac6be5a55a..fa6610cd1bb61 100644 --- a/test/support/pages/settings_page.js +++ b/test/support/pages/settings_page.js @@ -14,16 +14,20 @@ export default (function () { return this.remote.findDisplayedByCssSelector('.app-link:nth-child(5) a').click(); }, - clickPath: function (path) { - return this.remote.findDisplayedByCssSelector('[kbn-href="#/management/' + path + '"]').click(); + clickLinkText: function (text) { + return this.remote.findDisplayedByLinkText(text).click(); }, clickKibanaSettings: function () { - return this.clickPath('kibana/settings'); + return this.clickLinkText('Advanced Settings'); }, clickKibanaIndicies: function () { - return this.clickPath('kibana/indices'); + return this.clickLinkText('Index Patterns'); + }, + + clickExistingData: function () { + return this.clickLinkText('Existing Data'); }, getAdvancedSettings: function getAdvancedSettings(propertyName) { @@ -315,6 +319,9 @@ export default (function () { return common.try(function () { return self.navigateTo() + .then(function () { + return self.clickExistingData(); + }) .then(function () { return self.selectTimeFieldOption('@timestamp'); })
NameValueActions NameValueActions