From 7059ab7ace32b5e3a6274d754420bbbbac83dac4 Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Wed, 15 Feb 2017 14:36:36 -0700 Subject: [PATCH 1/6] Hide the time interval select on blur --- .../kibana/public/discover/controllers/discover.js | 3 --- src/core_plugins/kibana/public/discover/index.html | 1 + 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/core_plugins/kibana/public/discover/controllers/discover.js b/src/core_plugins/kibana/public/discover/controllers/discover.js index e9f4012d28f7c..2a0c4eb9c911d 100644 --- a/src/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/core_plugins/kibana/public/discover/controllers/discover.js @@ -236,9 +236,6 @@ function discoverController($scope, config, courier, $route, $window, Notifier, }); $scope.$watch('state.interval', function (interval, oldInterval) { - if (interval !== oldInterval && interval === 'auto') { - $scope.showInterval = false; - } $scope.fetch(); }); diff --git a/src/core_plugins/kibana/public/discover/index.html b/src/core_plugins/kibana/public/discover/index.html index 3584ef747bcaf..177f604f93e45 100644 --- a/src/core_plugins/kibana/public/discover/index.html +++ b/src/core_plugins/kibana/public/discover/index.html @@ -102,6 +102,7 @@

Searching

class="form-control" ng-model="state.interval" ng-options="interval.val as interval.display for interval in intervalOptions | filter: intervalEnabled" + ng-blur="toggleInterval()" > From 7c19040e2872fb337e7fc205406f6701258db967 Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Mon, 27 Feb 2017 17:36:00 -0700 Subject: [PATCH 2/6] Show scale warning on discover and keep drop-down --- .../public/discover/controllers/discover.js | 7 +------ .../kibana/public/discover/index.html | 15 +++++++-------- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/src/core_plugins/kibana/public/discover/controllers/discover.js b/src/core_plugins/kibana/public/discover/controllers/discover.js index 3162322449c1c..b74fb2f214d22 100644 --- a/src/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/core_plugins/kibana/public/discover/controllers/discover.js @@ -108,9 +108,6 @@ function discoverController($scope, config, courier, $route, $window, Notifier, return interval.val !== 'custom'; }; - $scope.toggleInterval = function () { - $scope.showInterval = !$scope.showInterval; - }; $scope.topNavMenu = [{ key: 'new', description: 'New Search', @@ -246,9 +243,7 @@ function discoverController($scope, config, courier, $route, $window, Notifier, const buckets = $scope.vis.aggs.bySchemaGroup.buckets; if (buckets && buckets.length === 1) { - $scope.intervalName = 'by ' + buckets[0].buckets.getInterval().description; - } else { - $scope.intervalName = 'auto'; + $scope.bucketInterval = buckets[0].buckets.getInterval(); } }); diff --git a/src/core_plugins/kibana/public/discover/index.html b/src/core_plugins/kibana/public/discover/index.html index f792ceeee1c10..e74dda7f7a3b2 100644 --- a/src/core_plugins/kibana/public/discover/index.html +++ b/src/core_plugins/kibana/public/discover/index.html @@ -90,14 +90,7 @@

Searching

— - - - {{ intervalName }} - - - - + + + From 0e08e63e0ee03988c070685ee93c3103b46029e3 Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Tue, 28 Feb 2017 10:43:49 -0700 Subject: [PATCH 3/6] Show scale without need to hover over info icon --- src/core_plugins/kibana/public/discover/index.html | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/core_plugins/kibana/public/discover/index.html b/src/core_plugins/kibana/public/discover/index.html index e74dda7f7a3b2..b02d987a7097e 100644 --- a/src/core_plugins/kibana/public/discover/index.html +++ b/src/core_plugins/kibana/public/discover/index.html @@ -98,12 +98,14 @@

Searching

ng-blur="toggleInterval()" > - - + + + + Scaled to {{ bucketInterval.description }} +
From b135dfe53993191859623cd4192fb04c7aae577e Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Tue, 28 Mar 2017 12:47:06 -0700 Subject: [PATCH 4/6] Remove unused variables --- src/core_plugins/kibana/public/discover/controllers/discover.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/core_plugins/kibana/public/discover/controllers/discover.js b/src/core_plugins/kibana/public/discover/controllers/discover.js index 3a512138d96a4..6f469ee28eba4 100644 --- a/src/core_plugins/kibana/public/discover/controllers/discover.js +++ b/src/core_plugins/kibana/public/discover/controllers/discover.js @@ -233,7 +233,7 @@ function discoverController($scope, config, courier, $route, $window, Notifier, timefilter.enabled = !!timefield; }); - $scope.$watch('state.interval', function (interval, oldInterval) { + $scope.$watch('state.interval', function () { $scope.fetch(); }); From 60fe61139df64792e4fa6f9828ef27332eee2c78 Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Tue, 28 Mar 2017 14:06:33 -0700 Subject: [PATCH 5/6] Fix discover page object tests --- .../kibana/public/discover/index.html | 1 + test/functional/apps/discover/_discover.js | 8 ++--- test/support/page_objects/discover_page.js | 30 ++----------------- 3 files changed, 8 insertions(+), 31 deletions(-) diff --git a/src/core_plugins/kibana/public/discover/index.html b/src/core_plugins/kibana/public/discover/index.html index b02d987a7097e..abd460e912735 100644 --- a/src/core_plugins/kibana/public/discover/index.html +++ b/src/core_plugins/kibana/public/discover/index.html @@ -96,6 +96,7 @@

Searching

ng-model="state.interval" ng-options="interval.val as interval.display for interval in intervalOptions | filter: intervalEnabled" ng-blur="toggleInterval()" + data-test-subj="discoverIntervalSelect" > diff --git a/test/functional/apps/discover/_discover.js b/test/functional/apps/discover/_discover.js index 036f3bec5cd73..eff2f7c091ae4 100644 --- a/test/functional/apps/discover/_discover.js +++ b/test/functional/apps/discover/_discover.js @@ -82,10 +82,10 @@ bdd.describe('discover app', function describeIndexTests() { expect(actualTimeString).to.be(expectedTimeString); }); - bdd.it('should show correct initial chart interval of 3 hours', async function () { + bdd.it('should show correct initial chart interval of Auto', async function () { const actualInterval = await PageObjects.discover.getChartInterval(); - const expectedInterval = 'by 3 hours'; + const expectedInterval = 'Auto'; expect(actualInterval).to.be(expectedInterval); }); @@ -155,8 +155,8 @@ bdd.describe('discover app', function describeIndexTests() { await verifyChartData(expectedBarChartData); }); - bdd.it('should show Auto chart interval of 3 hours', async function () { - const expectedChartInterval = 'by 3 hours'; + bdd.it('should show Auto chart interval', async function () { + const expectedChartInterval = 'Auto'; const actualInterval = await PageObjects.discover.getChartInterval(); expect(actualInterval).to.be(expectedChartInterval); diff --git a/test/support/page_objects/discover_page.js b/test/support/page_objects/discover_page.js index 950271f5791cf..126c88984c033 100644 --- a/test/support/page_objects/discover_page.js +++ b/test/support/page_objects/discover_page.js @@ -131,38 +131,14 @@ export default class DiscoverPage { } getChartInterval() { - return this.findTimeout - .findByCssSelector('a[ng-click="toggleInterval()"]') - .getVisibleText() - .then(intervalText => { - if (intervalText.length > 0) { - return intervalText; - } else { - return this.findTimeout - .findByCssSelector('select[ng-model="state.interval"]') - .getProperty('value') // this gets 'string:d' for Daily - .then(selectedValue => { - return this.findTimeout - .findByCssSelector('option[value="' + selectedValue + '"]') - .getVisibleText(); - }); - } - }); + return PageObjects.common.findTestSubject('discoverIntervalSelect') + .getVisibleText(); } setChartInterval(interval) { return this.remote.setFindTimeout(5000) - .findByCssSelector('a[ng-click="toggleInterval()"]') + .findByCssSelector('option[label="' + interval + '"]') .click() - .catch(() => { - // in some cases we have the link above, but after we've made a - // selection we just have a select list. - }) - .then(() => { - return this.findTimeout - .findByCssSelector('option[label="' + interval + '"]') - .click(); - }) .then(() => { return PageObjects.header.waitUntilLoadingHasFinished(); }); From 9aca04e639e381ae0ea984a5489e9aa38d87cb6c Mon Sep 17 00:00:00 2001 From: Lukas Olson Date: Tue, 28 Mar 2017 15:19:36 -0700 Subject: [PATCH 6/6] Fix getChartInterval in functional test --- test/support/page_objects/discover_page.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/test/support/page_objects/discover_page.js b/test/support/page_objects/discover_page.js index 126c88984c033..c9806753dee65 100644 --- a/test/support/page_objects/discover_page.js +++ b/test/support/page_objects/discover_page.js @@ -132,7 +132,12 @@ export default class DiscoverPage { getChartInterval() { return PageObjects.common.findTestSubject('discoverIntervalSelect') - .getVisibleText(); + .getProperty('value') + .then(selectedValue => { + return this.findTimeout + .findByCssSelector('option[value="' + selectedValue + '"]') + .getVisibleText(); + }); } setChartInterval(interval) {