From 203c89c6da95f6daf70ba087a36c48e003988aba Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Tue, 25 Apr 2017 05:59:31 -0700 Subject: [PATCH 01/13] Removing "Index contains time-based events" checkbox --- .../create_index_pattern.html | 18 ++++-------------- .../create_index_pattern.js | 19 ++++--------------- src/core_plugins/kibana/translations/en.json | 1 - 3 files changed, 8 insertions(+), 30 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html index fc20cfbcd2db1..be76ff32698a3 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html @@ -19,7 +19,7 @@

-

— +

-
- -
- -
+
-
-
+

diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js index 7785304c85a7b..d4195e63526e6 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js @@ -24,7 +24,6 @@ uiModules.get('apps/management') // Configure the new index pattern we're going to create. this.newIndexPattern = { name: config.get('indexPattern:placeholder'), - isTimeBased: true, nameIsPattern: false, expandable: false, nameInterval: _.find(intervals, { name: 'daily' }), @@ -42,7 +41,7 @@ uiModules.get('apps/management') const fetchFieldList = () => { this.dateFields = this.newIndexPattern.timeField = null; - const useIndexList = this.newIndexPattern.isTimeBased && this.newIndexPattern.nameIsPattern; + const useIndexList = this.newIndexPattern.nameIsPattern; let fetchFieldsError; let dateFields; @@ -168,7 +167,7 @@ uiModules.get('apps/management') this.canExpandIndices = () => { // to maximize performance in the digest cycle, move from the least // expensive operation to most - return this.newIndexPattern.isTimeBased && !this.newIndexPattern.nameIsPattern && _.includes(this.newIndexPattern.name, '*'); + return !this.newIndexPattern.nameIsPattern && _.includes(this.newIndexPattern.name, '*'); }; this.refreshFieldList = () => { @@ -184,14 +183,11 @@ uiModules.get('apps/management') this.createIndexPattern = () => { const id = this.newIndexPattern.name; - const timeFieldName = - this.newIndexPattern.isTimeBased - ? this.newIndexPattern.timeField.name - : undefined; + const timeFieldName = this.newIndexPattern.timeField.name; // Only event-time-based index patterns set an intervalName. const intervalName = - this.newIndexPattern.isTimeBased && this.newIndexPattern.nameIsPattern + this.newIndexPattern.nameIsPattern ? this.newIndexPattern.nameInterval.name : undefined; @@ -228,11 +224,9 @@ uiModules.get('apps/management') }; $scope.$watchMulti([ - 'controller.newIndexPattern.isTimeBased', 'controller.newIndexPattern.nameIsPattern', 'controller.newIndexPattern.nameInterval.name' ], (newVal, oldVal) => { - const isTimeBased = newVal[0]; const nameIsPattern = newVal[1]; const newDefault = getDefaultPatternForInterval(newVal[2]); const oldDefault = getDefaultPatternForInterval(oldVal[2]); @@ -241,10 +235,6 @@ uiModules.get('apps/management') this.newIndexPattern.name = newDefault; } - if (!isTimeBased) { - this.newIndexPattern.nameIsPattern = false; - } - if (!nameIsPattern) { delete this.newIndexPattern.nameInterval; delete this.newIndexPattern.timeField; @@ -301,7 +291,6 @@ uiModules.get('apps/management') }); $scope.$watchMulti([ - 'controller.newIndexPattern.isTimeBased', 'controller.sampleCount' ], () => { this.refreshFieldList(); diff --git a/src/core_plugins/kibana/translations/en.json b/src/core_plugins/kibana/translations/en.json index 294b4627bc647..6a1c86b0face7 100644 --- a/src/core_plugins/kibana/translations/en.json +++ b/src/core_plugins/kibana/translations/en.json @@ -3,7 +3,6 @@ "UI-WELCOME_ERROR": "Kibana did not load properly. Check the server output for more information.", "KIBANA-CONFIGURE_INDEX_PATTERN": "Configure an index pattern", "KIBANA-MUST_CONFIGURE_INDEX_PATTERN": "In order to use Kibana you must configure at least one index pattern. Index patterns are used to identify the Elasticsearch index to run search and analytics against. They are also used to configure fields.", - "KIBANA-CONTAINS_TIME_BASED_EVENTS": "Index contains time-based events", "KIBANA-INDEX_NAME_CREATED_BY_EVENT_TIMES": "Use event times to create index names ", "KIBANA-DEPRECATED": "[DEPRECATED]", "KIBANA-ALERT_INDEX_PATTERN_DEPRECATED": "Time-interval based index patterns are deprecated!", From 997adf77ea6928f876f97e2468482d8532194a22 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Tue, 25 Apr 2017 06:23:57 -0700 Subject: [PATCH 02/13] Rename label --- .../indices/create_index_pattern/create_index_pattern.html | 2 +- src/core_plugins/kibana/translations/en.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html index be76ff32698a3..5dd2cf363eed1 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html @@ -43,7 +43,7 @@
+

+ The indices which match this index pattern don’t contain any time fields. +

diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js index d42ffa82a43fa..984a5b47c8fba 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js @@ -102,10 +102,11 @@ uiModules.get('apps/management') } this.dateFields = results.dateFields || []; - if (this.dateFields.length === 0) { - this.dateFields.unshift(TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELDS_IN_INDEX); - } else { + this.doesIndexHaveDateFields = this.dateFields.length > 0; + if (this.doesIndexHaveDateFields) { this.dateFields.unshift(TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELD_SELECTED); + } else { + this.dateFields.unshift(TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELDS_IN_INDEX); } this.newIndexPattern.timeField = this.dateFields[0]; }; From d60eda05b1c7e2deb26ebf4019939381c2f449ed Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Tue, 25 Apr 2017 11:56:41 -0700 Subject: [PATCH 08/13] Removing functional tests that used time-based events checkbox --- .../apps/management/_creation_form_changes.js | 24 ------------------- .../apps/management/_initial_state.js | 8 ------- test/functional/page_objects/settings_page.js | 4 ---- 3 files changed, 36 deletions(-) diff --git a/test/functional/apps/management/_creation_form_changes.js b/test/functional/apps/management/_creation_form_changes.js index 26bbc5056a2f7..ca2100cf6971e 100644 --- a/test/functional/apps/management/_creation_form_changes.js +++ b/test/functional/apps/management/_creation_form_changes.js @@ -16,30 +16,6 @@ export default function ({ getService, getPageObjects }) { }); }); - it('should hide time-based index pattern when time-based option is unchecked', function () { - const self = this; - return PageObjects.settings.getTimeBasedEventsCheckbox() - .then(function (selected) { - // uncheck the 'time-based events' checkbox - return selected.click(); - }) - // try to find the checkbox (this shouldn fail) - .then(function () { - return PageObjects.settings.getTimeBasedIndexPatternCheckbox(); - }) - .then(function () { - PageObjects.common.saveScreenshot('Settings-indices-hide-time-based-index-pattern'); - // we expect the promise above to fail - const handler = PageObjects.common.createErrorHandler(self); - const msg = 'Found time based index pattern checkbox'; - handler(msg); - }) - .catch(function () { - // we expect this failure since checkbox should be hidden - return; - }); - }); - it('should enable creation after selecting time field', function () { // select a time field and check that Create button is enabled return PageObjects.settings.selectTimeFieldOption('@timestamp') diff --git a/test/functional/apps/management/_initial_state.js b/test/functional/apps/management/_initial_state.js index 9ed9a2589e608..503224e122d4c 100644 --- a/test/functional/apps/management/_initial_state.js +++ b/test/functional/apps/management/_initial_state.js @@ -17,14 +17,6 @@ export default function ({ getService, getPageObjects }) { }); }); - it('should load with time pattern checked', function () { - return PageObjects.settings.getTimeBasedEventsCheckbox().isSelected() - .then(function (selected) { - PageObjects.common.saveScreenshot('Settings-initial-state'); - expect(selected).to.be.ok(); - }); - }); - it('should load with name pattern unchecked', function () { return PageObjects.settings.getTimeBasedIndexPatternCheckbox().isSelected() .then(function (selected) { diff --git a/test/functional/page_objects/settings_page.js b/test/functional/page_objects/settings_page.js index 943ee48ced6c1..70a62af4be3b4 100644 --- a/test/functional/page_objects/settings_page.js +++ b/test/functional/page_objects/settings_page.js @@ -51,10 +51,6 @@ export function SettingsPageProvider({ getService, getPageObjects }) { await PageObjects.common.navigateToApp('settings'); } - getTimeBasedEventsCheckbox() { - return testSubjects.find('createIndexPatternIsTimeBasedCheckBox'); - } - getTimeBasedIndexPatternCheckbox() { // fail faster since we're sometimes checking that it doesn't exist return testSubjects.find('createIndexPatternNameIsPatternCheckBox'); From 244cb720386c3ccb4e9101abe6da8f710c0a06e9 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Tue, 25 Apr 2017 11:58:15 -0700 Subject: [PATCH 09/13] s/INDEX/INDICES/ to be reflect reality --- .../indices/create_index_pattern/create_index_pattern.js | 8 ++++---- src/core_plugins/kibana/translations/en.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js index 984a5b47c8fba..e2d3cb41054de 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js @@ -43,8 +43,8 @@ uiModules.get('apps/management') NO_DATE_FIELD_SELECTED: { name: $translate.instant('KIBANA-NO_DATE_FIELD_SELECTED') }, - NO_DATE_FIELDS_IN_INDEX: { - name: $translate.instant('KIBANA-NO_DATE_FIELDS_IN_INDEX') + NO_DATE_FIELDS_IN_INDICES: { + name: $translate.instant('KIBANA-NO_DATE_FIELDS_IN_INDICES') } }; @@ -106,7 +106,7 @@ uiModules.get('apps/management') if (this.doesIndexHaveDateFields) { this.dateFields.unshift(TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELD_SELECTED); } else { - this.dateFields.unshift(TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELDS_IN_INDEX); + this.dateFields.unshift(TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELDS_IN_INDICES); } this.newIndexPattern.timeField = this.dateFields[0]; }; @@ -206,7 +206,7 @@ uiModules.get('apps/management') const id = this.newIndexPattern.name; let timeFieldName; if ((this.newIndexPattern.timeField !== TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELD_SELECTED) - && (this.newIndexPattern.timeField !== TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELDS_IN_INDEX)) { + && (this.newIndexPattern.timeField !== TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELDS_IN_INDICES)) { timeFieldName = this.newIndexPattern.timeField.name; } diff --git a/src/core_plugins/kibana/translations/en.json b/src/core_plugins/kibana/translations/en.json index 841ed45ae3111..ac74949e9e104 100644 --- a/src/core_plugins/kibana/translations/en.json +++ b/src/core_plugins/kibana/translations/en.json @@ -31,7 +31,7 @@ "KIBANA-MORE": "more", "KIBANA-TIME_FILTER_FIELD_NAME": "Time Filter field name", "KIBANA-NO_DATE_FIELD_SELECTED": "None selected", - "KIBANA-NO_DATE_FIELDS_IN_INDEX": "None available", + "KIBANA-NO_DATE_FIELDS_IN_INDICES": "None available", "KIBANA-REFRESH_FIELDS": "refresh fields", "KIBANA-INVALID_INDEX_PATTERN": "Invalid index name pattern.", "KIBANA-DATE_FORMAT_DOCS": "Date Format Documentation", From c3270a6448452503328ba3659ef09fa654b10478 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Tue, 25 Apr 2017 12:15:08 -0700 Subject: [PATCH 10/13] Fixing logic error --- .../indices/create_index_pattern/create_index_pattern.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html index d338775a478f9..f7ad538023c8c 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html @@ -60,7 +60,7 @@ auto-select-if-only-one="controller.dateFields" class="form-control" > -

+

The indices which match this index pattern don’t contain any time fields.

From 3688f1296500f5ad70545117f8f7d870c10480b3 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Tue, 25 Apr 2017 13:14:04 -0700 Subject: [PATCH 11/13] Updating functional test to match new behavior --- test/functional/apps/management/_initial_state.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/functional/apps/management/_initial_state.js b/test/functional/apps/management/_initial_state.js index 503224e122d4c..46c0ac8783d7e 100644 --- a/test/functional/apps/management/_initial_state.js +++ b/test/functional/apps/management/_initial_state.js @@ -41,10 +41,10 @@ export default function ({ getService, getPageObjects }) { }); }); - it('should not be enable creation', function () { + it('should enable creation', function () { return PageObjects.settings.getCreateIndexPatternButton().isEnabled() .then(function (enabled) { - expect(enabled).to.not.be.ok(); + expect(enabled).to.be.ok(); }); }); }); From a1c86d70f75ac7ed52a32fc5b4c97d142ab90c45 Mon Sep 17 00:00:00 2001 From: Shaunak Kashyap Date: Wed, 26 Apr 2017 14:58:33 -0700 Subject: [PATCH 12/13] Use controller property instead of inline expression --- .../indices/create_index_pattern/create_index_pattern.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html index f7ad538023c8c..eb8351a9f65e4 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.html @@ -53,7 +53,7 @@ -

+

The indices which match this index pattern don’t contain any time fields.

diff --git a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js index e2d3cb41054de..9b695ffab87c2 100644 --- a/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js +++ b/src/core_plugins/kibana/public/management/sections/indices/create_index_pattern/create_index_pattern.js @@ -102,8 +102,8 @@ uiModules.get('apps/management') } this.dateFields = results.dateFields || []; - this.doesIndexHaveDateFields = this.dateFields.length > 0; - if (this.doesIndexHaveDateFields) { + this.indexHasDateFields = this.dateFields.length > 0; + if (this.indexHasDateFields) { this.dateFields.unshift(TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELD_SELECTED); } else { this.dateFields.unshift(TIME_FILTER_FIELD_OPTIONS.NO_DATE_FIELDS_IN_INDICES);