Merge pull request #4335 from spalger/apps/home

Apps/App Switcher
This commit is contained in:
Spencer 2015-07-29 17:00:16 -07:00
commit ba9e366fc4
1551 changed files with 48257 additions and 60634 deletions

View file

@ -1,3 +0,0 @@
{
"directory": "./src/kibana/bower_components"
}

6
.gitignore vendored
View file

@ -2,10 +2,8 @@
.DS_Store
.node_binaries
node_modules
bower_components
**/*.css
trash
build
bundles
target
.jruby
.idea
@ -13,4 +11,4 @@ target
*.log
esvm
.htpasswd
src/server/bin/plugins
installed_plugins

View file

@ -1,9 +1,11 @@
{
"esnext": true,
"maximumLineLength": {
"value": 140,
"allowComments": true
},
"requireCurlyBraces": [
"requireSemicolons": true,
"requireCurlyBraces": [
"for",
"do",
"try",

View file

@ -1,6 +1,21 @@
{
// for files at project root
"node": true,
"browser": true,
"mocha": true,
"predef": {
"inject": true,
"module": true,
"define": true,
"console": false,
"-event": true,
"-name": true,
"-Promise": true,
"-Worker": true,
"-status": true,
"-fetch": true
},
// shared with .jshintrc files for browser and node
"unused": false,
@ -23,5 +38,6 @@
"sub": true,
"-W084": true,
"scripturl": true,
"evil": true
"evil": true,
"esnext": true
}

View file

@ -1,14 +0,0 @@
{
"extends": "./.jshintrc",
"node": false,
"browser": true,
"predef": {
// require.js
"define": true,
"require": true,
"console": false,
"-event": true,
"-name": true
}
}

View file

@ -1,9 +0,0 @@
{
"extends": "./.jshintrc",
"node": true,
"globals": {
"Promise": true,
"status": true
}
}

View file

@ -1 +1 @@
0.10.x
iojs-v2.4

View file

@ -1,15 +1,17 @@
language: node_js
node_js: '0.12'
node_js: 'iojs-v2.4'
install: npm install
script: npm test
script: ./node_modules/.bin/grunt travis
sudo: false
cache:
directories:
- esvm
- node_modules
- src/kibana/bower_components
before_cache:
- rm -rf esvm/*/logs esvm/data_dir
- rm -rf esvm/*/logs esvm/data_dir
before_script:
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start
notifications:
email:
- rashid.khan@elastic.co

View file

@ -10,19 +10,6 @@ Please make sure you have signed the [Contributor License Agreement](http://www.
### Development Environment Setup
- Install node.js (we recommend using [nvm](https://github.com/creationix/nvm))
```sh
## follow directions at https://github.com/creationix/nvm, then
nvm install 0.10
```
- Install grunt and bower globally (as root if not using nvm)
```sh
npm install -g grunt-cli bower
```
- Clone the kibana repo and move into it
```sh
@ -30,16 +17,28 @@ Please make sure you have signed the [Contributor License Agreement](http://www.
cd kibana
```
- Install node and bower dependencies
- Install the version of node.js listed in the `.node-version` file (this is made easy with tools like [nvm](https://github.com/creationix/nvm) and [avn](https://github.com/wbyoung/avn))
```sh
npm install && bower install
nvm install "$(cat .node-version)"
```
- Install dependencies
```sh
npm install
```
- Start elasticsearch, you can use [esvm](https://github.com/simianhacker/esvm) to make that easier.
```sh
grunt esvm:dev:keepalive
```
- Start the development server.
```sh
grunt dev # use the "--with-es" flag to install & start elasticsearch too
./bin/kibana --dev
```
#### Linting
@ -65,7 +64,7 @@ Before running the tests you will need to install the projects dependencies as d
Once that is complete just run:
```sh
grunt test build
./node_modules/.bin/grunt test build
```
Distributable, built packages can be found in `target/` after the build completes.

View file

@ -1,28 +1,34 @@
module.exports = function (grunt) {
// set the config once before calling load-grunt-config
// and once durring so that we have access to it via
// and once during so that we have access to it via
// grunt.config.get() within the config files
var config = {
pkg: grunt.file.readJSON('package.json'),
root: __dirname,
src: __dirname + '/src', // unbuild version of build
build: __dirname + '/build', // copy of source, but optimized
app: __dirname + '/src/kibana', // source directory for the app
plugins: __dirname + '/src/kibana/plugins', // source directory for the app
server: __dirname + '/src/server', // source directory for the server
target: __dirname + '/target', // location of the compressed build targets
buildApp: __dirname + '/build/kibana', // build directory for the app
configFile: __dirname + '/src/server/config/kibana.yml',
src: __dirname + '/src',
build: __dirname + '/build', // temporary build directory
plugins: __dirname + '/src/plugins',
server: __dirname + '/src/server',
target: __dirname + '/target', // location of the compressed build targets
testUtilsDir: __dirname + '/src/testUtils',
configFile: __dirname + '/src/config/kibana.yml',
karmaBrowser: (function () {
switch (require('os').platform()) {
case 'win32':
return 'IE';
case 'darwin':
return 'Chrome';
default:
return 'Firefox';
}
}()),
nodeVersion: '0.10.35',
platforms: ['darwin-x64', 'linux-x64', 'linux-x86', 'windows'],
services: [ [ 'launchd', '10.9'], [ 'upstart', '1.5'], [ 'systemd', 'default'], [ 'sysv', 'lsb-3.1' ] ],
unitTestDir: __dirname + '/test/unit',
testUtilsDir: __dirname + '/test/utils',
bowerComponentsDir: __dirname + '/src/kibana/bower_components',
devPlugins: 'vis_debug_spy',
devPlugins: 'devMode',
meta: {
banner: '/*! <%= package.name %> - v<%= package.version %> - ' +
@ -34,44 +40,13 @@ module.exports = function (grunt) {
lintThese: [
'Gruntfile.js',
'<%= root %>/tasks/**/*.js',
'<%= src %>/kibana/*.js',
'<%= src %>/server/bin/*.js',
'<%= src %>/server/{config,lib,plugins}/**/*.js',
'<%= src %>/server/bin/{plugin,startup}/**/*.js',
'<%= src %>/kibana/{components,directives,factories,filters,plugins,registry,services,utils}/**/*.js',
'<%= unitTestDir %>/**/*.js',
'!<%= unitTestDir %>/specs/vislib/fixture/**/*'
],
lessFiles: [
'<%= src %>/kibana/components/*/*.less',
'<%= src %>/kibana/styles/main.less',
'<%= src %>/kibana/components/vislib/styles/main.less',
'<%= src %>/server/plugins/status/public/styles/main.less',
'<%= plugins %>/dashboard/styles/main.less',
'<%= plugins %>/discover/styles/main.less',
'<%= plugins %>/settings/styles/main.less',
'<%= plugins %>/visualize/styles/main.less',
'<%= plugins %>/visualize/styles/visualization.less',
'<%= plugins %>/visualize/styles/main.less',
'<%= plugins %>/table_vis/table_vis.less',
'<%= plugins %>/metric_vis/metric_vis.less',
'<%= plugins %>/markdown_vis/markdown_vis.less'
'<%= src %>/**/*.js',
'!<%= src %>/fixtures/**/*.js'
]
};
grunt.config.merge(config);
var dirname = require('path').dirname;
var indexFiles = grunt.file.expand({ cwd: 'src/kibana/plugins' }, [
'*/index.js',
'!' + config.devPlugins + '/index.js'
]);
var moduleIds = indexFiles.map(function (fileName) {
return 'plugins/' + dirname(fileName) + '/index';
});
config.bundled_plugin_module_ids = grunt.bundled_plugin_module_ids = moduleIds;
// load plugins
require('load-grunt-config')(grunt, {
configPath: __dirname + '/tasks/config',

View file

@ -812,7 +812,7 @@ Kibana is written in Angular, and uses several utility methods to make using Ang
Angular modules are defined using a custom require module named `module`. It is used as follows:
```js
var app = require('modules').get('app/namespace');
var app = require('ui/modules').get('app/namespace');
```
`app` above is a reference to an Angular module, and can be used to define controllers, providers and anything else used in Angular.
@ -849,7 +849,7 @@ app.service('CustomService', function(Promise, otherDeps) {
Angular routes are defined using a custom require modules named `routes` that remove much of the required boilerplate.
```js
require('routes')
require('ui/routes')
.when('/my/object/route/:id?', {
// angular route code goes here
});

12
src/server/bin/kibana.sh → bin/kibana Normal file → Executable file
View file

@ -13,9 +13,13 @@ while [ -h "$SCRIPT" ] ; do
fi
done
DIR=$(dirname "${SCRIPT}")/..
NODE=${DIR}/node/bin/node
SERVER=${DIR}/src/bin/kibana.js
DIR="$(dirname "${SCRIPT}")/.."
NODE="${DIR}/node/bin/node"
test -x "$NODE" || NODE=$(which node)
if [ ! -x "$NODE" ]; then
echo "unable to find usable node.js executable."
exit 1
fi
CONFIG_PATH="${DIR}/config/kibana.yml" NODE_ENV="production" exec "${NODE}" ${SERVER} ${@}
exec "${NODE}" "${DIR}/src/cli/cli" ${@}

25
bin/kibana.bat Normal file
View file

@ -0,0 +1,25 @@
@echo off
SETLOCAL
set SCRIPT_DIR=%~dp0
for %%I in ("%SCRIPT_DIR%..") do set DIR=%%~dpfI
set NODE=%DIR%\node\node.exe
for /f "delims=" %%i in ('WHERE node') do set SYS_NODE=%%i
If Not Exist "%NODE%" (
IF Exist "%SYS_NODE%" (
set NODE=%SYS_NODE%
) else (
Echo unable to find usable node.js executable.
Exit /B 1
)
)
TITLE Kibana Server
"%NODE%" "%DIR%\src\cli\cli" %*
:finally
ENDLOCAL

View file

@ -1,59 +0,0 @@
{
"name": "kibana",
"authors": [
"Spencer Alger <spencer@spenceralger.com>"
],
"description": "Browser based analytics and search interface to Logstash and other timestamped data sets stored in ElasticSearch",
"main": "src/index.html",
"keywords": [
"kibana",
"elasticsearch"
],
"license": "Apache 2.0",
"homepage": "http://www.elastic.co/products/kibana",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "1.2.28",
"angular-bindonce": "0.3.3",
"angular-bootstrap": "0.10.0",
"angular-elastic": "2.4.2",
"angular-mocks": "1.2.28",
"angular-nvd3": "https://github.com/krispo/angular-nvd3.git#1.0.0-beta",
"angular-route": "1.2.28",
"angular-ui-ace": "0.2.3",
"bluebird": "~2.9.27",
"bootstrap": "3.3.4",
"d3": "3.5.5",
"elasticsearch": "~5.0.0",
"Faker": "1.1.0",
"FileSaver": "babc6d9d8f",
"font-awesome": "4.3.0",
"gridster": "0.5.6",
"jquery": "2.1.4",
"leaflet": "0.7.3",
"Leaflet.heat": "Leaflet/Leaflet.heat#627ede7c11bbe43",
"lesshat": "3.0.2",
"lodash": "3.9.3",
"moment": "2.10.3",
"moment-timezone": "0.4.0",
"ng-clip": "0.2.6",
"require-css": "0.1.8",
"requirejs": "2.1.18",
"requirejs-text": "2.0.14",
"marked": "0.3.3",
"numeral": "1.5.3",
"nvd3": "1.7.1",
"leaflet-draw": "0.2.4"
},
"devDependencies": {},
"resolutions": {
"angular": "1.2.28",
"d3": "3.5.5"
}
}

View file

@ -1,64 +1,63 @@
# Kibana is served by a back end server. This controls which port to use.
# port: 5601
# server.port: 5601
# The host to bind the server to.
# host: "0.0.0.0"
# server.host: "0.0.0.0"
# The Elasticsearch instance to use for all your queries.
# elasticsearch_url: "http://localhost:9200"
# elasticsearch.url: "http://localhost:9200"
# preserve_elasticsearch_host true will send the hostname specified in `elasticsearch`. If you set it to false,
# then the host you use to connect to *this* Kibana instance will be sent.
# elasticsearch_preserve_host: true
# elasticsearch.preserveHost: true
# Kibana uses an index in Elasticsearch to store saved searches, visualizations
# and dashboards. It will create a new index if it doesn't already exist.
# kibana_index: ".kibana"
# kibana.index: ".kibana"
# The default application to load.
# kibana.defaultAppId: "discover"
# If your Elasticsearch is protected with basic auth, this is the user credentials
# used by the Kibana server to perform maintence on the kibana_index at statup. Your Kibana
# users will still need to authenticate with Elasticsearch (which is proxied thorugh
# the Kibana server)
# kibana_elasticsearch_username: user
# kibana_elasticsearch_password: pass
# elasticsearch.username: user
# elasticsearch.password: pass
# If your Elasticsearch requires client certificate and key
# kibana_elasticsearch_client_crt: /path/to/your/client.crt
# kibana_elasticsearch_client_key: /path/to/your/client.key
# elasticsearch.ssl.cert: /path/to/your/client.crt
# elasticsearch.ssl.key: /path/to/your/client.key
# If you need to provide a CA certificate for your Elasticsearch instance, put
# the path of the pem file here.
# ca: /path/to/your/CA.pem
# The default application to load.
# default_app_id: "discover"
# Time in milliseconds to wait for elasticsearch to respond to pings, defaults to
# request_timeout setting
# ping_timeout: 1500
# Time in milliseconds to wait for responses from the back end or elasticsearch.
# This must be > 0
# request_timeout: 300000
# Time in milliseconds for Elasticsearch to wait for responses from shards.
# Set to 0 to disable.
# shard_timeout: 0
# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying
# startup_timeout: 5000
# elasticsearch.ssl.ca: /path/to/your/CA.pem
# Set to false to have a complete disregard for the validity of the SSL
# certificate.
# verify_ssl: true
# elasticsearch.ssl.verify: true
# Time in milliseconds to wait for elasticsearch to respond to pings, defaults to
# request_timeout setting
# elasticsearch.pingTimeout: 1500
# Time in milliseconds to wait for responses from the back end or elasticsearch.
# This must be > 0
# elasticsearch.requestTimeout: 300000
# Time in milliseconds for Elasticsearch to wait for responses from shards.
# Set to 0 to disable.
# elasticsearch.shardTimeout: 0
# Time in milliseconds to wait for Elasticsearch at Kibana startup before retrying
# elasticsearch.startupTimeout: 5000
# SSL for outgoing requests from the Kibana Server (PEM formatted)
# ssl_key_file: /path/to/your/server.key
# ssl_cert_file: /path/to/your/server.crt
# server.ssl.cert: /path/to/your/server.key
# server.ssl.key: /path/to/your/server.crt
# Set the path to where you would like the process id file to be created.
# pid_file: /var/run/kibana.pid
# pid.file: /var/run/kibana.pid
# If you would like to send the log output to a file you can set the path below.
# This will also turn off the STDOUT log output.
# log_file: ./kibana.log
# logging.dest: stdout

62
karma.conf.js Normal file
View file

@ -0,0 +1,62 @@
// Karma configuration
// Generated on Mon Jul 27 2015 04:03:51 GMT-0700 (MST)
module.exports = function (config) {
config.set({
// base path that will be used to resolve all patterns (eg. files, exclude)
basePath: '',
captureTimeout: 30000,
browserNoActivityTimeout: 120000,
// frameworks to use
// available frameworks: https://npmjs.org/browse/keyword/karma-adapter
frameworks: ['mocha'],
// list of files / patterns to load in the browser
files: [
'http://localhost:5601/bundles/tests.bundle.js',
'http://localhost:5601/bundles/tests.bundle.style.css'
],
proxies: {
'/tests/': 'http://localhost:5601/tests/',
'/bundles/': 'http://localhost:5601/bundles/'
},
// test results reporter to use
// possible values: 'dots', 'progress'
// available reporters: https://npmjs.org/browse/keyword/karma-reporter
reporters: ['progress', 'growl'],
// web server port
port: 9876,
// enable / disable colors in the output (reporters and logs)
colors: true,
// level of logging
// possible values: config.LOG_DISABLE || config.LOG_ERROR || config.LOG_WARN || config.LOG_INFO || config.LOG_DEBUG
logLevel: config.LOG_INFO,
// enable / disable watching file and executing tests whenever any file changes
autoWatch: false,
// start these browsers
// available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
browsers: [
require('os').platform() === 'win32' ? 'IE' : 'Chrome'
],
// Continuous Integration mode
// if true, Karma captures browsers, runs the tests and exits
singleRun: false
});
};

View file

@ -12,7 +12,10 @@
],
"private": false,
"version": "4.2.0-snapshot",
"main": "src/server/index.js",
"build": {
"num": 8095
},
"main": "src/server/KbnServer.js",
"homepage": "https://www.elastic.co/products/kibana",
"bugs": {
"url": "http://github.com/elastic/kibana/issues"
@ -30,7 +33,7 @@
],
"scripts": {
"test": "grunt test",
"start": "node ./src/server/bin/kibana.js",
"start": "node ./src/server/cli/index.js --dev",
"precommit": "grunt lintStagedFiles"
},
"repository": {
@ -38,84 +41,117 @@
"url": "https://github.com/elastic/kibana.git"
},
"dependencies": {
"@spalger/angular-bootstrap": "^0.10.0",
"@spalger/filesaver": "^1.1.2",
"@spalger/leaflet-draw": "^0.2.3",
"@spalger/leaflet-heat": "^0.1.3",
"@spalger/ui-ace": "^0.2.3",
"Nonsense": "^0.1.2",
"angular": "1.2.28",
"angular-bindonce": "0.3.1",
"angular-elastic": "2.5.0",
"angular-mocks": "1.2.28",
"angular-nvd3": "panda01/angular-nvd3#kibana",
"angular-route": "1.2.28",
"ansicolors": "^0.3.2",
"auto-preload-rjscommon-deps-loader": "^1.0.3",
"autoprefixer": "^5.2.0",
"autoprefixer-loader": "^2.0.0",
"bluebird": "^2.9.27",
"body-parser": "^1.10.1",
"boom": "^2.8.0",
"bootstrap": "^3.3.5",
"brace": "^0.5.1",
"bunyan": "^1.2.3",
"commander": "^2.6.0",
"compression": "^1.3.0",
"cookie-parser": "^1.3.3",
"debug": "^2.1.1",
"chokidar": "^1.0.4",
"commander": "^2.8.1",
"css-loader": "^0.15.1",
"d3": "^3.5.6",
"elasticsearch": "^5.0.0",
"elasticsearch-browser": "^5.0.0",
"expiry-js": "^0.1.7",
"express": "^4.10.6",
"exports-loader": "^0.6.2",
"expose-loader": "^0.7.0",
"extract-text-webpack-plugin": "^0.8.2",
"file-loader": "^0.8.4",
"font-awesome": "^4.3.0",
"glob": "^4.3.2",
"good": "^5.1.2",
"good-console": "^4.1.0",
"good-file": "^4.0.2",
"good-reporter": "^3.1.0",
"good": "^6.2.0",
"good-squeeze": "^2.1.0",
"gridster": "^0.5.6",
"hapi": "^8.6.1",
"imports-loader": "^0.6.4",
"is-array": "^1.0.1",
"jade": "^1.7.2",
"jade-loader": "^0.7.1",
"joi": "^6.4.3",
"jquery": "^2.1.4",
"js-yaml": "^3.2.5",
"json-stringify-safe": "^5.0.1",
"lodash": "^3.9.3",
"leaflet": "^0.7.3",
"less": "^2.5.1",
"less-loader": "^2.2.0",
"lodash": "^3.10.0",
"marked": "^0.3.3",
"memory-fs": "^0.2.0",
"minimatch": "^2.0.8",
"mkdirp": "^0.5.1",
"moment": "^2.10.3",
"moment-timezone": "^0.4.0",
"ng-clip": "^0.2.6",
"numeral": "^1.5.3",
"nvd3": "panda01/nvd3#kibana",
"raw-loader": "^0.5.1",
"request": "^2.40.0",
"requirefrom": "^0.2.0",
"rimraf": "^2.4.0",
"rimraf": "^2.4.1",
"script-loader": "^0.6.1",
"semver": "^4.3.6",
"serve-favicon": "^2.2.0",
"through": "^2.3.6"
"style-loader": "^0.12.3",
"tar": "^2.1.1",
"url-loader": "^0.5.6",
"webpack": "^1.10.0",
"webpack-directory-name-as-main": "^1.0.0",
"zeroclipboard": "^2.2.0"
},
"devDependencies": {
"bower": "^1.4.1",
"bower-license": "^0.2.6",
"event-stream": "^3.1.5",
"auto-release-sinon": "^1.0.3",
"expect.js": "^0.3.1",
"faker": "^1.1.0",
"grunt": "^0.4.5",
"grunt-cli": "0.1.13",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compress": "^0.13.0",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-jade": "^0.14.0",
"grunt-contrib-jshint": "^0.11",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-requirejs": "^0.4.4",
"grunt-contrib-watch": "^0.6.1",
"grunt-esvm": "^1.0.1",
"grunt-jscs": "^1.8.0",
"grunt-mocha": "^0.4.10",
"grunt-karma": "^0.12.0",
"grunt-replace": "^0.7.9",
"grunt-run": "^0.3.0",
"grunt-run": "spalger/grunt-run#master",
"grunt-s3": "^0.2.0-alpha.3",
"grunt-simple-mocha": "^0.4.0",
"html-entities": "^1.1.1",
"http-proxy": "^1.8.1",
"husky": "^0.8.1",
"istanbul": "^0.3.15",
"jade": "^1.8.2",
"karma": "^0.13.3",
"karma-chrome-launcher": "^0.2.0",
"karma-firefox-launcher": "^0.1.6",
"karma-growl-reporter": "^0.1.1",
"karma-ie-launcher": "^0.2.0",
"karma-mocha": "^0.2.0",
"libesvm": "^1.0.1",
"license-checker": "^3.1.0",
"load-grunt-config": "^0.7.0",
"marked": "^0.3.3",
"marked-text-renderer": "^0.1.0",
"mkdirp": "^0.5.0",
"mocha": "^2.2.5",
"nock": "^2.7.0",
"nock": "^2.9.0",
"npm": "^2.11.0",
"opn": "^1.0.0",
"path-browserify": "0.0.0",
"portscanner": "^1.0.0",
"progress": "^1.1.8",
"requirejs": "^2.1.14",
"rjs-build-analysis": "0.0.3",
"simple-git": "^1.3.0",
"sinon": "^1.12.2",
"tar": "^2.1.1"
"sinon": "^1.15.4",
"source-map": "^0.4.4",
"whatwg-fetch": "^0.9.0"
},
"engines": {
"node": "~0.10 || ~0.12",
"iojs": ">=1.5"
"node": ">=2"
}
}

85
src/cli/Command.js Normal file
View file

@ -0,0 +1,85 @@
'use strict';
let _ = require('lodash');
let Command = require('commander').Command;
let red = require('./color').red;
let yellow = require('./color').yellow;
let help = require('./help');
Command.prototype.error = function (err) {
if (err && err.message) err = err.message;
console.log(
`
${red(' ERROR ')} ${err}
${help(this, ' ')}
`
);
process.exit(64);
};
Command.prototype.defaultHelp = function () {
console.log(
`
${help(this, ' ')}
`
);
process.exit(64);
};
Command.prototype.unknownArgv = function (argv) {
if (argv) this.__unkownArgv = argv;
return this.__unkownArgv ? this.__unkownArgv.slice(0) : [];
};
/**
* setup the command to accept arbitrary configuration via the cli
* @return {[type]} [description]
*/
Command.prototype.collectUnknownOptions = function () {
let title = `Extra ${this._name} options`;
this.allowUnknownOption();
this.getUnknownOptions = function () {
let opts = {};
let unknowns = this.unknownArgv();
while (unknowns.length) {
let opt = unknowns.shift().split('=');
if (opt[0].slice(0, 2) !== '--') {
this.error(`${title} "${opt[0]}" must start with "--"`);
}
if (opt.length === 1) {
if (!unknowns.length || unknowns[0][0] === '-') {
this.error(`${title} "${opt[0]}" must have a value`);
}
opt.push(unknowns.shift());
}
let val = opt[1];
try { val = JSON.parse(opt[1]); }
catch (e) { val = opt[1]; }
_.set(opts, opt[0].slice(2), val);
}
return opts;
};
return this;
};
Command.prototype.parseOptions = _.wrap(Command.prototype.parseOptions, function (parse, argv) {
let opts = parse.call(this, argv);
this.unknownArgv(opts.unknown);
return opts;
});
module.exports = Command;

18
src/cli/Log.js Normal file
View file

@ -0,0 +1,18 @@
'use strict';
let _ = require('lodash');
let ansicolors = require('ansicolors');
let log = _.restParam(function (color, label, rest1) {
console.log.apply(console, [color(` ${_.trim(label)} `)].concat(rest1));
});
let color = require('./color');
module.exports = class Log {
constructor(quiet, silent) {
this.good = quiet || silent ? _.noop : _.partial(log, color.green);
this.warn = quiet || silent ? _.noop : _.partial(log, color.yellow);
this.bad = silent ? _.noop : _.partial(log, color.red);
}
};

49
src/cli/cli.js Normal file
View file

@ -0,0 +1,49 @@
'use strict';
let _ = require('lodash');
let utils = require('requirefrom')('src/utils');
let pkg = utils('packageJson');
let Command = require('./Command');
let argv = process.env.kbnWorkerArgv ? JSON.parse(process.env.kbnWorkerArgv) : process.argv.slice();
let program = new Command('bin/kibana');
program
.version(pkg.version)
.description(
'Kibana is an open source (Apache Licensed), browser ' +
'based analytics and search dashboard for Elasticsearch.'
);
// attach commands
require('./serve/serve')(program);
require('./plugin/plugin')(program);
program
.command('help <command>')
.description('Get the help for a specific command')
.action(function (cmdName) {
var cmd = _.find(program.commands, { _name: cmdName });
if (!cmd) return this.error(`unknown command ${cmd}`);
cmd.help();
});
program
.command('*', null, { noHelp: true })
.action(function (cmd, options) {
program.error(`unknown command ${cmd}`);
});
// check for no command name
var subCommand = argv[2] && !String(argv[2][0]).match(/^-|^\.|\//);
if (!subCommand) {
if (_.intersection(argv.slice(2), ['-h', '--help']).length) {
program.defaultHelp();
} else {
argv.splice(2, 0, ['serve']);
}
}
program.parse(argv);

7
src/cli/color.js Normal file
View file

@ -0,0 +1,7 @@
var _ = require('lodash');
var ansicolors = require('ansicolors');
exports.green = _.flow(ansicolors.black, ansicolors.bgGreen);
exports.red = _.flow(ansicolors.white, ansicolors.bgRed);
exports.yellow = _.flow(ansicolors.black, ansicolors.bgYellow);

76
src/cli/help.js Normal file
View file

@ -0,0 +1,76 @@
'use strict';
var _ = require('lodash');
module.exports = function (command, spaces) {
if (!_.size(command.commands)) {
return command.outputHelp();
}
let defCmd = _.find(command.commands, function (cmd) {
return cmd._name === 'serve';
});
let desc = !command.description() ? '' : command.description();
let cmdDef = !defCmd ? '' : `=${defCmd._name}`;
return (
`
Usage: ${command._name} [command${cmdDef}] [options]
${desc}
Commands:
${indent(commandsSummary(command), 2)}
${cmdHelp(defCmd)}
`
).trim().replace(/^/gm, spaces || '');
};
function indent(str, n) {
return String(str || '').trim().replace(/^/gm, _.repeat(' ', n));
}
function commandsSummary(program) {
let cmds = _.compact(program.commands.map(function (cmd) {
let name = cmd._name;
if (name === '*') return;
let opts = cmd.options.length ? ' [options]' : '';
let args = cmd._args.map(function (arg) {
return humanReadableArgName(arg);
}).join(' ');
return [
`${name} ${opts} ${args}`,
cmd.description()
];
}));
let cmdLColWidth = cmds.reduce(function (width, cmd) {
return Math.max(width, cmd[0].length);
}, 0);
return cmds.reduce(function (help, cmd) {
return `${help || ''}${_.padRight(cmd[0], cmdLColWidth)} ${cmd[1] || ''}\n`;
}, '');
}
function cmdHelp(cmd) {
if (!cmd) return '';
return (
`
"${cmd._name}" Options:
${indent(cmd.optionHelp(), 2)}
`
).trim();
}
function humanReadableArgName(arg) {
var nameOutput = arg.name + (arg.variadic === true ? '...' : '');
return arg.required ? '<' + nameOutput + '>' : '[' + nameOutput + ']';
}

View file

@ -1,4 +1,3 @@
var root = require('requirefrom')('');
var expect = require('expect.js');
var nock = require('nock');
var glob = require('glob');
@ -6,8 +5,9 @@ var rimraf = require('rimraf');
var fs = require('fs');
var join = require('path').join;
var sinon = require('sinon');
var pluginLogger = root('src/server/bin/plugin/pluginLogger');
var npmInstall = root('src/server/bin/plugin/npmInstall');
var pluginLogger = require('../pluginLogger');
var npmInstall = require('../npmInstall');
describe('kibana cli', function () {
@ -66,4 +66,4 @@ describe('kibana cli', function () {
});
});
});

View file

@ -1,10 +1,10 @@
var root = require('requirefrom')('');
var plugin = root('src/server/bin/plugin/plugin');
var expect = require('expect.js');
var sinon = require('sinon');
var installer = root('src/server/bin/plugin/pluginInstaller');
var remover = root('src/server/bin/plugin/pluginRemover');
var settingParser = root('src/server/bin/plugin/settingParser');
var plugin = require('../plugin');
var installer = require('../pluginInstaller');
var remover = require('../pluginRemover');
var settingParser = require('../settingParser');
describe('kibana cli', function () {
@ -77,4 +77,4 @@ describe('kibana cli', function () {
});
});
});

View file

@ -1,10 +1,10 @@
var root = require('requirefrom')('');
var expect = require('expect.js');
var sinon = require('sinon');
var fs = require('fs');
var rimraf = require('rimraf');
var pluginCleaner = root('src/server/bin/plugin/pluginCleaner');
var pluginLogger = root('src/server/bin/plugin/pluginLogger');
var pluginCleaner = require('../pluginCleaner');
var pluginLogger = require('../pluginLogger');
describe('kibana cli', function () {
@ -144,4 +144,4 @@ describe('kibana cli', function () {
});
});
});

View file

@ -1,12 +1,12 @@
var root = require('requirefrom')('');
var expect = require('expect.js');
var sinon = require('sinon');
var nock = require('nock');
var glob = require('glob');
var rimraf = require('rimraf');
var join = require('path').join;
var pluginLogger = root('src/server/bin/plugin/pluginLogger');
var pluginDownloader = root('src/server/bin/plugin/pluginDownloader');
var pluginLogger = require('../pluginLogger');
var pluginDownloader = require('../pluginDownloader');
describe('kibana cli', function () {
@ -38,7 +38,7 @@ describe('kibana cli', function () {
afterEach(function () {
});
it('should throw an ENOTFOUND error for a 404 error', function () {
it.skip('should throw an ENOTFOUND error for a 404 error', function () {
var couchdb = nock('http://www.files.com')
.get('/plugin.tar.gz')
.reply(404);
@ -57,7 +57,7 @@ describe('kibana cli', function () {
});
});
it('should download and extract a valid plugin', function () {
it.skip('should download and extract a valid plugin', function () {
var filename = join(__dirname, 'replies/test-plugin-master.tar.gz');
var couchdb = nock('http://www.files.com')
.defaultReplyHeaders({
@ -109,7 +109,7 @@ describe('kibana cli', function () {
afterEach(function () {});
it('should loop through bad urls until it finds a good one.', function () {
it.skip('should loop through bad urls until it finds a good one.', function () {
var filename = join(__dirname, 'replies/test-plugin-master.tar.gz');
var settings = {
urls: [
@ -158,7 +158,7 @@ describe('kibana cli', function () {
});
});
it('should stop looping through urls when it finds a good one.', function () {
it.skip('should stop looping through urls when it finds a good one.', function () {
var filename = join(__dirname, 'replies/test-plugin-master.tar.gz');
var settings = {
urls: [
@ -207,7 +207,7 @@ describe('kibana cli', function () {
});
});
it('should throw an error when it doesn\'t find a good url.', function () {
it.skip('should throw an error when it doesn\'t find a good url.', function () {
var settings = {
urls: [
'http://www.files.com/badfile1.tar.gz',
@ -246,4 +246,4 @@ describe('kibana cli', function () {
});
});
});

View file

@ -1,4 +1,3 @@
var root = require('requirefrom')('');
var expect = require('expect.js');
var sinon = require('sinon');
var nock = require('nock');
@ -6,10 +5,11 @@ var glob = require('glob');
var rimraf = require('rimraf');
var fs = require('fs');
var join = require('path').join;
var pluginLogger = root('src/server/bin/plugin/pluginLogger');
var pluginInstaller = root('src/server/bin/plugin/pluginInstaller');
var Promise = require('bluebird');
var pluginLogger = require('../pluginLogger');
var pluginInstaller = require('../pluginInstaller');
describe('kibana cli', function () {
describe('plugin installer', function () {
@ -71,4 +71,4 @@ describe('kibana cli', function () {
});
});
});

View file

@ -1,8 +1,8 @@
var root = require('requirefrom')('');
var pluginLogger = root('src/server/bin/plugin/pluginLogger');
var expect = require('expect.js');
var sinon = require('sinon');
var pluginLogger = require('../pluginLogger');
describe('kibana cli', function () {
describe('plugin installer', function () {
@ -125,4 +125,4 @@ describe('kibana cli', function () {
});
});
});

View file

@ -1,8 +1,7 @@
var root = require('requirefrom')('');
var expect = require('expect.js');
var sinon = require('sinon');
var progressReporter = root('src/server/bin/plugin/progressReporter');
var pluginLogger = root('src/server/bin/plugin/pluginLogger');
var progressReporter = require('../progressReporter');
var pluginLogger = require('../pluginLogger');
describe('kibana cli', function () {
@ -299,4 +298,4 @@ describe('kibana cli', function () {
});
});
});

View file

@ -1,8 +1,10 @@
var root = require('requirefrom')('');
var settingParser = root('src/server/bin/plugin/settingParser');
var path = require('path');
var expect = require('expect.js');
var utils = require('requirefrom')('src/utils');
var fromRoot = utils('fromRoot');
var settingParser = require('../settingParser');
describe('kibana cli', function () {
describe('plugin installer', function () {
@ -71,7 +73,7 @@ describe('kibana cli', function () {
var options;
var parser;
beforeEach(function () {
options = { install: 'dummy/dummy' };
options = { install: 'dummy/dummy', pluginDir: fromRoot('installedPlugins') };
});
it('should require the user to specify either install and remove', function () {
@ -224,7 +226,7 @@ describe('kibana cli', function () {
parser = settingParser(options);
var settings = parser.parse();
var expected = path.resolve(__dirname, '..', '..', '..', '..', '..', 'src', 'server', 'bin', 'plugins', 'test-plugin');
var expected = fromRoot('installedPlugins/test-plugin');
expect(settings).to.have.property('pluginPath', expected);
});
@ -307,7 +309,7 @@ describe('kibana cli', function () {
parser = settingParser(options);
var settings = parser.parse();
var expected = path.resolve(__dirname, '..', '..', '..', '..', '..', 'src', 'server', 'bin', 'plugins', 'test-plugin');
var expected = fromRoot('installedPlugins/test-plugin');
expect(settings).to.have.property('pluginPath', expected);
});
@ -320,4 +322,4 @@ describe('kibana cli', function () {
});
});
});

67
src/cli/plugin/plugin.js Normal file
View file

@ -0,0 +1,67 @@
var utils = require('requirefrom')('src/utils');
var fromRoot = utils('fromRoot');
var settingParser = require('./settingParser');
var installer = require('./pluginInstaller');
var remover = require('./pluginRemover');
var pluginLogger = require('./pluginLogger');
module.exports = function (program) {
function processCommand(command, options) {
var settings;
try {
settings = settingParser(command).parse();
} catch (ex) {
//The logger has not yet been initialized.
console.error(ex.message);
process.exit(64);
}
var logger = pluginLogger(settings);
if (settings.action === 'install') {
installer.install(settings, logger);
}
if (settings.action === 'remove') {
remover.remove(settings, logger);
}
}
program
.command('plugin')
.option('-i, --install <org>/<plugin>/<version>', 'The plugin to install')
.option('-r, --remove <plugin>', 'The plugin to remove')
.option('-q, --quiet', 'Disable all process messaging except errors')
.option('-s, --silent', 'Disable all process messaging')
.option('-u, --url <url>', 'Specify download url')
.option(
'-t, --timeout <duration>',
'Length of time before failing; 0 for never fail',
settingParser.parseMilliseconds
)
.option(
'-d, --plugin-dir <path>',
'The path to the directory where plugins are stored',
fromRoot('installedPlugins')
)
.description(
'Maintain Plugins',
`
Common examples:
-i username/sample
attempts to download the latest version from the following urls:
https://download.elastic.co/username/sample/sample-latest.tar.gz
https://github.com/username/sample/archive/master.tar.gz
-i username/sample/v1.1.1
attempts to download version v1.1.1 from the following urls:
https://download.elastic.co/username/sample/sample-v1.1.1.tar.gz
https://github.com/username/sample/archive/v1.1.1.tar.gz
-i sample -u http://www.example.com/other_name.tar.gz
attempts to download from the specified url,
and installs the plugin found at that url as "sample"
`
)
.action(processCommand);
};

View file

@ -1,4 +1,4 @@
var _ = require('lodash');
var _ = require('lodash');
var zlib = require('zlib');
var Promise = require('bluebird');
var request = require('request');
@ -55,7 +55,6 @@ module.exports = function (settings, logger) {
return wrappedRequest(requestOptions)
.then(function (req) {
//debugger;
var reporter = progressReporter(logger, req);
req
@ -73,9 +72,7 @@ module.exports = function (settings, logger) {
}
function wrappedRequest(requestOptions) {
//debugger;
return Promise.try(function () {
//debugger;
return request.get(requestOptions);
})
.catch(function (err) {
@ -91,4 +88,4 @@ module.exports = function (settings, logger) {
download: download,
_downloadSingle: downloadSingle
};
};
};

View file

@ -1,4 +1,4 @@
var path = require('path');
var resolve = require('path').resolve;
var expiry = require('expiry-js');
module.exports = function (options) {
@ -38,8 +38,6 @@ module.exports = function (options) {
urls: []
};
settings.workingPath = path.resolve(__dirname, '..', 'plugins', '.plugin.installing');
if (options.timeout) {
settings.timeout = options.timeout;
}
@ -94,8 +92,10 @@ module.exports = function (options) {
throw new Error('Please specify either --install or --remove.');
}
settings.pluginDir = options.pluginDir;
if (settings.package) {
settings.pluginPath = path.resolve(__dirname, '..', 'plugins', settings.package);
settings.pluginPath = resolve(settings.pluginDir, settings.package);
settings.workingPath = resolve(settings.pluginDir, '.plugin.installing');
}
return settings;
@ -105,4 +105,4 @@ module.exports = function (options) {
parse: parse,
parseMilliseconds: parseMilliseconds
};
};
};

View file

@ -0,0 +1,64 @@
'use strict';
let _ = require('lodash');
let fs = require('fs');
let yaml = require('js-yaml');
let utils = require('requirefrom')('src/utils');
let fromRoot = utils('fromRoot');
let legacySettingMap = {
// server
port: 'server.port',
host: 'server.host',
pid_file: 'pid.file',
ssl_cert_file: 'server.ssl.cert',
ssl_key_file: 'server.ssl.key',
// logging
log_file: 'logging.dest',
// kibana
kibana_index: 'kibana.index',
default_app_id: 'kibana.defaultAppId',
// es
ca: 'elasticsearch.ssl.ca',
elasticsearch_preserve_host: 'elasticsearch.preserveHost',
elasticsearch_url: 'elasticsearch.url',
kibana_elasticsearch_client_crt: 'elasticsearch.ssl.cert',
kibana_elasticsearch_client_key: 'elasticsearch.ssl.key',
kibana_elasticsearch_password: 'elasticsearch.password',
kibana_elasticsearch_username: 'elasticsearch.username',
ping_timeout: 'elasticsearch.pingTimeout',
request_timeout: 'elasticsearch.requestTimeout',
shard_timeout: 'elasticsearch.shardTimeout',
startup_timeout: 'elasticsearch.startupTimeout',
verify_ssl: 'elasticsearch.ssl.verify',
};
module.exports = function (path) {
if (!path) return {};
let file = yaml.safeLoad(fs.readFileSync(path, 'utf8'));
function apply(config, val, key) {
if (_.isPlainObject(val)) {
_.forOwn(val, function (subVal, subKey) {
apply(config, subVal, key + '.' + subKey);
});
} else {
_.set(config, key, val);
}
}
// transform legeacy options into new namespaced versions
return _.transform(file, function (config, val, key) {
if (legacySettingMap.hasOwnProperty(key)) {
key = legacySettingMap[key];
}
apply(config, val, key);
}, {});
};

96
src/cli/serve/serve.js Normal file
View file

@ -0,0 +1,96 @@
'use strict';
let _ = require('lodash');
let isWorker = require('cluster').isWorker;
let resolve = require('path').resolve;
let cwd = process.cwd();
let readYamlConfig = require('./readYamlConfig');
let src = require('requirefrom')('src');
let fromRoot = src('utils/fromRoot');
let KbnServer = src('server/KbnServer');
let pathCollector = function () {
let paths = [];
return function (path) {
paths.push(resolve(process.cwd(), path));
return paths;
};
};
let pluginDirCollector = pathCollector();
let pluginPathCollector = pathCollector();
module.exports = function (program) {
program
.command('serve')
.description('Run the kibana server')
.collectUnknownOptions()
.option('-e, --elasticsearch <uri>', 'Elasticsearch instance')
.option('-c, --config <path>', 'Path to the config file')
.option('-p, --port <port>', 'The port to bind to', parseInt)
.option('-q, --quiet', 'Prevent all logging except errors')
.option('-Q, --silent', 'Prevent all logging')
.option('--verbose', 'Turns on verbose logging')
.option('-H, --host <host>', 'The host to bind to')
.option('-l, --log-file <path>', 'The file to log to')
.option(
'--plugin-dir <path>',
'A path to scan for plugins, this can be specified multiple ' +
'times to specify multiple directories',
pluginDirCollector,
[
fromRoot('installedPlugins'),
fromRoot('src/plugins')
]
)
.option(
'--plugin-path <path>',
'A path to a plugin which should be included by the server, ' +
'this can be specified multiple times to specify multiple paths',
pluginPathCollector,
[]
)
.option('--plugins <path>', 'an alias for --plugin-dir', pluginDirCollector)
.option('--dev', 'Run the server with development mode defaults')
.option('--no-watch', 'Prevent watching, use with --dev to prevent server restarts')
.action(function (opts) {
if (opts.dev && opts.watch && !isWorker) {
// stop processing the action and handoff to watch cluster manager
return require('../watch/watch')(opts);
}
let settings = readYamlConfig(opts.config || fromRoot('config/kibana.yml'));
let set = _.partial(_.set, settings);
let get = _.partial(_.get, settings);
if (opts.dev) {
set('env', 'development');
set('optimize.watch', opts.watch);
}
if (opts.elasticsearch) set('elasticsearch.url', opts.elasticsearch);
if (opts.port) set('server.port', opts.port);
if (opts.host) set('server.host', opts.host);
if (opts.quiet) set('logging.quiet', true);
if (opts.silent) set('logging.silent', true);
if (opts.verbose) set('logging.verbose', true);
if (opts.logFile) set('logging.dest', opts.logFile);
set('plugins.scanDirs', _.compact([].concat(
get('plugins.scanDirs'),
opts.pluginDir
)));
set('plugins.paths', [].concat(opts.pluginPath || []));
let server = new KbnServer(_.merge(settings, this.getUnknownOptions()));
server.ready().catch(function (err) {
console.error(err.stack);
process.exit(1);
});
return server;
});
};

106
src/cli/watch/Worker.js Normal file
View file

@ -0,0 +1,106 @@
'use strict';
let _ = require('lodash');
let cluster = require('cluster');
let resolve = require('path').resolve;
let EventEmitter = require('events').EventEmitter;
let fromRoot = require('../../utils/fromRoot');
let cliPath = fromRoot('src/cli/cli.js');
let baseArgs = _.difference(process.argv.slice(2), ['--no-watch']);
let baseArgv = [process.execPath, cliPath].concat(baseArgs);
cluster.setupMaster({
exec: cliPath,
silent: false
});
module.exports = class Worker extends EventEmitter {
constructor(opts) {
opts = opts || {};
super();
this.log = opts.log;
this.type = opts.type;
this.title = opts.title || opts.type;
this.filters = opts.filters;
this.changes = [];
let argv = _.union(baseArgv, opts.argv || []);
this.env = {
kbnWorkerType: this.type,
kbnWorkerArgv: JSON.stringify(argv)
};
_.bindAll(this, ['onExit', 'onMessage', 'shutdown', 'start']);
this.start = _.debounce(this.start, 25);
cluster.on('exit', this.onExit);
process.on('exit', this.shutdown);
}
onExit(fork, code) {
if (this.fork !== fork) return;
// our fork is gone, clear our ref so we don't try to talk to it anymore
this.fork = null;
if (code) {
this.log.bad(`${this.title} crashed`, 'with status code', code);
} else {
// restart after graceful shutdowns
this.start();
}
}
onChange(path) {
var valid = true;
if (this.filters) {
valid = _.any(this.filters, function (filter) {
return filter.test(path);
});
}
if (!valid) return;
this.changes.push(path);
this.start();
}
shutdown() {
if (this.fork && !this.fork.isDead()) {
this.fork.kill();
this.fork.removeListener('message', this.onMessage);
}
}
onMessage(msg) {
if (!_.isArray(msg) || msg[0] !== 'WORKER_BROADCAST') return;
this.emit('broadcast', msg[1]);
}
flushChangeBuffer() {
let files = _.unique(this.changes.splice(0));
let prefix = files.length > 1 ? '\n - ' : '';
return files.reduce(function (list, file, i, files) {
return `${list || ''}${prefix}"${file}"`;
}, '');
}
start() {
if (this.fork && !this.fork.isDead()) {
// once "exit" event is received with 0 status, start() is called again
return this.shutdown();
}
if (this.fork && this.changes.length) {
this.log.warn(`${this.title} restarting`, `due to changes in ${this.flushChangeBuffer()}`);
} else {
this.log.warn(`${this.title} starting`);
}
this.fork = cluster.fork(this.env);
this.fork.on('message', this.onMessage);
}
};

92
src/cli/watch/watch.js Normal file
View file

@ -0,0 +1,92 @@
'use strict';
let cluster = require('cluster');
let join = require('path').join;
let _ = require('lodash');
var chokidar = require('chokidar');
let utils = require('requirefrom')('src/utils');
let fromRoot = utils('fromRoot');
let Log = require('../Log');
let Worker = require('./Worker');
module.exports = function (opts) {
let watcher = chokidar.watch([
'src/cli',
'src/fixtures',
'src/server',
'src/utils',
'src/plugins',
'config',
], {
cwd: fromRoot('.'),
ignore: 'src/plugins/*/public/**/*'
});
let log = new Log(opts.quiet, opts.silent);
let customLogging = opts.quiet || opts.silent || opts.verbose;
let workers = [
new Worker({
type: 'optmzr',
title: 'optimizer',
log: log,
argv: _.compact([
customLogging ? null : '--quiet',
'--plugins.initialize=false',
'--server.autoListen=false',
'--optimize._workerRole=send'
]),
filters: [
/src\/server\/(optimize|ui|plugins)\//,
/src\/plugins\/[^\/]+\/[^\/]+\.js$/,
/src\/cli\//
]
}),
new Worker({
type: 'server',
log: log,
argv: [
'--optimize._workerRole=receive'
]
})
];
workers.forEach(function (worker) {
worker.on('broadcast', function (msg) {
workers.forEach(function (to) {
if (to !== worker && to.fork) to.fork.send(msg);
});
});
});
var addedCount = 0;
function onAddBeforeReady() {
addedCount += 1;
}
function onReady() {
// start sending changes to workers
watcher.removeListener('add', onAddBeforeReady);
watcher.on('all', onAnyChangeAfterReady);
log.good('Watching for changes', `(${addedCount} files)`);
_.invoke(workers, 'start');
}
function onAnyChangeAfterReady(e, path) {
_.invoke(workers, 'onChange', path);
}
function onError(err) {
log.bad('Failed to watch files!\n', err.stack);
process.exit(1);
}
watcher.on('add', onAddBeforeReady);
watcher.on('ready', onReady);
watcher.on('error', onError);
};

View file

@ -1,6 +1,6 @@
define(function (require) {
var _ = require('lodash');
var sinon = require('test_utils/auto_release_sinon');
var sinon = require('auto-release-sinon');
return function (Private, Promise) {
var indexPatterns = Private(require('fixtures/stubbed_logstash_index_pattern'));

View file

@ -1,6 +1,6 @@
define(function (require) {
var _ = require('lodash');
var sinon = require('test_utils/auto_release_sinon');
var sinon = require('auto-release-sinon');
function MockState(defaults) {
this.on = _.noop;

View file

@ -1,7 +1,7 @@
define(function (require) {
return function stubbedLogstashIndexPatternService(Private) {
var StubIndexPattern = Private(require('test_utils/stub_index_pattern'));
var fieldTypes = Private(require('components/index_patterns/_field_types'));
var StubIndexPattern = Private(require('testUtils/stubIndexPattern'));
var fieldTypes = Private(require('ui/index_patterns/_field_types'));
var mockLogstashFields = Private(require('fixtures/logstash_fields'));
var _ = require('lodash');

View file

@ -1,5 +1,5 @@
define(function (require) {
var sinon = require('test_utils/auto_release_sinon');
var sinon = require('auto-release-sinon');
var searchResponse = require('fixtures/search_response');
return function stubSearchSource(Private, $q) {

View file

@ -1,5 +1,5 @@
define(function (require) {
var sinon = require('test_utils/auto_release_sinon');
var sinon = require('auto-release-sinon');
function MockMap(container, chartData, params) {
this.container = container;

View file

@ -0,0 +1,33 @@
var $ = require('jquery');
var _ = require('lodash');
var $visCanvas = $('<div>').attr('id', 'vislib-vis-fixtures').appendTo('body');
var count = 0;
var visHeight = $visCanvas.height();
$visCanvas.new = function () {
count += 1;
if (count > 1) $visCanvas.height(visHeight * count);
return $('<div>').addClass('visualize-chart').appendTo($visCanvas);
};
afterEach(function () {
$visCanvas.empty();
if (count > 1) $visCanvas.height(visHeight);
count = 0;
});
module.exports = function VislibFixtures(Private) {
return function (visLibParams) {
var Vis = Private(require('ui/vislib/vis'));
return new Vis($visCanvas.new(), _.defaults({}, visLibParams || {}, {
shareYAxis: true,
addTooltip: true,
addLegend: true,
defaultYExtents: false,
setYExtents: false,
yAxis: {},
type: 'histogram'
}));
};
};

View file

@ -0,0 +1,264 @@
var moment = require('moment');
module.exports = {
'columns': [
{
'label': '200: response',
'xAxisLabel': '@timestamp per 30 sec',
'ordered': {
'date': true,
'interval': 30000,
'min': 1415826608440,
'max': 1415827508440
},
'yAxisLabel': 'Count of documents',
'xAxisFormatter': function (thing) {
return moment(thing);
},
'tooltipFormatter': function (d) {
return d;
},
'series': [
{
'values': [
{
'x': 1415826600000,
'y': 4
},
{
'x': 1415826630000,
'y': 8
},
{
'x': 1415826660000,
'y': 7
},
{
'x': 1415826690000,
'y': 5
},
{
'x': 1415826720000,
'y': 5
},
{
'x': 1415826750000,
'y': 4
},
{
'x': 1415826780000,
'y': 10
},
{
'x': 1415826810000,
'y': 7
},
{
'x': 1415826840000,
'y': 9
},
{
'x': 1415826870000,
'y': 8
},
{
'x': 1415826900000,
'y': 9
},
{
'x': 1415826930000,
'y': 8
},
{
'x': 1415826960000,
'y': 3
},
{
'x': 1415826990000,
'y': 9
},
{
'x': 1415827020000,
'y': 6
},
{
'x': 1415827050000,
'y': 8
},
{
'x': 1415827080000,
'y': 7
},
{
'x': 1415827110000,
'y': 4
},
{
'x': 1415827140000,
'y': 6
},
{
'x': 1415827170000,
'y': 10
},
{
'x': 1415827200000,
'y': 2
},
{
'x': 1415827230000,
'y': 8
},
{
'x': 1415827260000,
'y': 5
},
{
'x': 1415827290000,
'y': 6
},
{
'x': 1415827320000,
'y': 6
},
{
'x': 1415827350000,
'y': 10
},
{
'x': 1415827380000,
'y': 6
},
{
'x': 1415827410000,
'y': 6
},
{
'x': 1415827440000,
'y': 12
},
{
'x': 1415827470000,
'y': 9
},
{
'x': 1415827500000,
'y': 1
}
]
}
]
},
{
'label': '503: response',
'xAxisLabel': '@timestamp per 30 sec',
'ordered': {
'date': true,
'interval': 30000,
'min': 1415826608440,
'max': 1415827508440
},
'yAxisLabel': 'Count of documents',
'xAxisFormatter': function (thing) {
return moment(thing);
},
'tooltipFormatter': function (d) {
return d;
},
'series': [
{
'values': [
{
'x': 1415826630000,
'y': 1
},
{
'x': 1415826660000,
'y': 1
},
{
'x': 1415826720000,
'y': 1
},
{
'x': 1415826780000,
'y': 1
},
{
'x': 1415826900000,
'y': 1
},
{
'x': 1415827020000,
'y': 1
},
{
'x': 1415827080000,
'y': 1
},
{
'x': 1415827110000,
'y': 2
}
]
}
]
},
{
'label': '404: response',
'xAxisLabel': '@timestamp per 30 sec',
'ordered': {
'date': true,
'interval': 30000,
'min': 1415826608440,
'max': 1415827508440
},
'yAxisLabel': 'Count of documents',
'xAxisFormatter': function (thing) {
return moment(thing);
},
'tooltipFormatter': function (d) {
return d;
},
'series': [
{
'values': [
{
'x': 1415826660000,
'y': 1
},
{
'x': 1415826720000,
'y': 1
},
{
'x': 1415826810000,
'y': 1
},
{
'x': 1415826960000,
'y': 1
},
{
'x': 1415827050000,
'y': 1
},
{
'x': 1415827260000,
'y': 1
},
{
'x': 1415827380000,
'y': 1
},
{
'x': 1415827410000,
'y': 1
}
]
}
]
}
],
'hits': 225
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,150 @@
var moment = require('moment');
module.exports = {
'label': '',
'xAxisLabel': '@timestamp per 30 sec',
'ordered': {
'date': true,
'min': 1411761457636,
'max': 1411762357636,
'interval': 30000
},
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 1411761450000,
'y': 41
},
{
'x': 1411761480000,
'y': 18
},
{
'x': 1411761510000,
'y': 22
},
{
'x': 1411761540000,
'y': 17
},
{
'x': 1411761570000,
'y': 17
},
{
'x': 1411761600000,
'y': 21
},
{
'x': 1411761630000,
'y': 16
},
{
'x': 1411761660000,
'y': 17
},
{
'x': 1411761690000,
'y': 15
},
{
'x': 1411761720000,
'y': 19
},
{
'x': 1411761750000,
'y': 11
},
{
'x': 1411761780000,
'y': 13
},
{
'x': 1411761810000,
'y': 24
},
{
'x': 1411761840000,
'y': 20
},
{
'x': 1411761870000,
'y': 20
},
{
'x': 1411761900000,
'y': 21
},
{
'x': 1411761930000,
'y': 17
},
{
'x': 1411761960000,
'y': 20
},
{
'x': 1411761990000,
'y': 13
},
{
'x': 1411762020000,
'y': 14
},
{
'x': 1411762050000,
'y': 25
},
{
'x': 1411762080000,
'y': 17
},
{
'x': 1411762110000,
'y': 14
},
{
'x': 1411762140000,
'y': 22
},
{
'x': 1411762170000,
'y': 14
},
{
'x': 1411762200000,
'y': 19
},
{
'x': 1411762230000,
'y': 22
},
{
'x': 1411762260000,
'y': 17
},
{
'x': 1411762290000,
'y': 8
},
{
'x': 1411762320000,
'y': 15
},
{
'x': 1411762350000,
'y': 4
}
]
}
],
'hits': 533,
'xAxisFormatter': function (thing) {
return moment(thing);
},
'tooltipFormatter': function (d) {
return d;
}
};

View file

@ -0,0 +1,150 @@
var moment = require('moment');
module.exports = {
'label': '',
'xAxisLabel': '@timestamp per 30 sec',
'ordered': {
'date': true,
'min': 1411761457636,
'max': 1411762357636,
'interval': 30000
},
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 1411761450000,
'y': -41
},
{
'x': 1411761480000,
'y': -18
},
{
'x': 1411761510000,
'y': -22
},
{
'x': 1411761540000,
'y': -17
},
{
'x': 1411761570000,
'y': -17
},
{
'x': 1411761600000,
'y': -21
},
{
'x': 1411761630000,
'y': -16
},
{
'x': 1411761660000,
'y': -17
},
{
'x': 1411761690000,
'y': -15
},
{
'x': 1411761720000,
'y': -19
},
{
'x': 1411761750000,
'y': -11
},
{
'x': 1411761780000,
'y': -13
},
{
'x': 1411761810000,
'y': -24
},
{
'x': 1411761840000,
'y': -20
},
{
'x': 1411761870000,
'y': -20
},
{
'x': 1411761900000,
'y': -21
},
{
'x': 1411761930000,
'y': -17
},
{
'x': 1411761960000,
'y': -20
},
{
'x': 1411761990000,
'y': -13
},
{
'x': 1411762020000,
'y': -14
},
{
'x': 1411762050000,
'y': -25
},
{
'x': 1411762080000,
'y': -17
},
{
'x': 1411762110000,
'y': -14
},
{
'x': 1411762140000,
'y': -22
},
{
'x': 1411762170000,
'y': -14
},
{
'x': 1411762200000,
'y': -19
},
{
'x': 1411762230000,
'y': -22
},
{
'x': 1411762260000,
'y': -17
},
{
'x': 1411762290000,
'y': -8
},
{
'x': 1411762320000,
'y': -15
},
{
'x': 1411762350000,
'y': -4
}
]
}
],
'hits': 533,
'xAxisFormatter': function (thing) {
return moment(thing);
},
'tooltipFormatter': function (d) {
return d;
}
};

View file

@ -0,0 +1,150 @@
var moment = require('moment');
module.exports = {
'label': '',
'xAxisLabel': '@timestamp per 30 sec',
'ordered': {
'date': true,
'min': 1411761457636,
'max': 1411762357636,
'interval': 30000
},
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 1411761450000,
'y': 41
},
{
'x': 1411761480000,
'y': 18
},
{
'x': 1411761510000,
'y': -22
},
{
'x': 1411761540000,
'y': -17
},
{
'x': 1411761570000,
'y': -17
},
{
'x': 1411761600000,
'y': -21
},
{
'x': 1411761630000,
'y': -16
},
{
'x': 1411761660000,
'y': 17
},
{
'x': 1411761690000,
'y': 15
},
{
'x': 1411761720000,
'y': 19
},
{
'x': 1411761750000,
'y': 11
},
{
'x': 1411761780000,
'y': -13
},
{
'x': 1411761810000,
'y': -24
},
{
'x': 1411761840000,
'y': -20
},
{
'x': 1411761870000,
'y': -20
},
{
'x': 1411761900000,
'y': -21
},
{
'x': 1411761930000,
'y': 17
},
{
'x': 1411761960000,
'y': 20
},
{
'x': 1411761990000,
'y': -13
},
{
'x': 1411762020000,
'y': -14
},
{
'x': 1411762050000,
'y': 25
},
{
'x': 1411762080000,
'y': -17
},
{
'x': 1411762110000,
'y': -14
},
{
'x': 1411762140000,
'y': -22
},
{
'x': 1411762170000,
'y': -14
},
{
'x': 1411762200000,
'y': 19
},
{
'x': 1411762230000,
'y': 22
},
{
'x': 1411762260000,
'y': 17
},
{
'x': 1411762290000,
'y': 8
},
{
'x': 1411762320000,
'y': -15
},
{
'x': 1411762350000,
'y': -4
}
]
}
],
'hits': 533,
'xAxisFormatter': function (thing) {
return moment(thing);
},
'tooltipFormatter': function (d) {
return d;
}
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,106 @@
var _ = require('lodash');
module.exports = {
'columns': [
{
'label': 'Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1: agent.raw',
'xAxisLabel': 'filters',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'css',
'y': 10379
},
{
'x': 'png',
'y': 6395
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24: agent.raw',
'xAxisLabel': 'filters',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'css',
'y': 9253
},
{
'x': 'png',
'y': 5571
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322): agent.raw',
'xAxisLabel': 'filters',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'css',
'y': 7740
},
{
'x': 'png',
'y': 4697
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
}
],
'hits': 171443
};

View file

@ -0,0 +1,106 @@
var _ = require('lodash');
module.exports = {
'rows': [
{
'label': '200: response',
'xAxisLabel': 'filters',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'css',
'y': 25260
},
{
'x': 'png',
'y': 15311
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': '404: response',
'xAxisLabel': 'filters',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'css',
'y': 1352
},
{
'x': 'png',
'y': 826
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': '503: response',
'xAxisLabel': 'filters',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'css',
'y': 761
},
{
'x': 'png',
'y': 527
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
}
],
'hits': 171443
};

View file

@ -0,0 +1,40 @@
var _ = require('lodash');
module.exports = {
'label': '',
'xAxisLabel': 'filters',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'css',
'y': 27374
},
{
'x': 'html',
'y': 0
},
{
'x': 'png',
'y': 16663
}
]
}
],
'hits': 171454,
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
};

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,346 @@
var _ = require('lodash');
module.exports = {
'columns': [
{
'label': '404: response',
'xAxisLabel': 'machine.ram',
'ordered': {
'interval': 100
},
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 2147483600,
'y': 1,
'y0': 0
},
{
'x': 3221225400,
'y': 0,
'y0': 0
},
{
'x': 4294967200,
'y': 0,
'y0': 0
},
{
'x': 5368709100,
'y': 0,
'y0': 0
},
{
'x': 6442450900,
'y': 0,
'y0': 0
},
{
'x': 7516192700,
'y': 0,
'y0': 0
},
{
'x': 8589934500,
'y': 0,
'y0': 0
},
{
'x': 10737418200,
'y': 0,
'y0': 0
},
{
'x': 11811160000,
'y': 0,
'y0': 0
},
{
'x': 12884901800,
'y': 1,
'y0': 0
},
{
'x': 13958643700,
'y': 0,
'y0': 0
},
{
'x': 15032385500,
'y': 0,
'y0': 0
},
{
'x': 16106127300,
'y': 0,
'y0': 0
},
{
'x': 18253611000,
'y': 0,
'y0': 0
},
{
'x': 19327352800,
'y': 0,
'y0': 0
},
{
'x': 20401094600,
'y': 0,
'y0': 0
},
{
'x': 21474836400,
'y': 0,
'y0': 0
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': '200: response',
'xAxisLabel': 'machine.ram',
'ordered': {
'interval': 100
},
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 2147483600,
'y': 0,
'y0': 0
},
{
'x': 3221225400,
'y': 2,
'y0': 0
},
{
'x': 4294967200,
'y': 3,
'y0': 0
},
{
'x': 5368709100,
'y': 3,
'y0': 0
},
{
'x': 6442450900,
'y': 1,
'y0': 0
},
{
'x': 7516192700,
'y': 1,
'y0': 0
},
{
'x': 8589934500,
'y': 4,
'y0': 0
},
{
'x': 10737418200,
'y': 0,
'y0': 0
},
{
'x': 11811160000,
'y': 1,
'y0': 0
},
{
'x': 12884901800,
'y': 1,
'y0': 0
},
{
'x': 13958643700,
'y': 1,
'y0': 0
},
{
'x': 15032385500,
'y': 2,
'y0': 0
},
{
'x': 16106127300,
'y': 3,
'y0': 0
},
{
'x': 18253611000,
'y': 4,
'y0': 0
},
{
'x': 19327352800,
'y': 5,
'y0': 0
},
{
'x': 20401094600,
'y': 2,
'y0': 0
},
{
'x': 21474836400,
'y': 2,
'y0': 0
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': '503: response',
'xAxisLabel': 'machine.ram',
'ordered': {
'interval': 100
},
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 2147483600,
'y': 0,
'y0': 0
},
{
'x': 3221225400,
'y': 0,
'y0': 0
},
{
'x': 4294967200,
'y': 0,
'y0': 0
},
{
'x': 5368709100,
'y': 0,
'y0': 0
},
{
'x': 6442450900,
'y': 0,
'y0': 0
},
{
'x': 7516192700,
'y': 0,
'y0': 0
},
{
'x': 8589934500,
'y': 0,
'y0': 0
},
{
'x': 10737418200,
'y': 1,
'y0': 0
},
{
'x': 11811160000,
'y': 0,
'y0': 0
},
{
'x': 12884901800,
'y': 0,
'y0': 0
},
{
'x': 13958643700,
'y': 0,
'y0': 0
},
{
'x': 15032385500,
'y': 0,
'y0': 0
},
{
'x': 16106127300,
'y': 0,
'y0': 0
},
{
'x': 18253611000,
'y': 0,
'y0': 0
},
{
'x': 19327352800,
'y': 0,
'y0': 0
},
{
'x': 20401094600,
'y': 0,
'y0': 0
},
{
'x': 21474836400,
'y': 0,
'y0': 0
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
}
],
'hits': 40
};

View file

@ -0,0 +1,187 @@
var _ = require('lodash');
module.exports = {
'rows': [
{
'label': '404: response',
'xAxisLabel': 'machine.ram',
'ordered': {
'interval': 100
},
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 2147483600,
'y': 1
},
{
'x': 10737418200,
'y': 1
},
{
'x': 15032385500,
'y': 2
},
{
'x': 19327352800,
'y': 1
},
{
'x': 32212254700,
'y': 1
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': '200: response',
'xAxisLabel': 'machine.ram',
'ordered': {
'interval': 100
},
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 3221225400,
'y': 4
},
{
'x': 4294967200,
'y': 3
},
{
'x': 5368709100,
'y': 3
},
{
'x': 6442450900,
'y': 2
},
{
'x': 7516192700,
'y': 2
},
{
'x': 8589934500,
'y': 2
},
{
'x': 9663676400,
'y': 3
},
{
'x': 11811160000,
'y': 3
},
{
'x': 12884901800,
'y': 2
},
{
'x': 13958643700,
'y': 1
},
{
'x': 15032385500,
'y': 2
},
{
'x': 16106127300,
'y': 3
},
{
'x': 17179869100,
'y': 1
},
{
'x': 18253611000,
'y': 4
},
{
'x': 19327352800,
'y': 1
},
{
'x': 20401094600,
'y': 1
},
{
'x': 21474836400,
'y': 4
},
{
'x': 32212254700,
'y': 3
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': '503: response',
'xAxisLabel': 'machine.ram',
'ordered': {
'interval': 100
},
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 10737418200,
'y': 1
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
}
],
'hits': 51
};

View file

@ -0,0 +1,103 @@
var _ = require('lodash');
module.exports = {
'label': '',
'xAxisLabel': 'machine.ram',
'ordered': {
'interval': 100
},
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 3221225400,
'y': 5
},
{
'x': 4294967200,
'y': 2
},
{
'x': 5368709100,
'y': 5
},
{
'x': 6442450900,
'y': 4
},
{
'x': 7516192700,
'y': 1
},
{
'x': 9663676400,
'y': 9
},
{
'x': 10737418200,
'y': 5
},
{
'x': 11811160000,
'y': 5
},
{
'x': 12884901800,
'y': 2
},
{
'x': 13958643700,
'y': 3
},
{
'x': 15032385500,
'y': 3
},
{
'x': 16106127300,
'y': 3
},
{
'x': 17179869100,
'y': 1
},
{
'x': 18253611000,
'y': 6
},
{
'x': 19327352800,
'y': 3
},
{
'x': 20401094600,
'y': 3
},
{
'x': 21474836400,
'y': 7
},
{
'x': 32212254700,
'y': 4
}
]
}
],
'hits': 71,
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
};

View file

@ -0,0 +1,309 @@
var _ = require('lodash');
module.exports = {
'label': '',
'slices': {
'children': [
{
'name': 0,
'size': 378611,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 1000,
'size': 205997,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 2000,
'size': 397189,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 3000,
'size': 397195,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 4000,
'size': 398429,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 5000,
'size': 397843,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 6000,
'size': 398140,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 7000,
'size': 398076,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 8000,
'size': 396746,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 9000,
'size': 397418,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 10000,
'size': 20222,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 11000,
'size': 20173,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 12000,
'size': 20026,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 13000,
'size': 19986,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 14000,
'size': 20091,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 15000,
'size': 20052,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 16000,
'size': 20349,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 17000,
'size': 20290,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 18000,
'size': 20399,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 19000,
'size': 20133,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
},
{
'name': 20000,
'size': 9,
'aggConfig': {
'type': 'histogram',
'schema': 'segment',
'fieldFormatter': _.constant(String),
'params': {
'interval': 1000,
'extended_bounds': {}
}
}
}
]
},
'names': [
0,
1000,
2000,
3000,
4000,
5000,
6000,
7000,
8000,
9000,
10000,
11000,
12000,
13000,
14000,
15000,
16000,
17000,
18000,
19000,
20000
],
'hits': 3967374,
'tooltipFormatter': function (event) {
return event.point;
}
};

View file

@ -0,0 +1,32 @@
var _ = require('lodash');
module.exports = {
'label': '',
'xAxisLabel': '',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': '_all',
'y': 274
}
]
}
],
'hits': 274,
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
};

View file

@ -0,0 +1,59 @@
var _ = require('lodash');
module.exports = {
'columns': [
{
'label': 'apache: _type',
'xAxisLabel': 'bytes ranges',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': '0.0-1000.0',
'y': 13309
},
{
'x': '1000.0-2000.0',
'y': 7196
}
]
}
]
},
{
'label': 'nginx: _type',
'xAxisLabel': 'bytes ranges',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': '0.0-1000.0',
'y': 3278
},
{
'x': '1000.0-2000.0',
'y': 1804
}
]
}
]
}
],
'hits': 171499,
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
};

View file

@ -0,0 +1,84 @@
var _ = require('lodash');
module.exports = {
'rows': [
{
'label': 'Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1: agent.raw',
'xAxisLabel': 'bytes ranges',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': '0.0-1000.0',
'y': 6422,
'y0': 0
},
{
'x': '1000.0-2000.0',
'y': 3446,
'y0': 0
}
]
}
]
},
{
'label': 'Mozilla/5.0 (X11; Linux i686) AppleWebKit/534.24 (KHTML, like Gecko) Chrome/11.0.696.50 Safari/534.24: agent.raw',
'xAxisLabel': 'bytes ranges',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': '0.0-1000.0',
'y': 5430,
'y0': 0
},
{
'x': '1000.0-2000.0',
'y': 3010,
'y0': 0
}
]
}
]
},
{
'label': 'Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322): agent.raw',
'xAxisLabel': 'bytes ranges',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': '0.0-1000.0',
'y': 4735,
'y0': 0
},
{
'x': '1000.0-2000.0',
'y': 2542,
'y0': 0
}
]
}
]
}
],
'hits': 171501,
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
};

View file

@ -0,0 +1,36 @@
var _ = require('lodash');
module.exports = {
'label': '',
'xAxisLabel': 'bytes ranges',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': '0.0-1000.0',
'y': 16576
},
{
'x': '1000.0-2000.0',
'y': 9005
}
]
}
],
'hits': 171500,
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
};

View file

@ -0,0 +1,232 @@
var _ = require('lodash');
module.exports = {
'columns': [
{
'label': 'http: links',
'xAxisLabel': 'Top 5 unusual terms in @tags',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'success',
'y': 144000
},
{
'x': 'info',
'y': 128237
},
{
'x': 'security',
'y': 34518
},
{
'x': 'error',
'y': 10258
},
{
'x': 'warning',
'y': 17188
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': 'info: links',
'xAxisLabel': 'Top 5 unusual terms in @tags',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'success',
'y': 108148
},
{
'x': 'info',
'y': 96242
},
{
'x': 'security',
'y': 25889
},
{
'x': 'error',
'y': 7673
},
{
'x': 'warning',
'y': 12842
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': 'www.slate.com: links',
'xAxisLabel': 'Top 5 unusual terms in @tags',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'success',
'y': 98056
},
{
'x': 'info',
'y': 87344
},
{
'x': 'security',
'y': 23577
},
{
'x': 'error',
'y': 7004
},
{
'x': 'warning',
'y': 11759
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': 'twitter.com: links',
'xAxisLabel': 'Top 5 unusual terms in @tags',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'success',
'y': 74154
},
{
'x': 'info',
'y': 65963
},
{
'x': 'security',
'y': 17832
},
{
'x': 'error',
'y': 5258
},
{
'x': 'warning',
'y': 8906
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': 'www.www.slate.com: links',
'xAxisLabel': 'Top 5 unusual terms in @tags',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'success',
'y': 62591
},
{
'x': 'info',
'y': 55822
},
{
'x': 'security',
'y': 15100
},
{
'x': 'error',
'y': 4564
},
{
'x': 'warning',
'y': 7498
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
}
],
'hits': 171446
};

View file

@ -0,0 +1,232 @@
var _ = require('lodash');
module.exports = {
'rows': [
{
'label': 'h3: headings',
'xAxisLabel': 'Top 5 unusual terms in @tags',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'success',
'y': 144000
},
{
'x': 'info',
'y': 128235
},
{
'x': 'security',
'y': 34518
},
{
'x': 'error',
'y': 10257
},
{
'x': 'warning',
'y': 17188
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': 'h5: headings',
'xAxisLabel': 'Top 5 unusual terms in @tags',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'success',
'y': 144000
},
{
'x': 'info',
'y': 128235
},
{
'x': 'security',
'y': 34518
},
{
'x': 'error',
'y': 10257
},
{
'x': 'warning',
'y': 17188
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': 'http: headings',
'xAxisLabel': 'Top 5 unusual terms in @tags',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'success',
'y': 144000
},
{
'x': 'info',
'y': 128235
},
{
'x': 'security',
'y': 34518
},
{
'x': 'error',
'y': 10257
},
{
'x': 'warning',
'y': 17188
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': 'success: headings',
'xAxisLabel': 'Top 5 unusual terms in @tags',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'success',
'y': 120689
},
{
'x': 'info',
'y': 107621
},
{
'x': 'security',
'y': 28916
},
{
'x': 'error',
'y': 8590
},
{
'x': 'warning',
'y': 14548
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': 'www.slate.com: headings',
'xAxisLabel': 'Top 5 unusual terms in @tags',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'success',
'y': 62292
},
{
'x': 'info',
'y': 55646
},
{
'x': 'security',
'y': 14823
},
{
'x': 'error',
'y': 4441
},
{
'x': 'warning',
'y': 7539
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
}
],
'hits': 171445
};

View file

@ -0,0 +1,48 @@
var _ = require('lodash');
module.exports = {
'label': '',
'xAxisLabel': 'Top 5 unusual terms in @tags',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'success',
'y': 143995
},
{
'x': 'info',
'y': 128233
},
{
'x': 'security',
'y': 34515
},
{
'x': 'error',
'y': 10256
},
{
'x': 'warning',
'y': 17188
}
]
}
],
'hits': 171439,
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
};

File diff suppressed because it is too large Load diff

View file

@ -0,0 +1,142 @@
var _ = require('lodash');
module.exports = {
'columns': [
{
'label': 'logstash: index',
'xAxisLabel': 'Top 5 extension',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'jpg',
'y': 110710
},
{
'x': 'css',
'y': 27376
},
{
'x': 'png',
'y': 16664
},
{
'x': 'gif',
'y': 11264
},
{
'x': 'php',
'y': 5448
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': '2014.11.12: index',
'xAxisLabel': 'Top 5 extension',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'jpg',
'y': 110643
},
{
'x': 'css',
'y': 27350
},
{
'x': 'png',
'y': 16648
},
{
'x': 'gif',
'y': 11257
},
{
'x': 'php',
'y': 5440
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': '2014.11.11: index',
'xAxisLabel': 'Top 5 extension',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'jpg',
'y': 67
},
{
'x': 'css',
'y': 26
},
{
'x': 'png',
'y': 16
},
{
'x': 'gif',
'y': 7
},
{
'x': 'php',
'y': 8
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
}
],
'hits': 171462
};

View file

@ -0,0 +1,97 @@
var _ = require('lodash');
module.exports = {
'rows': [
{
'label': '0.0-1000.0: bytes',
'xAxisLabel': 'Top 5 extension',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'jpg',
'y': 3378
},
{
'x': 'css',
'y': 762
},
{
'x': 'png',
'y': 527
},
{
'x': 'gif',
'y': 11258
},
{
'x': 'php',
'y': 653
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
},
{
'label': '1000.0-2000.0: bytes',
'xAxisLabel': 'Top 5 extension',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'jpg',
'y': 6422
},
{
'x': 'css',
'y': 1591
},
{
'x': 'png',
'y': 430
},
{
'x': 'gif',
'y': 8
},
{
'x': 'php',
'y': 561
}
]
}
],
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
}
],
'hits': 171458
};

View file

@ -0,0 +1,48 @@
var _ = require('lodash');
module.exports = {
'label': '',
'xAxisLabel': 'Top 5 extension',
'yAxisLabel': 'Count of documents',
'series': [
{
'values': [
{
'x': 'jpg',
'y': 110710
},
{
'x': 'css',
'y': 27389
},
{
'x': 'png',
'y': 16661
},
{
'x': 'gif',
'y': 11269
},
{
'x': 'php',
'y': 5447
}
]
}
],
'hits': 171476,
'xAxisFormatter': function (val) {
if (_.isObject(val)) {
return JSON.stringify(val);
}
else if (val == null) {
return '';
}
else {
return '' + val;
}
},
'tooltipFormatter': function (d) {
return d;
}
};

View file

@ -1,3 +0,0 @@
{
"extends": "../../.jshintrc.browser"
}

View file

@ -1,10 +0,0 @@
define(function (require) {
return function NormalizeChartDataFactory(Private) {
return {
hierarchical: Private(require('components/agg_response/hierarchical/build_hierarchical_data')),
pointSeries: Private(require('components/agg_response/point_series/point_series')),
tabify: Private(require('components/agg_response/tabify/tabify')),
geoJson: Private(require('components/agg_response/geo_json/geo_json'))
};
};
});

View file

@ -1,18 +0,0 @@
| Private | module id |
| --- | --- |
| `true` | `components/agg_config/index` |
```js
var aggTypes = Private(require('components/agg_types/index'));
```
Collection of `AggType` definition objects. See the [Vis component](../vis) for an overall explaination of how `AggTypes` are used.
### Included
- [`AggType`](_agg_type.js)
- `AggParam`
- [`BaseAggParam`](param_types/base.js)
- [`FieldAggParam`](param_types/field.js)
- [`OptionedAggParam`](param_types/optioned.js)
- [`AggParams`](_agg_params.js)

Some files were not shown because too many files have changed in this diff Show more