Skip to content

Commit d3c8003

Browse files
committed
Merge branch 'master' of github.com:elastic/kibana into renameAllFiles
2 parents 2422a98 + c7e08ea commit d3c8003

File tree

11 files changed

+105
-54
lines changed

11 files changed

+105
-54
lines changed

CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ To run the functional UI tests use the following commands
185185

186186
#### Running tests locally with your existing (and already running) ElasticSearch, Kibana, and Selenium Server:
187187

188-
Set your es and kibana ports in `test/intern.js` to 9220 and 5620, respecitively. You can configure your Selenium server to run the tests on Chrome,IE, or other browsers here.
188+
Set your es and kibana ports in `test/intern.js` to 9220 and 5620, respectively. You can configure your Selenium server to run the tests on Chrome,IE, or other browsers here.
189189

190190
Once you've got the services running, execute the following:
191191

@@ -196,7 +196,7 @@ npm run test:ui:runner
196196
#### General notes:
197197

198198
- Using Page Objects pattern (https://theintern.github.io/intern/#writing-functional-test)
199-
- At least the initial tests for the Settings, Discover, and Visualize tabs all depend on a very specific set of logstash-type data (generated with makelogs). Since that is a static set of data, all the Discover and Visualize tests use a specific Absolute time range. This gaurantees the same results each run.
199+
- At least the initial tests for the Settings, Discover, and Visualize tabs all depend on a very specific set of logstash-type data (generated with makelogs). Since that is a static set of data, all the Discover and Visualize tests use a specific Absolute time range. This guarantees the same results each run.
200200
- These tests have been developed and tested with Chrome and Firefox browser. In theory, they should work on all browsers (that's the benefit of Intern using Leadfoot).
201201
- These tests should also work with an external testing service like https://saucelabs.com/ or https://www.browserstack.com/ but that has not been tested.
202202

STYLEGUIDE.md

+6-6
Original file line numberDiff line numberDiff line change
@@ -586,7 +586,7 @@ Use slashes for both single line and multi line comments. Try to write
586586
comments that explain higher level mechanisms or clarify difficult
587587
segments of your code. **Don't use comments to restate trivial things**.
588588

589-
***Exception:*** Comment blocks describing a function and it's arguments (docblock) should start with `/**`, contain a single `*` at the begining of each line, and end with `*/`.
589+
***Exception:*** Comment blocks describing a function and its arguments (docblock) should start with `/**`, contain a single `*` at the beginning of each line, and end with `*/`.
590590

591591
*Right:*
592592

@@ -656,7 +656,7 @@ function ClassName() {
656656
var ClassName = function () {};
657657
```
658658

659-
### Inhertiance should be done with a utility
659+
### Inheritance should be done with a utility
660660

661661
While you can do it with pure JS, a utility will remove a lot of boilerplate, and be more readable and functional.
662662

@@ -685,7 +685,7 @@ Square.prototype = Object.create(Shape);
685685

686686
### Keep Constructors Small
687687

688-
It is often the case that there are properties that can't be defined on the prototype, or work that needs to be done to completely create an object (like call it's Super class). This is all that should be done within constructors.
688+
It is often the case that there are properties that can't be defined on the prototype, or work that needs to be done to completely create an object (like call its Super class). This is all that should be done within constructors.
689689

690690
Try to follow the [Write small functions](#write-small-functions) rule here too.
691691

@@ -775,7 +775,7 @@ Several already exist, and can be found in `src/kibana/utils/_mixins.js`
775775

776776
## Filenames
777777

778-
All filenames should use `snake_case` and *can* start with an underscore if the module is not intended to be used outside of it's containing module.
778+
All filenames should use `snake_case` and *can* start with an underscore if the module is not intended to be used outside of its containing module.
779779

780780
*Right:*
781781
- `src/kibana/index_patterns/index_pattern.js`
@@ -858,7 +858,7 @@ app.service('CustomService', function(Promise, otherDeps) {
858858

859859
### Routes
860860

861-
Angular routes are defined using a custom require modules named `routes` that remove much of the required boilerplate.
861+
Angular routes are defined using a custom require module named `routes` that remove much of the required boilerplate.
862862

863863
```js
864864
require('ui/routes')
@@ -871,7 +871,7 @@ require('ui/routes')
871871

872872
## Multiple attribute values
873873

874-
When a node has multiple attributes that would cause it to exceed the line character limit, each attribute including the first should be on its own line with a single indent. Also, when a node that is styled in this way has child nodes, there should be a blank line between the openening parent tag and the first child tag.
874+
When a node has multiple attributes that would cause it to exceed the line character limit, each attribute including the first should be on its own line with a single indent. Also, when a node that is styled in this way has child nodes, there should be a blank line between the opening parent tag and the first child tag.
875875

876876
```
877877
<ul

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@
101101
"extract-text-webpack-plugin": "0.8.2",
102102
"file-loader": "0.8.4",
103103
"font-awesome": "4.4.0",
104+
"glob-all": "3.0.1",
104105
"good": "6.3.0",
105106
"good-squeeze": "2.1.0",
106107
"gridster": "0.5.6",
@@ -150,7 +151,6 @@
150151
"eslint-plugin-mocha": "1.1.0",
151152
"expect.js": "0.3.1",
152153
"faker": "1.1.0",
153-
"glob": "4.5.3",
154154
"grunt": "0.4.5",
155155
"grunt-babel": "5.0.1",
156156
"grunt-cli": "0.1.13",

src/cli/plugin/__tests__/plugin_downloader.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import expect from 'expect.js';
22
import sinon from 'sinon';
33
import nock from 'nock';
4-
import glob from 'glob';
4+
import glob from 'glob-all';
55
import rimraf from 'rimraf';
66
import mkdirp from 'mkdirp';
77
import pluginLogger from '../plugin_logger';

src/cli/plugin/__tests__/plugin_extractor.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import expect from 'expect.js';
22
import sinon from 'sinon';
3-
import glob from 'glob';
3+
import glob from 'glob-all';
44
import rimraf from 'rimraf';
55
import mkdirp from 'mkdirp';
66

src/cli/serve/serve.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ function initServerSettings(opts, extraCliOptions) {
6161
opts.pluginDir
6262
)));
6363

64-
set('plugins.paths', [].concat(opts.pluginPath || []));
64+
set('plugins.paths', _.compact([].concat(
65+
get('plugins.paths'),
66+
opts.pluginPath
67+
)));
68+
6569
merge(extraCliOptions);
6670

6771
return settings;

src/plugins/tests_bundle/find_source_files.js

+15-17
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,27 @@ import fromRoot from '../../utils/from_root';
33
import { chain, memoize } from 'lodash';
44
import { resolve } from 'path';
55
import { map, fromNode } from 'bluebird';
6-
import { Glob } from 'glob';
6+
import glob from 'glob-all';
77

88
let findSourceFiles = async (patterns, cwd = fromRoot('.')) => {
99
patterns = [].concat(patterns || []);
1010

11-
let matcheses = await map(patterns, async pattern => {
12-
return await fromNode(cb => {
13-
let g = new Glob(pattern, {
14-
cwd: cwd,
15-
ignore: [
16-
'node_modules/**/*',
17-
'bower_components/**/*',
18-
'**/_*.js'
19-
],
20-
symlinks: findSourceFiles.symlinks,
21-
statCache: findSourceFiles.statCache,
22-
realpathCache: findSourceFiles.realpathCache,
23-
cache: findSourceFiles.cache
24-
}, cb);
25-
});
11+
const matches = await fromNode(cb => {
12+
glob(patterns, {
13+
cwd: cwd,
14+
ignore: [
15+
'node_modules/**/*',
16+
'bower_components/**/*',
17+
'**/_*.js'
18+
],
19+
symlinks: findSourceFiles.symlinks,
20+
statCache: findSourceFiles.statCache,
21+
realpathCache: findSourceFiles.realpathCache,
22+
cache: findSourceFiles.cache
23+
}, cb);
2624
});
2725

28-
return chain(matcheses)
26+
return chain(matches)
2927
.flatten()
3028
.uniq()
3129
.map(match => resolve(cwd, match))

src/plugins/tests_bundle/index.js

+26-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@ module.exports = (kibana) => {
99
config: (Joi) => {
1010
return Joi.object({
1111
enabled: Joi.boolean().default(true),
12-
instrument: Joi.boolean().default(false)
12+
instrument: Joi.boolean().default(false),
13+
pluginId: Joi.string()
1314
}).default();
1415
},
1516

@@ -18,21 +19,35 @@ module.exports = (kibana) => {
1819
let modules = [];
1920
let config = kibana.config;
2021

21-
// add the modules from all of the apps
22-
for (let app of apps) {
23-
modules = union(modules, app.getModules());
24-
}
22+
const testGlobs = ['src/ui/public/**/*.js'];
23+
const testingPluginId = config.get('testsBundle.pluginId');
24+
25+
if (testingPluginId) {
26+
const plugin = plugins.byId[testingPluginId];
27+
if (!plugin) throw new Error('Invalid testingPluginId :: unknown plugin ' + testingPluginId);
28+
29+
// add the modules from all of this plugins apps
30+
for (let app of plugin.apps) {
31+
modules = union(modules, app.getModules());
32+
}
2533

26-
const testGlobs = [
27-
'src/ui/public/**/__tests__/**/*.js',
28-
];
34+
testGlobs.push(
35+
'!src/ui/public/**/__tests__/**/*',
36+
`${plugin.publicDir}/**/__tests__/**/*.js`
37+
);
38+
} else {
2939

30-
for (const plugin of plugins) {
31-
testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`);
40+
// add the modules from all of the apps
41+
for (let app of apps) {
42+
modules = union(modules, app.getModules());
43+
}
44+
45+
for (const plugin of plugins) {
46+
testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`);
47+
}
3248
}
3349

3450
const testFiles = await findSourceFiles(testGlobs);
35-
3651
for (let f of testFiles) modules.push(f);
3752

3853
if (config.get('testsBundle.instrument')) {

src/server/plugins/plugin.js

+36-1
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,42 @@ const defaultConfigSchema = Joi.object({
88
enabled: Joi.boolean().default(true)
99
}).default();
1010

11+
/**
12+
* The server plugin class, used to extend the server
13+
* and add custom behavior. A "scoped" plugin class is
14+
* created by the PluginApi class and provided to plugin
15+
* providers that automatically binds all but the `opts`
16+
* arguments.
17+
*
18+
* @class Plugin
19+
* @param {KbnServer} kbnServer - the KbnServer this plugin
20+
* belongs to.
21+
* @param {String} path - the path from which the plugin hails
22+
* @param {Object} pkg - the value of package.json for the plugin
23+
* @param {Objects} opts - the options for this plugin
24+
* @param {String} [opts.id=pkg.name] - the id for this plugin.
25+
* @param {Object} [opts.uiExports] - a mapping of UiExport types
26+
* to UI modules or metadata about
27+
* the UI module
28+
* @param {Array} [opts.require] - the other plugins that this plugin
29+
* requires. These plugins must exist and
30+
* be enabled for this plugin to function.
31+
* The require'd plugins will also be
32+
* initialized first, in order to make sure
33+
* that dependencies provided by these plugins
34+
* are available
35+
* @param {String} [opts.version=pkg.version] - the version of this plugin
36+
* @param {Function} [opts.init] - A function that will be called to initialize
37+
* this plugin at the appropriate time.
38+
* @param {Function} [opts.config] - A function that produces a configuration
39+
* schema using Joi, which is passed as its
40+
* first argument.
41+
* @param {String|False} [opts.publicDir=path + '/public']
42+
* - the public directory for this plugin. The final directory must
43+
* have the name "public", though it can be located somewhere besides
44+
* the root of the plugin. Set this to false to disable exposure of a
45+
* public directory
46+
*/
1147
module.exports = class Plugin {
1248
constructor(kbnServer, path, pkg, opts) {
1349
this.kbnServer = kbnServer;
@@ -18,7 +54,6 @@ module.exports = class Plugin {
1854
this.uiExportsSpecs = opts.uiExports || {};
1955
this.requiredIds = opts.require || [];
2056
this.version = opts.version || pkg.version;
21-
this.externalCondition = opts.initCondition || _.constant(true);
2257
this.externalInit = opts.init || _.noop;
2358
this.getConfigSchema = opts.config || _.noop;
2459
this.init = _.once(this.init);

src/ui/public/directives/field_name.js

+10-10
Original file line numberDiff line numberDiff line change
@@ -15,25 +15,25 @@ module.directive('fieldName', function ($compile, $rootScope, $filter) {
1515
var typeIcon = function (fieldType) {
1616
switch (fieldType) {
1717
case 'source':
18-
return '<i class="fa fa-file-text-o "></i>';
18+
return '<i title="source" class="fa fa-file-text-o "></i>';
1919
case 'string':
20-
return '<i><strong>t</strong></i>';
20+
return '<i title="string"><strong>t</strong></i>';
2121
case 'murmur3':
22-
return '<i><strong>h</strong></i>';
22+
return '<i title="murmur3"><strong>h</strong></i>';
2323
case 'number':
24-
return '<i><strong>#</strong></i>';
24+
return '<i title="number"><strong>#</strong></i>';
2525
case 'date':
26-
return '<i class="fa fa-clock-o"></i>';
26+
return '<i title="date" class="fa fa-clock-o"></i>';
2727
case 'ip':
28-
return '<i class="fa fa-laptop"></i>';
28+
return '<i title="ip" class="fa fa-laptop"></i>';
2929
case 'geo_point':
30-
return '<i class="fa fa-globe"></i>';
30+
return '<i title="geo_point" class="fa fa-globe"></i>';
3131
case 'boolean':
32-
return '<i class="fa fa-adjust"></i>';
32+
return '<i title="boolean" class="fa fa-adjust"></i>';
3333
case 'conflict':
34-
return '<i class="fa fa-warning"></i>';
34+
return '<i title="conflict" class="fa fa-warning"></i>';
3535
default:
36-
return '<i><strong>?</strong></i>';
36+
return '<i title="unknown"><strong>?</strong></i>';
3737
}
3838
};
3939

tasks/config/run.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@ module.exports = function (grunt) {
1818
];
1919

2020
const kbnServerFlags = grunt.option.flags().reduce(function (flags, flag) {
21-
const matches = flag.match(/^--kbnServer(\.\w+)+=/);
22-
if (matches) {
23-
flags.push(flag.replace(/^--kbnServer\./, '--'));
21+
if (flag.startsWith('--kbnServer.')) {
22+
flags.push(`--${flag.slice(12)}`);
2423
}
2524

2625
return flags;

0 commit comments

Comments
 (0)