From b270146b0a4e0762b6adeb45f599c9cc13a700bc Mon Sep 17 00:00:00 2001 From: Jimmy Jones Date: Tue, 9 Feb 2016 20:03:30 +0000 Subject: [PATCH 01/11] Add field exists filter button to doc table --- src/plugins/kbn_doc_views/public/views/table.html | 9 +++++++++ src/plugins/kbn_doc_views/public/views/table.js | 3 ++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/src/plugins/kbn_doc_views/public/views/table.html b/src/plugins/kbn_doc_views/public/views/table.html index b08a66f78136..e308e69c6be5 100644 --- a/src/plugins/kbn_doc_views/public/views/table.html +++ b/src/plugins/kbn_doc_views/public/views/table.html @@ -27,6 +27,15 @@ tooltip-append-to-body="1" class="fa fa-columns"> + + + + + + diff --git a/src/plugins/kbn_doc_views/public/views/table.js b/src/plugins/kbn_doc_views/public/views/table.js index c0ebc4b8edf6..bbaf0cc650b7 100644 --- a/src/plugins/kbn_doc_views/public/views/table.js +++ b/src/plugins/kbn_doc_views/public/views/table.js @@ -13,7 +13,8 @@ docViewsRegistry.register(function () { hit: '=', indexPattern: '=', filter: '=', - columns: '=' + columns: '=', + updateFilterInQuery: '=filter' }, controller: function ($scope) { $scope.mapping = $scope.indexPattern.fields.byName; From ebadcaa94568ed13fb573be4ea1f8e8023d732a0 Mon Sep 17 00:00:00 2001 From: Jimmy Jones Date: Sat, 13 Feb 2016 15:17:44 +0000 Subject: [PATCH 02/11] Switch to asterisk as suggested by @spalger --- src/plugins/kbn_doc_views/public/views/table.html | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/kbn_doc_views/public/views/table.html b/src/plugins/kbn_doc_views/public/views/table.html index e308e69c6be5..d10f7b6f3eb6 100644 --- a/src/plugins/kbn_doc_views/public/views/table.html +++ b/src/plugins/kbn_doc_views/public/views/table.html @@ -31,10 +31,10 @@ + class="fa fa-asterisk"> - + From 65feedb90aa9572c3eb80b138f21c892131c53cc Mon Sep 17 00:00:00 2001 From: Jimmy Jones Date: Sat, 16 Apr 2016 22:09:48 +0100 Subject: [PATCH 03/11] Add testcases for field exists filter --- src/plugins/kbn_doc_views/public/__tests__/doc_views.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/kbn_doc_views/public/__tests__/doc_views.js b/src/plugins/kbn_doc_views/public/__tests__/doc_views.js index 76643b9baa6d..c931996d53a2 100644 --- a/src/plugins/kbn_doc_views/public/__tests__/doc_views.js +++ b/src/plugins/kbn_doc_views/public/__tests__/doc_views.js @@ -106,6 +106,8 @@ describe('docViews', function () { expect($scope.filter.calledOnce).to.be(true); cell.find('.fa-search-minus').first().click(); expect($scope.filter.calledTwice).to.be(true); + cell.find('.fa-asterisk').first().click(); + expect($scope.filter.calledThrice).to.be(true); }); it('should NOT apply a filter when clicking non-filterable fields', function () { @@ -115,6 +117,8 @@ describe('docViews', function () { expect($scope.filter.calledOnce).to.be(false); cell.find('.fa-search-minus').first().click(); expect($scope.filter.calledTwice).to.be(false); + cell.find('.fa-asterisk').first().click(); + expect($scope.filter.calledOnce).to.be(true); }); }); From 58a139d3c35755929dae6b918b6171bf57afac98 Mon Sep 17 00:00:00 2001 From: Nicolas Bevacqua Date: Tue, 19 Apr 2016 11:31:55 -0300 Subject: [PATCH 04/11] [chore] Toast errors when "Export All" ES query fails. --- .../public/settings/sections/objects/_objects.js | 12 +++++------- src/ui/public/utils/__tests__/scanner.js | 15 ++++++++++++++- src/ui/public/utils/scanner.js | 4 ++++ 3 files changed, 23 insertions(+), 8 deletions(-) diff --git a/src/plugins/kibana/public/settings/sections/objects/_objects.js b/src/plugins/kibana/public/settings/sections/objects/_objects.js index ea4bcbfca976..8f3df1a9fd06 100644 --- a/src/plugins/kibana/public/settings/sections/objects/_objects.js +++ b/src/plugins/kibana/public/settings/sections/objects/_objects.js @@ -93,13 +93,11 @@ uiModules.get('apps/settings') retrieveAndExportDocs(objs); }; - $scope.exportAll = () => { - Promise.map($scope.services, (service) => - service.service.scanAll('').then((results) => - results.hits.map((hit) => _.extend(hit, {type: service.type})) - ) - ).then((results) => retrieveAndExportDocs(_.flattenDeep(results))); - }; + $scope.exportAll = () => Promise.map($scope.services, service => service.service + .scanAll('') + .then(results => results.hits.map(hit => _.extend(hit, { type: service.type }))) + .catch(error => notify.error(error)) + ).then(results => retrieveAndExportDocs(_.flattenDeep(results))); function retrieveAndExportDocs(objs) { if (!objs.length) return notify.error('No saved objects to export.'); diff --git a/src/ui/public/utils/__tests__/scanner.js b/src/ui/public/utils/__tests__/scanner.js index ca80d782b60d..1d3feb196a36 100644 --- a/src/ui/public/utils/__tests__/scanner.js +++ b/src/ui/public/utils/__tests__/scanner.js @@ -53,9 +53,22 @@ describe('Scanner', function () { scroll = sinon.stub(scanner.client, 'scroll', (req, cb) => cb(null, mockScroll)); }); + it('should reject when an error occurs', function (done) { + search.restore(); + search = sinon.stub(scanner.client, 'search', (req, cb) => cb(new Error('fail.'))); + return scanner.scanAndMap('') + .then(function (response) { + done(new Error('should reject')); + }) + .catch(function (error) { + expect(error.message).to.be('fail.'); + done(); + }); + }); + it('should search and then scroll for results', function () { return scanner.scanAndMap('') - .then(function (error, response) { + .then(function (response) { expect(search.called).to.be(true); expect(scroll.called).to.be(true); }); diff --git a/src/ui/public/utils/scanner.js b/src/ui/public/utils/scanner.js index 3853ed0db911..93ddc988d66a 100644 --- a/src/ui/public/utils/scanner.js +++ b/src/ui/public/utils/scanner.js @@ -38,6 +38,10 @@ Scanner.prototype.scanAndMap = function (searchString, options, mapFn) { return new Promise((resolve, reject) => { const getMoreUntilDone = (error, response) => { + if (error) { + reject(error); + return; + } const scanAllResults = opts.docCount === Infinity; allResults.total = scanAllResults ? response.hits.total : Math.min(response.hits.total, opts.docCount); scrollId = response._scroll_id || scrollId; From 36a5c9e67154645166ca65a3d74cbc864c88065e Mon Sep 17 00:00:00 2001 From: Nicolas Bevacqua Date: Wed, 20 Apr 2016 16:36:00 -0300 Subject: [PATCH 05/11] [refactor] Display a single warning by using .catch on Promise.map --- .../settings/sections/objects/_objects.js | 28 ++++++++++--------- 1 file changed, 15 insertions(+), 13 deletions(-) diff --git a/src/plugins/kibana/public/settings/sections/objects/_objects.js b/src/plugins/kibana/public/settings/sections/objects/_objects.js index 8f3df1a9fd06..c237b3e4823f 100644 --- a/src/plugins/kibana/public/settings/sections/objects/_objects.js +++ b/src/plugins/kibana/public/settings/sections/objects/_objects.js @@ -1,13 +1,13 @@ import { saveAs } from '@spalger/filesaver'; -import _ from 'lodash'; +import { extend, find, flattenDeep, partialRight, pick, pluck, sortBy } from 'lodash'; import angular from 'angular'; import registry from 'plugins/kibana/settings/saved_object_registry'; import objectIndexHTML from 'plugins/kibana/settings/sections/objects/_objects.html'; import 'ui/directives/file_upload'; import uiRoutes from 'ui/routes'; import uiModules from 'ui/modules'; -const MAX_SIZE = Math.pow(2, 31) - 1; +const MAX_SIZE = Math.pow(2, 31) - 1; uiRoutes .when('/settings/objects', { @@ -41,9 +41,9 @@ uiModules.get('apps/settings') }); $q.all(services).then(function (data) { - $scope.services = _.sortBy(data, 'title'); + $scope.services = sortBy(data, 'title'); let tab = $scope.services[0]; - if ($state.tab) $scope.currentTab = tab = _.find($scope.services, {title: $state.tab}); + if ($state.tab) $scope.currentTab = tab = find($scope.services, {title: $state.tab}); $scope.$watch('state.tab', function (tab) { if (!tab) $scope.changeTab($scope.services[0]); @@ -83,21 +83,23 @@ uiModules.get('apps/settings') }; $scope.bulkDelete = function () { - $scope.currentTab.service.delete(_.pluck($scope.selectedItems, 'id')).then(refreshData).then(function () { + $scope.currentTab.service.delete(pluck($scope.selectedItems, 'id')).then(refreshData).then(function () { $scope.selectedItems.length = 0; }); }; $scope.bulkExport = function () { - const objs = $scope.selectedItems.map(_.partialRight(_.extend, {type: $scope.currentTab.type})); + const objs = $scope.selectedItems.map(partialRight(extend, {type: $scope.currentTab.type})); retrieveAndExportDocs(objs); }; - $scope.exportAll = () => Promise.map($scope.services, service => service.service - .scanAll('') - .then(results => results.hits.map(hit => _.extend(hit, { type: service.type }))) - .catch(error => notify.error(error)) - ).then(results => retrieveAndExportDocs(_.flattenDeep(results))); + $scope.exportAll = () => Promise + .map($scope.services, service => service.service + .scanAll('') + .then(result => result.hits.map(hit => extend(hit, { type: service.type }))) + ) + .then(results => retrieveAndExportDocs(flattenDeep(results))) + .catch(error => notify.error(error)); function retrieveAndExportDocs(objs) { if (!objs.length) return notify.error('No saved objects to export.'); @@ -106,7 +108,7 @@ uiModules.get('apps/settings') body: {docs: objs.map(transformToMget)} }) .then(function (response) { - saveToFile(response.docs.map(_.partialRight(_.pick, '_id', '_type', '_source'))); + saveToFile(response.docs.map(partialRight(pick, '_id', '_type', '_source'))); }); } @@ -129,7 +131,7 @@ uiModules.get('apps/settings') } return Promise.map(docs, function (doc) { - const service = _.find($scope.services, {type: doc._type}).service; + const service = find($scope.services, {type: doc._type}).service; return service.get().then(function (obj) { obj.id = doc._id; return obj.applyESResp(doc).then(function () { From d91da0456dc70db8d6345084b72a7bdbf2706888 Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 22 Apr 2016 14:09:25 -0500 Subject: [PATCH 06/11] [functionalTests] use console-like logging api The `common.log` and `common.debug` API currently accept a single string arguments, which is similar to the console.log API but not complete. This simple change brings updates it to match the API completely, supporting things like multiple arguments and sprintf-style templates. --- test/support/pages/common.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/test/support/pages/common.js b/test/support/pages/common.js index 906231b894ed..6c14752039df 100644 --- a/test/support/pages/common.js +++ b/test/support/pages/common.js @@ -9,6 +9,7 @@ export default (function () { var _ = require('lodash'); var parse = require('url').parse; var format = require('url').format; + var util = require('util'); var path = require('path'); function injectTimestampQuery(func, url) { @@ -206,12 +207,12 @@ export default (function () { return Promise.try(attempt); }, - log: function log(logString) { - console.log(moment().format('HH:mm:ss.SSS') + ': ' + logString); + log(...args) { + console.log(moment().format('HH:mm:ss.SSS') + ':', util.format(...args)); }, - debug: function debug(logString) { - if (config.debug) this.log(logString); + debug(...args) { + if (config.debug) this.log(...args); }, sleep: function sleep(sleepMilliseconds) { From 729f37567e06ac13827d971fc0f80651c88b0dab Mon Sep 17 00:00:00 2001 From: Jimmy Jones Date: Sun, 1 May 2016 14:30:06 +0100 Subject: [PATCH 07/11] Use filter directly --- src/plugins/kbn_doc_views/public/views/table.html | 2 +- src/plugins/kbn_doc_views/public/views/table.js | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/plugins/kbn_doc_views/public/views/table.html b/src/plugins/kbn_doc_views/public/views/table.html index d10f7b6f3eb6..e3e474b21f5f 100644 --- a/src/plugins/kbn_doc_views/public/views/table.html +++ b/src/plugins/kbn_doc_views/public/views/table.html @@ -28,7 +28,7 @@ class="fa fa-columns"> - diff --git a/src/plugins/kbn_doc_views/public/views/table.js b/src/plugins/kbn_doc_views/public/views/table.js index 734436d06d11..af201f39c353 100644 --- a/src/plugins/kbn_doc_views/public/views/table.js +++ b/src/plugins/kbn_doc_views/public/views/table.js @@ -13,8 +13,7 @@ docViewsRegistry.register(function () { hit: '=', indexPattern: '=', filter: '=', - columns: '=', - updateFilterInQuery: '=filter' + columns: '=' }, controller: function ($scope) { $scope.mapping = $scope.indexPattern.fields.byName; From 412b711a195ccdf3811b3b605152bb07ca717727 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Mon, 2 May 2016 09:55:55 -0700 Subject: [PATCH 08/11] Add the license check back --- tasks/config/licenses.js | 15 ++++++++++++++- tasks/licenses.js | 8 ++++++-- tasks/test.js | 1 + 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/tasks/config/licenses.js b/tasks/config/licenses.js index f7800c7f2e55..fc6d0c9c3baf 100644 --- a/tasks/config/licenses.js +++ b/tasks/config/licenses.js @@ -6,14 +6,18 @@ module.exports = function (grunt) { 'MIT*', 'MIT License', 'MIT/X11', + 'OFL-1.1 AND MIT', 'new BSD, and MIT', + '(MIT OR Apache-2.0)', 'BSD', 'BSD*', 'BSD New', 'BSD-like', 'BSD-2-Clause', + '(BSD-2-Clause OR MIT OR Apache-2.0)', 'BSD-3-Clause', 'CC-BY', + 'CC-BY-4.0', 'Apache', 'Apache*', 'Apache v2', @@ -29,9 +33,10 @@ module.exports = function (grunt) { ], overrides: { 'amdefine@1.0.0': ['BSD-3-Clause', 'MIT'], - 'angular-bootstrap@0.10.0': ['MIT'], + '@spalger/angular-bootstrap@0.12.1': ['MIT'], 'angular-ui-ace@0.2.3': ['MIT'], 'assert-plus@0.1.5': ['MIT'], + 'buffers@0.1.1': ['MIT/X11'], 'color-name@1.0.0': ['UNLICENSE'], 'commander@2.2.0': ['MIT'], 'css-color-names@0.0.1': ['MIT'], @@ -39,15 +44,23 @@ module.exports = function (grunt) { 'css-stringify@1.0.5': ['MIT'], 'css@1.0.8': ['MIT'], 'cycle@1.0.3': ['Public-Domain'], + 'delegate@3.0.1': ['MIT'], 'FileSaver@1.1.0': ['MIT'], 'flatten@0.0.1': ['MIT'], 'indexof@0.0.1': ['MIT'], 'inherits@1.0.0': ['ISC'], + 'is-buffer@1.1.2': ['MIT'], 'jsonpointer@1.1.0': ['MIT'], + 'lazy-cache@1.0.3': ['MIT'], 'leaflet@0.7.2': ['BSD-2-Clause'], 'Nonsense@0.1.2': ['Public-Domain'], 'pkginfo@0.2.3': ['MIT'], + 'readable-stream@2.0.5': ['MIT'], + 'repeat-string@1.5.2': ['MIT'], + 'ripemd160@0.2.0': ['MIT'], + 'select@1.0.6': ['MIT'], 'uglify-js@2.2.5': ['BSD'], + 'tweetnacl@0.14.3': ['Public-Domain'], } } }; diff --git a/tasks/licenses.js b/tasks/licenses.js index b7977b418630..85d1cfdb7961 100644 --- a/tasks/licenses.js +++ b/tasks/licenses.js @@ -13,11 +13,15 @@ module.exports = function (grunt) { var options = { start: process.cwd(), json: true }; var checkQueueLength = 2; + function getLicenses(info, dependency) { + if (config.overrides[dependency]) return config.overrides[dependency]; + if (info && info.licenses) return _.flatten([info.licenses]); + } + function processPackage(info, dependency) { var pkgInfo = {}; pkgInfo.name = dependency; - pkgInfo.licenses = config.overrides[dependency] || (info && info.licenses); - pkgInfo.licenses = _.isArray(pkgInfo.licenses) ? pkgInfo.licenses : [pkgInfo.licenses]; + pkgInfo.licenses = getLicenses(info, dependency); pkgInfo.valid = (function () { if (_.intersection(pkgInfo.licenses, config.licenses).length > 0) { return true; diff --git a/tasks/test.js b/tasks/test.js index cc18fac14c7c..7fab931c0d50 100644 --- a/tasks/test.js +++ b/tasks/test.js @@ -60,6 +60,7 @@ module.exports = function (grunt) { grunt.task.run(_.compact([ !grunt.option('quick') && 'eslint:source', + 'licenses', 'test:quick' ])); }); From ee3119e6789ed9b3a23b27de11ad33d77c5204ab Mon Sep 17 00:00:00 2001 From: LeeDr Date: Wed, 4 May 2016 13:00:37 -0500 Subject: [PATCH 09/11] A couple of simple console tests to make sure its there and works. --- test/functional/apps/console/_console.js | 68 ++++++++++++++++++ test/functional/apps/console/index.js | 17 +++++ .../apps/discover/_collapse_expand.js | 4 +- test/functional/index.js | 3 +- test/server_config.js | 3 + test/support/index.js | 2 + test/support/pages/common.js | 4 ++ test/support/pages/console_page.js | 69 +++++++++++++++++++ 8 files changed, 166 insertions(+), 4 deletions(-) create mode 100644 test/functional/apps/console/_console.js create mode 100644 test/functional/apps/console/index.js create mode 100644 test/support/pages/console_page.js diff --git a/test/functional/apps/console/_console.js b/test/functional/apps/console/_console.js new file mode 100644 index 000000000000..6e808931f7d8 --- /dev/null +++ b/test/functional/apps/console/_console.js @@ -0,0 +1,68 @@ +import { + bdd, + scenarioManager, + common, + // settingsPage, + // headerPage, + consolePage +} from '../../../support'; + +(function () { + var expect = require('expect.js'); + + (function () { + bdd.describe('console app', function describeIndexTests() { + bdd.before(function () { + common.debug('navigateTo console'); + return common.navigateToApp('console', false) + .catch(common.handleError(this)); + }); + + + bdd.it('should show the default request', function () { + var expectedRequest = [ + 'GET _search', + '{', + ' "query": {', + ' "match_all": {}', + ' }', + '}', + '' + ]; + // collapse the help pane because we only get the VISIBLE TEXT, not the part that is scrolled + return consolePage.collapseHelp() + .then(function () { + return common.try(function () { + return consolePage.getRequest() + .then(function (actualRequest) { + expect(actualRequest).to.eql(expectedRequest); + }); + }); + }) + .catch(common.handleError(this)); + }); + + bdd.it('default request reponse should contain .kibana' , function () { + var expectedResponseContains = '"_index": ".kibana",'; + var elasticsearch = common.getEsHostPort(); + return consolePage.setServer(elasticsearch) + .then(function () { + return consolePage.clickPlay(); + }) + .then(function () { + return common.try(function () { + return consolePage.getResponse() + .then(function (actualResponse) { + common.debug(actualResponse); + expect(actualResponse).to.contain(expectedResponseContains); + }); + }); + }) + .catch(common.handleError(this)); + }); + + + + }); + }()); +}()); diff --git a/test/functional/apps/console/index.js b/test/functional/apps/console/index.js new file mode 100644 index 000000000000..057a57e52cfa --- /dev/null +++ b/test/functional/apps/console/index.js @@ -0,0 +1,17 @@ +import { bdd, remote, scenarioManager, defaultTimeout } from '../../../support'; + +(function () { + bdd.describe('console app', function () { + this.timeout = defaultTimeout; + + bdd.before(function () { + return remote.setWindowSize(1200,800); + }); + + bdd.after(function unloadMakelogs() { + return scenarioManager.unload('logstashFunctional'); + }); + + require('./_console'); + }); +}()); diff --git a/test/functional/apps/discover/_collapse_expand.js b/test/functional/apps/discover/_collapse_expand.js index 25b9a116f23b..9630f924467d 100644 --- a/test/functional/apps/discover/_collapse_expand.js +++ b/test/functional/apps/discover/_collapse_expand.js @@ -12,10 +12,8 @@ import { (function () { bdd.describe('discover tab', function describeIndexTests() { - var baseUrl; bdd.before(function () { - baseUrl = common.getHostPort(); var fromTime = '2015-09-19 06:31:44.000'; var toTime = '2015-09-23 18:31:44.000'; @@ -26,7 +24,7 @@ import { .then(function loadIfEmptyMakelogs() { return scenarioManager.loadIfEmpty('logstashFunctional'); }) - .then(function (navigateTo) { + .then(function () { common.debug('navigateTo'); return settingsPage.navigateTo(); }) diff --git a/test/functional/index.js b/test/functional/index.js index 368c9f357c50..85caa6baac0b 100644 --- a/test/functional/index.js +++ b/test/functional/index.js @@ -23,7 +23,8 @@ define(function (require) { 'intern/dojo/node!./apps/discover', 'intern/dojo/node!./status_page', 'intern/dojo/node!./apps/settings', - 'intern/dojo/node!./apps/visualize' + 'intern/dojo/node!./apps/visualize', + 'intern/dojo/node!./apps/console' ], function () {}); }); }); diff --git a/test/server_config.js b/test/server_config.js index 8a27c968eb7e..35bf5fefa738 100644 --- a/test/server_config.js +++ b/test/server_config.js @@ -41,6 +41,9 @@ module.exports = { settings: { pathname: kibanaURL, hash: '/settings' + }, + console: { + pathname: 'app/console', } } }; diff --git a/test/support/index.js b/test/support/index.js index a414f794388c..2d63ee8da05b 100644 --- a/test/support/index.js +++ b/test/support/index.js @@ -6,6 +6,7 @@ import SettingsPage from './pages/settings_page'; import HeaderPage from './pages/header_page'; import VisualizePage from './pages/visualize_page'; import ShieldPage from './pages/shield_page'; +import ConsolePage from './pages/console_page'; const kbnInternVars = global.__kibana__intern__; @@ -23,6 +24,7 @@ defineDelayedExport('headerPage', () => new HeaderPage()); defineDelayedExport('settingsPage', () => new SettingsPage()); defineDelayedExport('visualizePage', () => new VisualizePage()); defineDelayedExport('shieldPage', () => new ShieldPage()); +defineDelayedExport('consolePage', () => new ConsolePage()); // creates an export for values that aren't actually avaialable until // until tests start to run. These getters will throw errors if the export diff --git a/test/support/pages/common.js b/test/support/pages/common.js index 792a3586d3ef..7d779561319d 100644 --- a/test/support/pages/common.js +++ b/test/support/pages/common.js @@ -52,6 +52,10 @@ export default (function () { return getUrl.baseUrl(config.servers.kibana); }, + getEsHostPort: function getHostPort() { + return getUrl.baseUrl(config.servers.elasticsearch); + }, + navigateToApp: function (appName, testStatusPage) { var self = this; // navUrl includes user:password@ for use with Shield diff --git a/test/support/pages/console_page.js b/test/support/pages/console_page.js new file mode 100644 index 000000000000..f1fce7bccee6 --- /dev/null +++ b/test/support/pages/console_page.js @@ -0,0 +1,69 @@ +import { remote, defaultFindTimeout } from '../'; + +// in test/support/pages/shield_page.js +export default (function (require) { + // the page object is created as a constructor + // so we can provide the remote Command object + // at runtime + var thisTime; + + function ConsolePage() { + this.remote = remote; + thisTime = this.remote.setFindTimeout(defaultFindTimeout); + } + + ConsolePage.prototype = { + constructor: ConsolePage, + + + getServer: function getServer() { + return thisTime + .findByCssSelector('#kibana-body > div.content > div > div') + .getVisibleText(); + }, + + setServer: function setServer(server) { + return thisTime + .findByCssSelector('input[aria-label="Server Name"]') + .clearValue() + .type(server); + }, + + getRequest: function getRequest() { + return thisTime + .findAllByCssSelector('div.ace_line_group') + .then(function (editorData) { + + function getEditorData(line) { + return line.getVisibleText(); + } + + var getEditorDataPromises = editorData.map(getEditorData); + return Promise.all(getEditorDataPromises); + }); + }, + + getResponse: function getResponse() { + return thisTime + .findByCssSelector('#output > div.ace_scroller > div') + .getVisibleText(); + }, + + clickPlay: function clickPlay() { + return thisTime + .findByCssSelector('#editor_actions > span.ng-scope > a > i') + .click(); + }, + + collapseHelp: function collapseHelp() { + return thisTime + .findByCssSelector('div.config-close.remove > i') + .click(); + + } + + + }; + + return ConsolePage; +}()); From 203c7adadc7da9d5b17f9401bb73183519df0ff6 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Thu, 5 May 2016 10:35:07 -0500 Subject: [PATCH 10/11] Re-applied PR 6267 to master to fix Windows/cygwin build --- tasks/build/archives.js | 8 ++++---- tasks/build/shasums.js | 4 +++- tasks/config/run.js | 3 ++- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tasks/build/archives.js b/tasks/build/archives.js index 2639ab86e28f..ef50854e0d62 100644 --- a/tasks/build/archives.js +++ b/tasks/build/archives.js @@ -1,6 +1,6 @@ module.exports = function createPackages(grunt) { let { config } = grunt; - let { resolve } = require('path'); + let { resolve, relative } = require('path'); let { execFile } = require('child_process'); let { all, fromNode } = require('bluebird'); @@ -13,13 +13,13 @@ module.exports = function createPackages(grunt) { let archives = async (platform) => { // kibana.tar.gz - await exec('tar', ['-zchf', platform.tarPath, platform.buildName]); + await exec('tar', ['-zchf', relative(buildPath, platform.tarPath), platform.buildName]); // kibana.zip if (/windows/.test(platform.name)) { - await exec('zip', ['-rq', '-ll', platform.zipPath, platform.buildName]); + await exec('zip', ['-rq', '-ll', relative(buildPath, platform.zipPath), platform.buildName]); } else { - await exec('zip', ['-rq', platform.zipPath, platform.buildName]); + await exec('zip', ['-rq', relative(buildPath, platform.zipPath), platform.buildName]); } }; diff --git a/tasks/build/shasums.js b/tasks/build/shasums.js index c5dcedeba8f2..84f68eb40fdb 100644 --- a/tasks/build/shasums.js +++ b/tasks/build/shasums.js @@ -1,6 +1,8 @@ var { promisify } = require('bluebird'); var readdir = promisify(require('fs').readdir); var exec = promisify(require('child_process').exec); +var platform = require('os').platform(); +var cmd = /^win/.test(platform) ? 'sha1sum ' : 'shasum '; module.exports = function (grunt) { grunt.registerTask('_build:shasums', function () { @@ -11,7 +13,7 @@ module.exports = function (grunt) { // only sha the archives if (!archive.match(/\.zip$|\.tar.gz$/)) return; - return exec('shasum ' + archive + ' > ' + archive + '.sha1.txt', { + return exec(cmd + archive + ' > ' + archive + '.sha1.txt', { cwd: targetDir }); }) diff --git a/tasks/config/run.js b/tasks/config/run.js index e98bfe894e72..c2df1422f3b8 100644 --- a/tasks/config/run.js +++ b/tasks/config/run.js @@ -4,6 +4,7 @@ module.exports = function (grunt) { let {resolve} = require('path'); let root = p => resolve(__dirname, '../../', p); let binScript = /^win/.test(platform) ? '.\\bin\\kibana.bat' : './bin/kibana'; + let buildScript = /^win/.test(platform) ? '.\\build\\kibana\\bin\\kibana.bat' : './build/kibana/bin/kibana'; let uiConfig = require(root('test/server_config')); const stdDevArgs = [ @@ -150,7 +151,7 @@ module.exports = function (grunt) { ready: /Optimization .+ complete/, quiet: true }, - cmd: './build/kibana/bin/kibana', + cmd: buildScript, args: [ '--env.name=production', '--logging.json=false', From 82b06cd464b2e37d30c980614dcf5a18300eaff5 Mon Sep 17 00:00:00 2001 From: LeeDr Date: Thu, 5 May 2016 10:46:13 -0500 Subject: [PATCH 11/11] Minor update to CONTRIBUTING.md for required Cygwin packages on Windows. --- CONTRIBUTING.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 1511d6b60b77..59c1f9542ebd 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,7 +55,7 @@ Please make sure you have signed the [Contributor License Agreement](http://www. npm run elasticsearch ``` -- Start the development server. _On Windows, you'll need you use Git Bash, Cygwin, or a similar shell that exposes the `sh` command._ +- Start the development server. _On Windows, you'll need you use Git Bash, Cygwin, or a similar shell that exposes the `sh` command. And to successfully build you'll need Cygwin optional packages zip, tar, and shasum._ ```sh npm start