From 247ad415836068c74120bf301b79e26499028258 Mon Sep 17 00:00:00 2001 From: spalger Date: Mon, 11 Jan 2016 03:04:12 -0700 Subject: [PATCH 01/10] [npm] added "clean" script "npm run clean" will now find all excess files, confirm they should be deleted, and then delete them. To exclude a file pass it as the --ignore argument --- package.json | 3 ++- tasks/scrub.js | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+), 1 deletion(-) create mode 100644 tasks/scrub.js diff --git a/package.json b/package.json index 8812d3c086aff..35541613cdef4 100644 --- a/package.json +++ b/package.json @@ -56,7 +56,8 @@ "lint": "grunt eslint:source", "lintroller": "grunt eslint:fixSource", "mocha": "mocha --compilers js:babel/register", - "mocha:debug": "mocha --debug-brk --compilers js:babel/register" + "mocha:debug": "mocha --debug-brk --compilers js:babel/register", + "clean": "grunt scrub" }, "repository": { "type": "git", diff --git a/tasks/scrub.js b/tasks/scrub.js new file mode 100644 index 0000000000000..3670a95292b80 --- /dev/null +++ b/tasks/scrub.js @@ -0,0 +1,39 @@ +import { bgRed, white } from 'ansicolors'; +import { execSync } from 'child_process'; +import { createInterface } from 'readline'; + +export default function (grunt) { + + grunt.registerTask('scrub', function () { + + const cmd = 'git clean -fdx'; + const ignores = [ + '.aws-config.json', + 'config/kibana.dev.yml' + ] + .concat(String(grunt.option('ignore') || '').split(',')) + .map(f => `-e "${f.split('"').join('\\"')}"`) + .reduce((all, arg) => `${all} ${arg}`, ''); + + const stdio = 'inherit'; + execSync(`${cmd} -n ${ignores}`, { stdio }); + + const rl = createInterface({ + input: process.stdin, + output: process.stdout + }); + const danger = bgRed(white('DANGER')); + + rl.on('close', this.async()); + rl.question(`\n${danger} Do you really want to delete all of the above files?, [N/y] `, function (resp) { + var yes = resp.toLowerCase().trim()[0] === 'y'; + rl.close(); + + if (yes) { + execSync(`${cmd} ${ignores}`, { stdio }); + } + }); + + }); + +} From 2722f42d30144f31670f152e5842f9d2114075f8 Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 12 Feb 2016 09:35:01 -0700 Subject: [PATCH 02/10] [grunt/run] support passing arbitrary commands to underlying kibana started via grunt-run --- tasks/config/run.js | 57 +++++++++++++++++++++++++++++---------------- 1 file changed, 37 insertions(+), 20 deletions(-) diff --git a/tasks/config/run.js b/tasks/config/run.js index aacd6a045378d..9b73dae035a8d 100644 --- a/tasks/config/run.js +++ b/tasks/config/run.js @@ -6,6 +6,26 @@ module.exports = function (grunt) { let binScript = /^win/.test(platform) ? '.\\bin\\kibana.bat' : './bin/kibana'; let uiConfig = require(root('test/serverConfig')); + const stdDevArgs = [ + '--env.name=development', + '--logging.json=false', + ]; + + const buildTestsArgs = [ + ...stdDevArgs, + '--plugins.initialize=false', + '--optimize.bundleFilter=tests', + ]; + + const kbnServerFlags = grunt.option.flags().reduce(function (flags, flag) { + const matches = flag.match(/^--kbnServer(\.\w+)+=/); + if (matches) { + flags.push(flag.replace(/^--kbnServer\./, '--')); + } + + return flags; + }, []); + return { testServer: { options: { @@ -16,11 +36,9 @@ module.exports = function (grunt) { }, cmd: binScript, args: [ + ...buildTestsArgs, '--server.port=5610', - '--env.name=development', - '--logging.json=false', - '--optimize.bundleFilter=tests', - '--plugins.initialize=false' + ...kbnServerFlags, ] }, @@ -33,11 +51,12 @@ module.exports = function (grunt) { }, cmd: binScript, args: [ - '--server.port=' + uiConfig.servers.kibana.port, - '--server.xsrf.disableProtection=true', + ...stdDevArgs, '--optimize.enabled=false', '--elasticsearch.url=' + format(uiConfig.servers.elasticsearch), - '--logging.json=false' + '--server.port=' + uiConfig.servers.kibana.port, + '--server.xsrf.disableProtection=true', + ...kbnServerFlags, ] }, @@ -50,10 +69,10 @@ module.exports = function (grunt) { }, cmd: binScript, args: [ + ...stdDevArgs, '--server.port=' + uiConfig.servers.kibana.port, - '--env.name=development', '--elasticsearch.url=' + format(uiConfig.servers.elasticsearch), - '--logging.json=false' + ...kbnServerFlags, ] }, @@ -66,12 +85,10 @@ module.exports = function (grunt) { }, cmd: binScript, args: [ + ...buildTestsArgs, '--server.port=5610', - '--env.name=development', - '--logging.json=false', - '--optimize.bundleFilter=tests', - '--plugins.initialize=false', - '--testsBundle.instrument=true' + '--testsBundle.instrument=true', + ...kbnServerFlags, ] }, @@ -84,6 +101,7 @@ module.exports = function (grunt) { }, cmd: binScript, args: [ + ...buildTestsArgs, '--dev', '--no-watch', '--no-ssl', @@ -91,9 +109,7 @@ module.exports = function (grunt) { '--server.port=5610', '--optimize.lazyPort=5611', '--optimize.lazyPrebuild=true', - '--logging.json=false', - '--optimize.bundleFilter=tests', - '--plugins.initialize=false' + ...kbnServerFlags, ] }, @@ -109,7 +125,7 @@ module.exports = function (grunt) { '-jar', 'selenium/selenium-server-standalone-2.48.2.jar', '-port', - uiConfig.servers.webdriver.port + uiConfig.servers.webdriver.port, ] }, @@ -125,7 +141,7 @@ module.exports = function (grunt) { '-jar', 'selenium/selenium-server-standalone-2.48.2.jar', '-port', - uiConfig.servers.webdriver.port + uiConfig.servers.webdriver.port, ] }, @@ -140,7 +156,8 @@ module.exports = function (grunt) { '--env.name=production', '--logging.json=false', '--plugins.initialize=false', - '--server.autoListen=false' + '--server.autoListen=false', + ...kbnServerFlags, ] } }; From 4561c829eaf1ad02e03cb71cad468a315e1d5c36 Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 11 Feb 2016 20:01:14 -0700 Subject: [PATCH 03/10] [glob] switch out glob for glob-all --- package.json | 2 +- src/cli/plugin/__tests__/plugin_downloader.js | 2 +- src/cli/plugin/__tests__/plugin_extractor.js | 2 +- src/plugins/testsBundle/findSourceFiles.js | 32 +++++++++---------- 4 files changed, 18 insertions(+), 20 deletions(-) diff --git a/package.json b/package.json index abd2e469816d3..844b77b357f37 100644 --- a/package.json +++ b/package.json @@ -100,6 +100,7 @@ "extract-text-webpack-plugin": "0.8.2", "file-loader": "0.8.4", "font-awesome": "4.4.0", + "glob-all": "3.0.1", "good": "6.3.0", "good-squeeze": "2.1.0", "gridster": "0.5.6", @@ -149,7 +150,6 @@ "eslint-plugin-mocha": "1.1.0", "expect.js": "0.3.1", "faker": "1.1.0", - "glob": "4.5.3", "grunt": "0.4.5", "grunt-babel": "5.0.1", "grunt-cli": "0.1.13", diff --git a/src/cli/plugin/__tests__/plugin_downloader.js b/src/cli/plugin/__tests__/plugin_downloader.js index dc9f386757324..5fd05dd21d3f5 100644 --- a/src/cli/plugin/__tests__/plugin_downloader.js +++ b/src/cli/plugin/__tests__/plugin_downloader.js @@ -1,7 +1,7 @@ import expect from 'expect.js'; import sinon from 'sinon'; import nock from 'nock'; -import glob from 'glob'; +import glob from 'glob-all'; import rimraf from 'rimraf'; import mkdirp from 'mkdirp'; import pluginLogger from '../plugin_logger'; diff --git a/src/cli/plugin/__tests__/plugin_extractor.js b/src/cli/plugin/__tests__/plugin_extractor.js index 2437c6adf335c..7bbb5b737a686 100644 --- a/src/cli/plugin/__tests__/plugin_extractor.js +++ b/src/cli/plugin/__tests__/plugin_extractor.js @@ -1,6 +1,6 @@ import expect from 'expect.js'; import sinon from 'sinon'; -import glob from 'glob'; +import glob from 'glob-all'; import rimraf from 'rimraf'; import mkdirp from 'mkdirp'; diff --git a/src/plugins/testsBundle/findSourceFiles.js b/src/plugins/testsBundle/findSourceFiles.js index c34d42daad62f..b9b3ac9205610 100644 --- a/src/plugins/testsBundle/findSourceFiles.js +++ b/src/plugins/testsBundle/findSourceFiles.js @@ -3,29 +3,27 @@ import fromRoot from '../../utils/fromRoot'; import { chain, memoize } from 'lodash'; import { resolve } from 'path'; import { map, fromNode } from 'bluebird'; -import { Glob } from 'glob'; +import glob from 'glob-all'; let findSourceFiles = async (patterns, cwd = fromRoot('.')) => { patterns = [].concat(patterns || []); - let matcheses = await map(patterns, async pattern => { - return await fromNode(cb => { - let g = new Glob(pattern, { - cwd: cwd, - ignore: [ - 'node_modules/**/*', - 'bower_components/**/*', - '**/_*.js' - ], - symlinks: findSourceFiles.symlinks, - statCache: findSourceFiles.statCache, - realpathCache: findSourceFiles.realpathCache, - cache: findSourceFiles.cache - }, cb); - }); + const matches = await fromNode(cb => { + glob(patterns, { + cwd: cwd, + ignore: [ + 'node_modules/**/*', + 'bower_components/**/*', + '**/_*.js' + ], + symlinks: findSourceFiles.symlinks, + statCache: findSourceFiles.statCache, + realpathCache: findSourceFiles.realpathCache, + cache: findSourceFiles.cache + }, cb); }); - return chain(matcheses) + return chain(matches) .flatten() .uniq() .map(match => resolve(cwd, match)) From c594b5d646f8eeba7ef7678a6070bd0f2d87e584 Mon Sep 17 00:00:00 2001 From: spalger Date: Thu, 11 Feb 2016 20:01:46 -0700 Subject: [PATCH 04/10] [plugins] support running just the tests for one plugin --- src/plugins/testsBundle/index.js | 36 ++++++++++++++++++++++---------- 1 file changed, 25 insertions(+), 11 deletions(-) diff --git a/src/plugins/testsBundle/index.js b/src/plugins/testsBundle/index.js index cdc33ba404e58..21fdd7c2e7fc0 100644 --- a/src/plugins/testsBundle/index.js +++ b/src/plugins/testsBundle/index.js @@ -9,7 +9,8 @@ module.exports = (kibana) => { config: (Joi) => { return Joi.object({ enabled: Joi.boolean().default(true), - instrument: Joi.boolean().default(false) + instrument: Joi.boolean().default(false), + pluginId: Joi.string() }).default(); }, @@ -18,21 +19,34 @@ module.exports = (kibana) => { let modules = []; let config = kibana.config; - // add the modules from all of the apps - for (let app of apps) { - modules = union(modules, app.getModules()); - } + const testGlobs = ['src/ui/public/**/*.js']; + const testingPluginId = config.get('testsBundle.pluginId'); + + if (testingPluginId) { + const plugin = plugins.byId[testingPluginId]; + + // add the modules from all of this plugins apps + for (let app of plugin.apps) { + modules = union(modules, app.getModules()); + } - const testGlobs = [ - 'src/ui/public/**/__tests__/**/*.js', - ]; + testGlobs.push( + '!src/ui/public/**/__tests__/**/*', + `${plugin.publicDir}/**/__tests__/**/*.js` + ); + } else { - for (const plugin of plugins) { - testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); + // add the modules from all of the apps + for (let app of apps) { + modules = union(modules, app.getModules()); + } + + for (const plugin of plugins) { + testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`); + } } const testFiles = await findSourceFiles(testGlobs); - for (let f of testFiles) modules.push(f); if (config.get('testsBundle.instrument')) { From 00204a3df2413b0c81df8eb5e6c3639d939361c6 Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 12 Feb 2016 12:56:50 -0700 Subject: [PATCH 05/10] [npm/clean] rename to sterilize --- package.json | 2 +- tasks/{scrub.js => sterilize.js} | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) rename tasks/{scrub.js => sterilize.js} (95%) diff --git a/package.json b/package.json index 402776cad706f..b54f47ff5a87e 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "lintroller": "grunt eslint:fixSource", "mocha": "mocha", "mocha:debug": "mocha --debug-brk", - "clean": "grunt scrub" + "sterilize": "grunt sterilize" }, "repository": { "type": "git", diff --git a/tasks/scrub.js b/tasks/sterilize.js similarity index 95% rename from tasks/scrub.js rename to tasks/sterilize.js index 3670a95292b80..11b827e5bbe62 100644 --- a/tasks/scrub.js +++ b/tasks/sterilize.js @@ -4,7 +4,7 @@ import { createInterface } from 'readline'; export default function (grunt) { - grunt.registerTask('scrub', function () { + grunt.registerTask('sterilize', function () { const cmd = 'git clean -fdx'; const ignores = [ From 53b35c4ad4fd2b870207922ed3dc6913e206102f Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 12 Feb 2016 16:00:54 -0700 Subject: [PATCH 06/10] [testBundles] throw intelligible error when the plugin is missing --- src/plugins/testsBundle/index.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/plugins/testsBundle/index.js b/src/plugins/testsBundle/index.js index 21fdd7c2e7fc0..cac0be6e064ca 100644 --- a/src/plugins/testsBundle/index.js +++ b/src/plugins/testsBundle/index.js @@ -24,6 +24,7 @@ module.exports = (kibana) => { if (testingPluginId) { const plugin = plugins.byId[testingPluginId]; + if (!plugin) throw new Error('Invalid testingPluginId :: unknown plugin ' + testingPluginId); // add the modules from all of this plugins apps for (let app of plugin.apps) { From 508d94540eda04ff499603a9245be3ce2291c16e Mon Sep 17 00:00:00 2001 From: spalger Date: Fri, 12 Feb 2016 16:01:46 -0700 Subject: [PATCH 07/10] [grunt/run] be more lenient with flag prefix parsing --- tasks/config/run.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/tasks/config/run.js b/tasks/config/run.js index 9b73dae035a8d..0d0be286c465c 100644 --- a/tasks/config/run.js +++ b/tasks/config/run.js @@ -18,9 +18,8 @@ module.exports = function (grunt) { ]; const kbnServerFlags = grunt.option.flags().reduce(function (flags, flag) { - const matches = flag.match(/^--kbnServer(\.\w+)+=/); - if (matches) { - flags.push(flag.replace(/^--kbnServer\./, '--')); + if (flag.startsWith('--kbnServer.')) { + flags.push(`--${flag.slice(12)}`); } return flags; From 629365f1a75e338798431ddcf6c33b7a036e586b Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Sat, 13 Feb 2016 15:08:51 -0700 Subject: [PATCH 08/10] Tighten up spacing, move drag handle, move spy toggle --- .../dashboard/components/panel/panel.html | 3 ++ .../public/dashboard/directives/grid.js | 5 ++- .../kibana/public/dashboard/styles/main.less | 10 ++---- src/plugins/metric_vis/public/metric_vis.less | 1 - src/ui/public/visualize/spy.html | 4 +-- src/ui/public/visualize/visualize.less | 34 ++++--------------- 6 files changed, 15 insertions(+), 42 deletions(-) diff --git a/src/plugins/kibana/public/dashboard/components/panel/panel.html b/src/plugins/kibana/public/dashboard/components/panel/panel.html index 2b99f20d608e2..6665034471980 100644 --- a/src/plugins/kibana/public/dashboard/components/panel/panel.html +++ b/src/plugins/kibana/public/dashboard/components/panel/panel.html @@ -7,6 +7,9 @@ + + + diff --git a/src/plugins/kibana/public/dashboard/directives/grid.js b/src/plugins/kibana/public/dashboard/directives/grid.js index 4c501aeeb2a75..4535bed48cada 100644 --- a/src/plugins/kibana/public/dashboard/directives/grid.js +++ b/src/plugins/kibana/public/dashboard/directives/grid.js @@ -27,7 +27,7 @@ app.directive('dashboardGrid', function ($compile, Notifier) { // number of columns to render const COLS = 12; // number of pixed between each column/row - const SPACER = 10; + const SPACER = 0; // pixels used by all of the spacers (gridster puts have a spacer on the ends) const spacerSize = SPACER * COLS; @@ -46,7 +46,7 @@ app.directive('dashboardGrid', function ($compile, Notifier) { stop: readGridsterChangeHandler }, draggable: { - handle: '.panel-heading, .panel-title', + handle: '.panel-move, .fa-arrows', stop: readGridsterChangeHandler } }).data('gridster'); @@ -232,4 +232,3 @@ app.directive('dashboardGrid', function ($compile, Notifier) { } }; }); - diff --git a/src/plugins/kibana/public/dashboard/styles/main.less b/src/plugins/kibana/public/dashboard/styles/main.less index af0d21d72852a..9b685625eb9fd 100644 --- a/src/plugins/kibana/public/dashboard/styles/main.less +++ b/src/plugins/kibana/public/dashboard/styles/main.less @@ -46,14 +46,8 @@ dashboard-grid { .visualize-show-spy { visibility: visible; } - .panel .panel-heading { - background-color: @kibanaGray6; - &:hover { - cursor: pointer; - } - .btn-group { - display: block !important; - } + .panel .panel-heading .btn-group { + display: block !important; } } diff --git a/src/plugins/metric_vis/public/metric_vis.less b/src/plugins/metric_vis/public/metric_vis.less index bc0b7244a5e34..88abea610948d 100644 --- a/src/plugins/metric_vis/public/metric_vis.less +++ b/src/plugins/metric_vis/public/metric_vis.less @@ -16,6 +16,5 @@ .metric-container { text-align: center; - padding: 1em; } } diff --git a/src/ui/public/visualize/spy.html b/src/ui/public/visualize/spy.html index b43429de52da3..6231df6045955 100644 --- a/src/ui/public/visualize/spy.html +++ b/src/ui/public/visualize/spy.html @@ -1,6 +1,6 @@
- +
@@ -21,4 +21,4 @@
- \ No newline at end of file + diff --git a/src/ui/public/visualize/visualize.less b/src/ui/public/visualize/visualize.less index 6879cf173d088..f8520f2f4cc22 100644 --- a/src/ui/public/visualize/visualize.less +++ b/src/ui/public/visualize/visualize.less @@ -59,6 +59,7 @@ ul.visualizations .media-body { visualize-spy { // this element should flex flex: 0 1 auto; + padding: 0px 0px 0px 15px; // it's children should also flex vertically flex-direction: column; @@ -77,34 +78,12 @@ visualize-spy { .visualize-show-spy { flex: 0 0 auto; - - border-top: 1px solid; - border-top-color: @visualize-show-spy-border; - margin-bottom: 3px; - &-tab { - margin: 0px auto; - margin-top: -1px; - border: 1px solid; - border-color: @visualize-show-spy-border; - border-top: 0px; - border-width: 0px 1px 1px 1px; - border-bottom-left-radius: @border-radius-base; - border-bottom-right-radius: @border-radius-base; - width: 50px; - background: @visualize-show-spy-bg; - text-align: center; - color: @visualize-show-spy-color; - - &:hover { - background-color: @visualize-show-spy-hover-bg; - color: @visualize-show-spy-hover-color; - } - } - - - i { - padding: 0 10px; + color: @kibanaGray4; + position: absolute; + z-index: 100; + left: 5px; + bottom: 0px; } } @@ -181,4 +160,3 @@ visualize-spy { white-space: pre-wrap; } } - From de0697c48a99bb9bdd47f95f6a3f83f4433a2f79 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Tue, 16 Feb 2016 10:57:51 -0700 Subject: [PATCH 09/10] Import all of lodash --- src/ui/ui_app.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/ui/ui_app.js b/src/ui/ui_app.js index bba6c79fbbd81..7091261a06058 100644 --- a/src/ui/ui_app.js +++ b/src/ui/ui_app.js @@ -1,4 +1,5 @@ import { chain, get, noop, once, pick } from 'lodash'; +import _ from 'lodash'; class UiApp { constructor(uiExports, spec) { From aa36e68d54fbbc23dada44033d9d16bd9dd82be8 Mon Sep 17 00:00:00 2001 From: Rashid Khan Date: Tue, 8 Mar 2016 09:19:24 -0700 Subject: [PATCH 10/10] Change cursor to move button --- src/plugins/kibana/public/dashboard/styles/main.less | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/kibana/public/dashboard/styles/main.less b/src/plugins/kibana/public/dashboard/styles/main.less index 9b685625eb9fd..38ebe07c2e849 100644 --- a/src/plugins/kibana/public/dashboard/styles/main.less +++ b/src/plugins/kibana/public/dashboard/styles/main.less @@ -114,6 +114,10 @@ dashboard-grid { } } + .panel-move:hover { + cursor: move; + } + a { color: @dashboard-panel-heading-link-color; border: none;