mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Merge branch 'master' of github.com:elastic/kibana into renameAllFiles
This commit is contained in:
commit
d3c8003430
11 changed files with 105 additions and 54 deletions
|
@ -185,7 +185,7 @@ To run the functional UI tests use the following commands
|
|||
|
||||
#### Running tests locally with your existing (and already running) ElasticSearch, Kibana, and Selenium Server:
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
Once you've got the services running, execute the following:
|
||||
|
||||
|
@ -196,7 +196,7 @@ npm run test:ui:runner
|
|||
#### General notes:
|
||||
|
||||
- Using Page Objects pattern (https://theintern.github.io/intern/#writing-functional-test)
|
||||
- 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.
|
||||
- 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.
|
||||
- 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).
|
||||
- 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.
|
||||
|
||||
|
|
|
@ -586,7 +586,7 @@ Use slashes for both single line and multi line comments. Try to write
|
|||
comments that explain higher level mechanisms or clarify difficult
|
||||
segments of your code. **Don't use comments to restate trivial things**.
|
||||
|
||||
***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 `*/`.
|
||||
***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 `*/`.
|
||||
|
||||
*Right:*
|
||||
|
||||
|
@ -656,7 +656,7 @@ function ClassName() {
|
|||
var ClassName = function () {};
|
||||
```
|
||||
|
||||
### Inhertiance should be done with a utility
|
||||
### Inheritance should be done with a utility
|
||||
|
||||
While you can do it with pure JS, a utility will remove a lot of boilerplate, and be more readable and functional.
|
||||
|
||||
|
@ -685,7 +685,7 @@ Square.prototype = Object.create(Shape);
|
|||
|
||||
### Keep Constructors Small
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
Try to follow the [Write small functions](#write-small-functions) rule here too.
|
||||
|
||||
|
@ -775,7 +775,7 @@ Several already exist, and can be found in `src/kibana/utils/_mixins.js`
|
|||
|
||||
## Filenames
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
*Right:*
|
||||
- `src/kibana/index_patterns/index_pattern.js`
|
||||
|
@ -858,7 +858,7 @@ app.service('CustomService', function(Promise, otherDeps) {
|
|||
|
||||
### Routes
|
||||
|
||||
Angular routes are defined using a custom require modules named `routes` that remove much of the required boilerplate.
|
||||
Angular routes are defined using a custom require module named `routes` that remove much of the required boilerplate.
|
||||
|
||||
```js
|
||||
require('ui/routes')
|
||||
|
@ -871,7 +871,7 @@ require('ui/routes')
|
|||
|
||||
## Multiple attribute values
|
||||
|
||||
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.
|
||||
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.
|
||||
|
||||
```
|
||||
<ul
|
||||
|
|
|
@ -101,6 +101,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",
|
||||
|
@ -150,7 +151,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",
|
||||
|
|
|
@ -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';
|
||||
|
|
|
@ -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';
|
||||
|
||||
|
|
|
@ -61,7 +61,11 @@ function initServerSettings(opts, extraCliOptions) {
|
|||
opts.pluginDir
|
||||
)));
|
||||
|
||||
set('plugins.paths', [].concat(opts.pluginPath || []));
|
||||
set('plugins.paths', _.compact([].concat(
|
||||
get('plugins.paths'),
|
||||
opts.pluginPath
|
||||
)));
|
||||
|
||||
merge(extraCliOptions);
|
||||
|
||||
return settings;
|
||||
|
|
|
@ -3,29 +3,27 @@ import fromRoot from '../../utils/from_root';
|
|||
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))
|
||||
|
|
|
@ -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,35 @@ 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');
|
||||
|
||||
const testGlobs = [
|
||||
'src/ui/public/**/__tests__/**/*.js',
|
||||
];
|
||||
if (testingPluginId) {
|
||||
const plugin = plugins.byId[testingPluginId];
|
||||
if (!plugin) throw new Error('Invalid testingPluginId :: unknown plugin ' + testingPluginId);
|
||||
|
||||
for (const plugin of plugins) {
|
||||
testGlobs.push(`${plugin.publicDir}/**/__tests__/**/*.js`);
|
||||
// add the modules from all of this plugins apps
|
||||
for (let app of plugin.apps) {
|
||||
modules = union(modules, app.getModules());
|
||||
}
|
||||
|
||||
testGlobs.push(
|
||||
'!src/ui/public/**/__tests__/**/*',
|
||||
`${plugin.publicDir}/**/__tests__/**/*.js`
|
||||
);
|
||||
} else {
|
||||
|
||||
// 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')) {
|
||||
|
|
|
@ -8,6 +8,42 @@ const defaultConfigSchema = Joi.object({
|
|||
enabled: Joi.boolean().default(true)
|
||||
}).default();
|
||||
|
||||
/**
|
||||
* The server plugin class, used to extend the server
|
||||
* and add custom behavior. A "scoped" plugin class is
|
||||
* created by the PluginApi class and provided to plugin
|
||||
* providers that automatically binds all but the `opts`
|
||||
* arguments.
|
||||
*
|
||||
* @class Plugin
|
||||
* @param {KbnServer} kbnServer - the KbnServer this plugin
|
||||
* belongs to.
|
||||
* @param {String} path - the path from which the plugin hails
|
||||
* @param {Object} pkg - the value of package.json for the plugin
|
||||
* @param {Objects} opts - the options for this plugin
|
||||
* @param {String} [opts.id=pkg.name] - the id for this plugin.
|
||||
* @param {Object} [opts.uiExports] - a mapping of UiExport types
|
||||
* to UI modules or metadata about
|
||||
* the UI module
|
||||
* @param {Array} [opts.require] - the other plugins that this plugin
|
||||
* requires. These plugins must exist and
|
||||
* be enabled for this plugin to function.
|
||||
* The require'd plugins will also be
|
||||
* initialized first, in order to make sure
|
||||
* that dependencies provided by these plugins
|
||||
* are available
|
||||
* @param {String} [opts.version=pkg.version] - the version of this plugin
|
||||
* @param {Function} [opts.init] - A function that will be called to initialize
|
||||
* this plugin at the appropriate time.
|
||||
* @param {Function} [opts.config] - A function that produces a configuration
|
||||
* schema using Joi, which is passed as its
|
||||
* first argument.
|
||||
* @param {String|False} [opts.publicDir=path + '/public']
|
||||
* - the public directory for this plugin. The final directory must
|
||||
* have the name "public", though it can be located somewhere besides
|
||||
* the root of the plugin. Set this to false to disable exposure of a
|
||||
* public directory
|
||||
*/
|
||||
module.exports = class Plugin {
|
||||
constructor(kbnServer, path, pkg, opts) {
|
||||
this.kbnServer = kbnServer;
|
||||
|
@ -18,7 +54,6 @@ module.exports = class Plugin {
|
|||
this.uiExportsSpecs = opts.uiExports || {};
|
||||
this.requiredIds = opts.require || [];
|
||||
this.version = opts.version || pkg.version;
|
||||
this.externalCondition = opts.initCondition || _.constant(true);
|
||||
this.externalInit = opts.init || _.noop;
|
||||
this.getConfigSchema = opts.config || _.noop;
|
||||
this.init = _.once(this.init);
|
||||
|
|
|
@ -15,25 +15,25 @@ module.directive('fieldName', function ($compile, $rootScope, $filter) {
|
|||
var typeIcon = function (fieldType) {
|
||||
switch (fieldType) {
|
||||
case 'source':
|
||||
return '<i class="fa fa-file-text-o "></i>';
|
||||
return '<i title="source" class="fa fa-file-text-o "></i>';
|
||||
case 'string':
|
||||
return '<i><strong>t</strong></i>';
|
||||
return '<i title="string"><strong>t</strong></i>';
|
||||
case 'murmur3':
|
||||
return '<i><strong>h</strong></i>';
|
||||
return '<i title="murmur3"><strong>h</strong></i>';
|
||||
case 'number':
|
||||
return '<i><strong>#</strong></i>';
|
||||
return '<i title="number"><strong>#</strong></i>';
|
||||
case 'date':
|
||||
return '<i class="fa fa-clock-o"></i>';
|
||||
return '<i title="date" class="fa fa-clock-o"></i>';
|
||||
case 'ip':
|
||||
return '<i class="fa fa-laptop"></i>';
|
||||
return '<i title="ip" class="fa fa-laptop"></i>';
|
||||
case 'geo_point':
|
||||
return '<i class="fa fa-globe"></i>';
|
||||
return '<i title="geo_point" class="fa fa-globe"></i>';
|
||||
case 'boolean':
|
||||
return '<i class="fa fa-adjust"></i>';
|
||||
return '<i title="boolean" class="fa fa-adjust"></i>';
|
||||
case 'conflict':
|
||||
return '<i class="fa fa-warning"></i>';
|
||||
return '<i title="conflict" class="fa fa-warning"></i>';
|
||||
default:
|
||||
return '<i><strong>?</strong></i>';
|
||||
return '<i title="unknown"><strong>?</strong></i>';
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue