mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
switch to eslint
This commit is contained in:
parent
e70987a28a
commit
e0d78a8475
260 changed files with 653 additions and 677 deletions
82
.eslintrc
Normal file
82
.eslintrc
Normal file
|
@ -0,0 +1,82 @@
|
|||
---
|
||||
env:
|
||||
es6: true
|
||||
amd: true
|
||||
node: true
|
||||
mocha: true
|
||||
browser: true
|
||||
|
||||
rules:
|
||||
block-scoped-var: 2
|
||||
camelcase:
|
||||
- 2
|
||||
- { "properties": "never" }
|
||||
comma-style:
|
||||
- 2
|
||||
- "last"
|
||||
comma-dangle: 0
|
||||
consistent-return: 0
|
||||
curly:
|
||||
- 2
|
||||
- "multi-line"
|
||||
dot-notation:
|
||||
- 2
|
||||
- { "allowKeywords": true }
|
||||
eqeqeq:
|
||||
- 2
|
||||
- "allow-null"
|
||||
global-strict:
|
||||
- 2
|
||||
- "never"
|
||||
guard-for-in: 2
|
||||
no-multi-spaces: 0
|
||||
key-spacing:
|
||||
- 0
|
||||
- { align: "value" }
|
||||
new-cap:
|
||||
- 2
|
||||
- { "capIsNewExceptions": ["Private"] }
|
||||
no-underscore-dangle: 0
|
||||
no-bitwise: 0
|
||||
no-caller: 2
|
||||
no-cond-assign: 0
|
||||
no-debugger: 2
|
||||
no-empty: 2
|
||||
no-eval: 2
|
||||
no-extend-native: 2
|
||||
no-extra-parens: 0
|
||||
no-irregular-whitespace: 2
|
||||
no-iterator: 2
|
||||
no-loop-func: 2
|
||||
no-multi-str: 2
|
||||
no-new: 0
|
||||
no-proto: 2
|
||||
no-return-assign: 0
|
||||
no-script-url: 2
|
||||
no-sequences: 2
|
||||
no-shadow: 0
|
||||
no-undef: 2
|
||||
no-unused-vars: 0
|
||||
no-unused-expressions: 0
|
||||
no-path-concat: 0
|
||||
no-use-before-define:
|
||||
- 2
|
||||
- "nofunc"
|
||||
no-with: 2
|
||||
quotes:
|
||||
- 2
|
||||
- "single"
|
||||
semi:
|
||||
- 2
|
||||
- "always"
|
||||
semi-spacing:
|
||||
- 2
|
||||
- { before: false, after: true }
|
||||
strict:
|
||||
- 2
|
||||
- "never"
|
||||
valid-typeof: 2
|
||||
wrap-iife:
|
||||
- 2
|
||||
- "outside"
|
||||
yoda: 0
|
43
.jshintrc
43
.jshintrc
|
@ -1,43 +0,0 @@
|
|||
{
|
||||
// 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,
|
||||
"bitwise": false,
|
||||
"eqnull": true,
|
||||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"immed": true,
|
||||
"expr": true,
|
||||
"latedef": "nofunc",
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"undef": true,
|
||||
"quotmark": "single",
|
||||
"plusplus": false,
|
||||
"boss": true,
|
||||
"laxbreak": true,
|
||||
"laxcomma": true,
|
||||
"validthis": true,
|
||||
"sub": true,
|
||||
"-W084": true,
|
||||
"scripturl": true,
|
||||
"evil": true,
|
||||
"esnext": true
|
||||
}
|
|
@ -43,16 +43,16 @@ Please make sure you have signed the [Contributor License Agreement](http://www.
|
|||
|
||||
#### Linting
|
||||
|
||||
A note about linting: We use both [jshint](http://jshint.com/) and [jscs](http://jscs.info/) to check that the [styleguide](STYLEGUIDE.md) is being followed. They run in a pre-commit hook and as a part of the tests, but most contributors integrate these linters with their code editors for real-time feedback.
|
||||
A note about linting: We use [eslint](http://eslint.org) to check that the [styleguide](STYLEGUIDE.md) is being followed. It runs in a pre-commit hook and as a part of the tests, but most contributors integrate it with their code editors for real-time feedback.
|
||||
|
||||
Here are some hints for setting up the linters in your favorite editor:
|
||||
Here are some hints for getting eslint setup in your favorite editor:
|
||||
|
||||
| Editor | JSHint | JSCS |
|
||||
| Editor | Plugin |
|
||||
| --- | --- | --- |
|
||||
| Sublime | [SublimeLinter-jshint](https://github.com/SublimeLinter/SublimeLinter-jshint#installation) | [SublimeLinter-jscs](https://github.com/SublimeLinter/SublimeLinter-jscs#installation) |
|
||||
| Atom | [linter-jshint](https://github.com/AtomLinter/linter-jshint#installation) | [linter-jscs](https://github.com/AtomLinter/linter-jscs#installation) |
|
||||
| IntelliJ | Settings » Languages & Frameworks » JavaScript » Code Quality Tools » JSHint (be sure to check "Use config files") | « |
|
||||
| vi | ask @simianhacker | « |
|
||||
| Sublime | [SublimeLinter-eslint](https://github.com/SublimeLinter/SublimeLinter-eslint#installation) |
|
||||
| Atom | [linter-eslint](https://github.com/AtomLinter/linter-eslint#installation) |
|
||||
| IntelliJ | Settings » Languages & Frameworks » JavaScript » Code Quality Tools » ESLint |
|
||||
| vi | [scrooloose/syntastic](https://github.com/scrooloose/syntastic) |
|
||||
|
||||
|
||||
### Testing and building
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
require('babel/register');
|
||||
|
||||
module.exports = function (grunt) {
|
||||
// set the config once before calling load-grunt-config
|
||||
// and once during so that we have access to it via
|
||||
|
@ -26,7 +28,12 @@ module.exports = function (grunt) {
|
|||
|
||||
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' ] ],
|
||||
services: [
|
||||
['launchd', '10.9'],
|
||||
['upstart', '1.5'],
|
||||
['systemd', 'default'],
|
||||
['sysv', 'lsb-3.1']
|
||||
],
|
||||
|
||||
devPlugins: 'devMode',
|
||||
|
||||
|
|
|
@ -127,9 +127,8 @@
|
|||
"grunt-contrib-clean": "^0.6.0",
|
||||
"grunt-contrib-compress": "^0.13.0",
|
||||
"grunt-contrib-copy": "^0.8.0",
|
||||
"grunt-contrib-jshint": "^0.11",
|
||||
"grunt-contrib-eslint": "0.0.5",
|
||||
"grunt-esvm": "^1.0.1",
|
||||
"grunt-jscs": "^1.8.0",
|
||||
"grunt-karma": "^0.12.0",
|
||||
"grunt-replace": "^0.7.9",
|
||||
"grunt-run": "spalger/grunt-run#master",
|
||||
|
|
|
@ -16,7 +16,7 @@ ${help(this, ' ')}
|
|||
`
|
||||
);
|
||||
|
||||
process.exit(64);
|
||||
process.exit(64); // eslint-disable-line no-process-exit
|
||||
};
|
||||
|
||||
Command.prototype.defaultHelp = function () {
|
||||
|
@ -27,7 +27,7 @@ ${help(this, ' ')}
|
|||
`
|
||||
);
|
||||
|
||||
process.exit(64);
|
||||
process.exit(64); // eslint-disable-line no-process-exit
|
||||
};
|
||||
|
||||
Command.prototype.unknownArgv = function (argv) {
|
||||
|
|
|
@ -65,7 +65,7 @@ describe('kibana cli', function () {
|
|||
throw error;
|
||||
});
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
errorStub = sinon.stub();
|
||||
return cleaner.cleanPrevious(logger)
|
||||
.catch(errorStub)
|
||||
.then(function () {
|
||||
|
@ -90,7 +90,7 @@ describe('kibana cli', function () {
|
|||
throw new Error('I am an error thrown by rimraf');
|
||||
});
|
||||
|
||||
var errorStub = sinon.stub();
|
||||
errorStub = sinon.stub();
|
||||
return cleaner.cleanPrevious(logger)
|
||||
.catch(errorStub)
|
||||
.then(function () {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var Promise = require('bluebird');
|
||||
var Promise = require('bluebird');
|
||||
var fs = require('fs');
|
||||
var path = require('path');
|
||||
var exec = require('child_process').exec;
|
||||
|
@ -10,8 +10,7 @@ module.exports = function (dest, logger) {
|
|||
var packageFile = path.join(dest, 'package.json');
|
||||
fs.statSync(packageFile);
|
||||
} catch (e) {
|
||||
if (e.code !== 'ENOENT')
|
||||
throw e;
|
||||
if (e.code !== 'ENOENT') throw e;
|
||||
|
||||
return reject(new Error('Plugin does not contain package.json file'));
|
||||
}
|
||||
|
@ -33,4 +32,4 @@ module.exports = function (dest, logger) {
|
|||
logger.error(child.stderr);
|
||||
logger.log(child.stdout);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
|
@ -14,7 +14,7 @@ module.exports = function (program) {
|
|||
} catch (ex) {
|
||||
//The logger has not yet been initialized.
|
||||
console.error(ex.message);
|
||||
process.exit(64);
|
||||
process.exit(64); // eslint-disable-line no-process-exit
|
||||
}
|
||||
|
||||
var logger = pluginLogger(settings);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var rimraf = require('rimraf');
|
||||
var rimraf = require('rimraf');
|
||||
var fs = require('fs');
|
||||
var Promise = require('bluebird');
|
||||
|
||||
|
@ -17,8 +17,7 @@ module.exports = function (settings, logger) {
|
|||
}
|
||||
return resolve();
|
||||
} catch (e) {
|
||||
if (e.code !== 'ENOENT')
|
||||
return reject(e);
|
||||
if (e.code !== 'ENOENT') return reject(e);
|
||||
|
||||
return resolve();
|
||||
}
|
||||
|
@ -26,15 +25,15 @@ module.exports = function (settings, logger) {
|
|||
}
|
||||
|
||||
function cleanError() {
|
||||
//delete the working directory.
|
||||
//At this point we're bailing, so swallow any errors on delete.
|
||||
try {
|
||||
rimraf.sync(settings.workingPath);
|
||||
} catch (e) { }
|
||||
// delete the working directory.
|
||||
// At this point we're bailing, so swallow any errors on delete.
|
||||
|
||||
try { rimraf.sync(settings.workingPath); }
|
||||
catch (e) {} // eslint-disable-line no-empty
|
||||
}
|
||||
|
||||
return {
|
||||
cleanPrevious: cleanPrevious,
|
||||
cleanError: cleanError
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -46,7 +46,7 @@ module.exports = function (settings, logger) {
|
|||
//Attempts to download a single url
|
||||
function downloadSingle(source, dest, timeout) {
|
||||
var gunzip = zlib.createGunzip();
|
||||
var tarExtract = tar.Extract({ path: dest, strip: 1 });
|
||||
var tarExtract = new tar.Extract({ path: dest, strip: 1 });
|
||||
|
||||
var requestOptions = { url: source };
|
||||
if (timeout !== 0) {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var pluginDownloader = require('./pluginDownloader');
|
||||
var pluginDownloader = require('./pluginDownloader');
|
||||
var pluginCleaner = require('./pluginCleaner');
|
||||
var npmInstall = require('./npmInstall');
|
||||
var fs = require('fs');
|
||||
|
@ -8,16 +8,15 @@ module.exports = {
|
|||
};
|
||||
|
||||
function install(settings, logger) {
|
||||
logger.log('installing ' + settings.package);
|
||||
logger.log(`installing ${settings.package}`);
|
||||
|
||||
try {
|
||||
fs.statSync(settings.pluginPath);
|
||||
|
||||
logger.error('Plugin ' + settings.package + ' already exists. Please remove before installing a new version.');
|
||||
process.exit(70);
|
||||
logger.error(`Plugin ${settings.package} already exists. Please remove before installing a new version.`);
|
||||
process.exit(70); // eslint-disable-line no-process-exit
|
||||
} catch (e) {
|
||||
if (e.code !== 'ENOENT')
|
||||
throw e;
|
||||
if (e.code !== 'ENOENT') throw e;
|
||||
}
|
||||
|
||||
var cleaner = pluginCleaner(settings, logger);
|
||||
|
@ -35,8 +34,8 @@ function install(settings, logger) {
|
|||
logger.log('Plugin installation complete!');
|
||||
})
|
||||
.catch(function (e) {
|
||||
logger.error('Plugin installation was unsuccessful due to error "' + e.message + '"');
|
||||
logger.error(`Plugin installation was unsuccessful due to error "${e.message}"`);
|
||||
cleaner.cleanError();
|
||||
process.exit(70);
|
||||
process.exit(70); // eslint-disable-line no-process-exit
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function (settings) {
|
||||
module.exports = function (settings) {
|
||||
var previousLineEnded = true;
|
||||
var silent = !!settings.silent;
|
||||
var quiet = !!settings.quiet;
|
||||
|
@ -41,4 +41,4 @@
|
|||
log: log,
|
||||
error: error
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var fs = require('fs');
|
||||
var fs = require('fs');
|
||||
var rimraf = require('rimraf');
|
||||
|
||||
module.exports = {
|
||||
|
@ -9,18 +9,15 @@ function remove(settings, logger) {
|
|||
try {
|
||||
try {
|
||||
fs.statSync(settings.pluginPath);
|
||||
}
|
||||
catch (e) {
|
||||
logger.log('Plugin ' + settings.package + ' does not exist.');
|
||||
} catch (e) {
|
||||
logger.log(`Plugin ${settings.package} does not exist.`);
|
||||
return;
|
||||
}
|
||||
|
||||
logger.log('Removing ' + settings.package + '...');
|
||||
|
||||
logger.log(`Removing ${settings.package}...`);
|
||||
rimraf.sync(settings.pluginPath);
|
||||
} catch (err) {
|
||||
var message = 'Unable to remove plugin "' + settings.package + '" because of error: "' + err.message + '"';
|
||||
logger.error(message);
|
||||
process.exit(74);
|
||||
logger.error(`Unable to remove plugin "${settings.package}" because of error: "${err.message}"`);
|
||||
process.exit(74); // eslint-disable-line no-process-exit
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
var Promise = require('bluebird');
|
||||
var Promise = require('bluebird');
|
||||
|
||||
/*
|
||||
Responsible for reporting the progress of the file request stream
|
||||
|
@ -47,7 +47,7 @@ module.exports = function (logger, request) {
|
|||
runningTotal += buffer.length;
|
||||
var dotCount = Math.round(runningTotal / totalSize * 100 / 5);
|
||||
if (dotCount > 20) dotCount = 20;
|
||||
for (var i = 0; i < (dotCount - oldDotCount) ; i++) {
|
||||
for (var i = 0; i < (dotCount - oldDotCount); i++) {
|
||||
logger.log('.', true);
|
||||
}
|
||||
oldDotCount = dotCount;
|
||||
|
|
|
@ -86,7 +86,7 @@ module.exports = function (program) {
|
|||
|
||||
server.ready().catch(function (err) {
|
||||
console.error(err.stack);
|
||||
process.exit(1);
|
||||
process.exit(1); // eslint-disable-line no-process-exit
|
||||
});
|
||||
|
||||
return server;
|
||||
|
|
|
@ -81,7 +81,7 @@ module.exports = class Worker extends EventEmitter {
|
|||
flushChangeBuffer() {
|
||||
let files = _.unique(this.changes.splice(0));
|
||||
let prefix = files.length > 1 ? '\n - ' : '';
|
||||
return files.reduce(function (list, file, i, files) {
|
||||
return files.reduce(function (list, file) {
|
||||
return `${list || ''}${prefix}"${file}"`;
|
||||
}, '');
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ module.exports = function (opts) {
|
|||
|
||||
function onError(err) {
|
||||
log.bad('Failed to watch files!\n', err.stack);
|
||||
process.exit(1);
|
||||
process.exit(1); // eslint-disable-line no-process-exit
|
||||
}
|
||||
|
||||
watcher.on('add', onAddBeforeReady);
|
||||
|
|
|
@ -9,7 +9,7 @@ var SetupError = require('../setup_error');
|
|||
describe('plugins/elasticsearch', function () {
|
||||
describe('lib/create_kibana_index', function () {
|
||||
|
||||
var server, client, config;
|
||||
var server, client;
|
||||
beforeEach(function () {
|
||||
server = {};
|
||||
client = {};
|
||||
|
|
|
@ -62,7 +62,7 @@ describe('plugins/elasticsearch', function () {
|
|||
payload: body
|
||||
});
|
||||
pass = true;
|
||||
} catch (e) {}
|
||||
} catch (e) {} // eslint-disable-line no-empty
|
||||
|
||||
if (pass !== Boolean(valid)) {
|
||||
var msg = 'Expected ' + method + ' ' +
|
||||
|
|
|
@ -9,19 +9,19 @@ module.exports = function (server) {
|
|||
var uri = url.parse(config.get('elasticsearch.url'));
|
||||
var username = config.get('elasticsearch.username');
|
||||
var password = config.get('elasticsearch.password');
|
||||
var verify_ssl = config.get('elasticsearch.ssl.verify');
|
||||
var client_crt = config.get('elasticsearch.ssl.cert');
|
||||
var client_key = config.get('elasticsearch.ssl.key');
|
||||
var verifySsl = config.get('elasticsearch.ssl.verify');
|
||||
var clientCrt = config.get('elasticsearch.ssl.cert');
|
||||
var clientKey = config.get('elasticsearch.ssl.key');
|
||||
var ca = config.get('elasticsearch.ssl.ca');
|
||||
|
||||
if (username && password) {
|
||||
uri.auth = util.format('%s:%s', username, password);
|
||||
}
|
||||
|
||||
var ssl = { rejectUnauthorized: verify_ssl };
|
||||
if (client_crt && client_key) {
|
||||
ssl.cert = fs.readFileSync(client_crt, 'utf8');
|
||||
ssl.key = fs.readFileSync(client_key, 'utf8');
|
||||
var ssl = { rejectUnauthorized: verifySsl };
|
||||
if (clientCrt && clientKey) {
|
||||
ssl.cert = fs.readFileSync(clientCrt, 'utf8');
|
||||
ssl.key = fs.readFileSync(clientKey, 'utf8');
|
||||
}
|
||||
if (ca) {
|
||||
ssl.ca = fs.readFileSync(ca, 'utf8');
|
||||
|
@ -31,7 +31,7 @@ module.exports = function (server) {
|
|||
host: url.format(uri),
|
||||
ssl: ssl,
|
||||
apiVersion: '1.4',
|
||||
log: function (config) {
|
||||
log: function () {
|
||||
this.error = function (err) {
|
||||
server.log(['error', 'elasticsearch'], err);
|
||||
};
|
||||
|
|
|
@ -90,17 +90,17 @@ function validate(server, req) {
|
|||
throw new validate.Fail(config.get('kibana.index'));
|
||||
}
|
||||
|
||||
function validateBulkBody(body) {
|
||||
while (body.length) {
|
||||
var header = body.shift();
|
||||
var req = body.shift();
|
||||
function validateBulkBody(toValidate) {
|
||||
while (toValidate.length) {
|
||||
let header = toValidate.shift();
|
||||
let body = toValidate.shift();
|
||||
|
||||
var op = _.keys(header).join('');
|
||||
var meta = header[op];
|
||||
let op = _.keys(header).join('');
|
||||
let meta = header[op];
|
||||
|
||||
if (!meta) throw new validate.Fail(config.get('kibana.index'));
|
||||
|
||||
var index = meta._index || maybeIndex;
|
||||
let index = meta._index || maybeIndex;
|
||||
if (index !== config.get('kibana.index')) {
|
||||
throw new validate.BadIndex(index);
|
||||
}
|
||||
|
|
|
@ -31,10 +31,11 @@ define(function (require) {
|
|||
var $state = $scope.state;
|
||||
|
||||
// receives $scope.panel from the dashboard grid directive, seems like should be isolate?
|
||||
$scope.$watch('id', function (id) {
|
||||
$scope.$watch('id', function () {
|
||||
if (!$scope.panel.id || !$scope.panel.type) return;
|
||||
|
||||
loadPanel($scope.panel, $scope).then(function (panelConfig) {
|
||||
loadPanel($scope.panel, $scope)
|
||||
.then(function (panelConfig) {
|
||||
// These could be done in loadPanel, putting them here to make them more explicit
|
||||
$scope.savedObj = panelConfig.savedObj;
|
||||
$scope.editUrl = panelConfig.editUrl;
|
||||
|
@ -44,7 +45,8 @@ define(function (require) {
|
|||
var index = $scope.savedObj.searchSource.get('index').id;
|
||||
filterManager.add(field, value, operator, index);
|
||||
};
|
||||
}).catch(function (e) {
|
||||
})
|
||||
.catch(function (e) {
|
||||
$scope.error = e.message;
|
||||
|
||||
// If the savedObjectType matches the panel type, this means the object itself has been deleted,
|
||||
|
|
|
@ -30,7 +30,10 @@ define(function (require) {
|
|||
// pixels used by all of the spacers (gridster puts have a spacer on the ends)
|
||||
var spacerSize = SPACER * COLS;
|
||||
|
||||
var init = function () {
|
||||
// debounced layout function is safe to call as much as possible
|
||||
var safeLayout = _.debounce(layout, 200);
|
||||
|
||||
function init() {
|
||||
$el.addClass('gridster');
|
||||
|
||||
gridster = $el.gridster({
|
||||
|
@ -90,36 +93,37 @@ define(function (require) {
|
|||
makePanelSerializeable(panel);
|
||||
});
|
||||
});
|
||||
|
||||
safeLayout();
|
||||
$window.on('resize', safeLayout);
|
||||
$scope.$on('ready:vis', safeLayout);
|
||||
};
|
||||
}
|
||||
|
||||
// return the panel object for an element.
|
||||
//
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
// ALWAYS CALL makePanelSerializeable AFTER YOU ARE DONE WITH IT
|
||||
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
||||
var getPanelFor = function (el) {
|
||||
var $el = el.jquery ? el : $(el);
|
||||
var panel = $el.data('panel');
|
||||
function getPanelFor(el) {
|
||||
var $panel = el.jquery ? el : $(el);
|
||||
var panel = $panel.data('panel');
|
||||
|
||||
panel.$el = $el;
|
||||
panel.$scope = $el.data('$scope');
|
||||
panel.$el = $panel;
|
||||
panel.$scope = $panel.data('$scope');
|
||||
|
||||
return panel;
|
||||
};
|
||||
}
|
||||
|
||||
// since the $el and $scope are circular structures, they need to be
|
||||
// removed from panel before it can be serialized (we also wouldn't
|
||||
// want them to show up in the url)
|
||||
var makePanelSerializeable = function (panel) {
|
||||
function makePanelSerializeable(panel) {
|
||||
delete panel.$el;
|
||||
delete panel.$scope;
|
||||
};
|
||||
}
|
||||
|
||||
// tell gridster to remove the panel, and cleanup our metadata
|
||||
var removePanel = function (panel) {
|
||||
function removePanel(panel) {
|
||||
// remove from grister 'silently' (don't reorganize after)
|
||||
gridster.remove_widget(panel.$el);
|
||||
|
||||
|
@ -128,10 +132,10 @@ define(function (require) {
|
|||
|
||||
panel.$el.removeData('panel');
|
||||
panel.$el.removeData('$scope');
|
||||
};
|
||||
}
|
||||
|
||||
// tell gridster to add the panel, and create additional meatadata like $scope
|
||||
var addPanel = function (panel) {
|
||||
function addPanel(panel) {
|
||||
_.defaults(panel, {
|
||||
size_x: 3,
|
||||
size_y: 2
|
||||
|
@ -163,19 +167,19 @@ define(function (require) {
|
|||
// stash the panel and it's scope in the element's data
|
||||
panel.$el.data('panel', panel);
|
||||
panel.$el.data('$scope', panel.$scope);
|
||||
};
|
||||
}
|
||||
|
||||
// ensure that the panel object has the latest size/pos info
|
||||
var refreshPanelStats = function (panel) {
|
||||
function refreshPanelStats(panel) {
|
||||
var data = panel.$el.coords().grid;
|
||||
panel.size_x = data.size_x;
|
||||
panel.size_y = data.size_y;
|
||||
panel.col = data.col;
|
||||
panel.row = data.row;
|
||||
};
|
||||
}
|
||||
|
||||
// when gridster tell us it made a change, update each of the panel objects
|
||||
var readGridsterChangeHandler = function (e, ui, $widget) {
|
||||
function readGridsterChangeHandler(e, ui, $widget) {
|
||||
// ensure that our panel objects keep their size in sync
|
||||
gridster.$widgets.each(function (i, el) {
|
||||
var panel = getPanelFor(el);
|
||||
|
@ -184,12 +188,12 @@ define(function (require) {
|
|||
makePanelSerializeable(panel);
|
||||
$scope.$root.$broadcast('change:vis');
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
// calculate the position and sizing of the gridster el, and the columns within it
|
||||
// then tell gridster to "reflow" -- which is definitely not supported.
|
||||
// we may need to consider using a different library
|
||||
var reflowGridster = function () {
|
||||
function reflowGridster() {
|
||||
// https://github.com/gcphost/gridster-responsive/blob/97fe43d4b312b409696b1d702e1afb6fbd3bba71/jquery.gridster.js#L1208-L1235
|
||||
var g = gridster;
|
||||
|
||||
|
@ -212,16 +216,14 @@ define(function (require) {
|
|||
// https://github.com/elastic/kibana4/issues/390
|
||||
if (gridster.gridmap.length > 0) g.set_dom_grid_height();
|
||||
g.drag_api.set_limits(COLS * g.min_widget_width);
|
||||
};
|
||||
}
|
||||
|
||||
var layout = function () {
|
||||
function layout() {
|
||||
var complete = notify.event('reflow dashboard');
|
||||
reflowGridster();
|
||||
readGridsterChangeHandler();
|
||||
complete();
|
||||
};
|
||||
|
||||
var safeLayout = _.debounce(layout, 200);
|
||||
}
|
||||
|
||||
init();
|
||||
}
|
||||
|
|
|
@ -24,7 +24,7 @@ describe('discoverField', function () {
|
|||
field: indexPattern.fields.byName.extension,
|
||||
increaseFieldCounter: sinon.spy(),
|
||||
toggle: function (field) {
|
||||
indexPattern.fields.byName[field].display = !!!indexPattern.fields.byName[field].display;
|
||||
indexPattern.fields.byName[field].display = !indexPattern.fields.byName[field].display;
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ describe('discover field chooser directives', function () {
|
|||
// Re-init
|
||||
destroy();
|
||||
|
||||
_.each(indexPattern.fields, function (field) { field.$$spec.count = 0;}); // Reset the popular fields
|
||||
_.each(indexPattern.fields, function (field) { field.$$spec.count = 0; }); // Reset the popular fields
|
||||
init($elem, {
|
||||
columns: [],
|
||||
toggle: sinon.spy(),
|
||||
|
|
|
@ -23,7 +23,7 @@ describe('hit sort function', function () {
|
|||
});
|
||||
var sortOptLength = sortOpts.length;
|
||||
|
||||
for (var i = 0; i < hits.length; i++) {
|
||||
for (let i = 0; i < hits.length; i++) {
|
||||
hits[i] = {
|
||||
_source: {},
|
||||
sort: sortOpts[i % sortOptLength]
|
||||
|
@ -31,7 +31,7 @@ describe('hit sort function', function () {
|
|||
}
|
||||
|
||||
hits.sort(createHitSortFn(dir))
|
||||
.forEach(function (hit, i, hits) {
|
||||
.forEach(function (hit, i) {
|
||||
var group = Math.floor(i / groupSize);
|
||||
expect(hit.sort).to.eql(sortOpts[group]);
|
||||
});
|
||||
|
|
|
@ -63,4 +63,4 @@ define(function () {
|
|||
};
|
||||
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
|
||||
var getFieldValues = function (hits, field) {
|
||||
function getFieldValues(hits, field) {
|
||||
var name = field.name;
|
||||
var flattenHit = field.indexPattern.flattenHit;
|
||||
return _.map(hits, function (hit) {
|
||||
return flattenHit(hit)[name];
|
||||
});
|
||||
};
|
||||
}
|
||||
|
||||
var getFieldValueCounts = function (params) {
|
||||
function getFieldValueCounts(params) {
|
||||
params = _.defaults(params, {
|
||||
count: 5,
|
||||
grouped: false
|
||||
|
@ -57,15 +57,15 @@ define(function (require) {
|
|||
return { error: e.message };
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
|
||||
// returns a count of fields in the array that are undefined or null
|
||||
var _countMissing = function (array) {
|
||||
function _countMissing(array) {
|
||||
return array.length - _.without(array, undefined, null).length;
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
var _groupValues = function (allValues, params) {
|
||||
function _groupValues(allValues, params) {
|
||||
var groups = {};
|
||||
var k;
|
||||
|
||||
|
@ -93,7 +93,7 @@ define(function (require) {
|
|||
});
|
||||
|
||||
return groups;
|
||||
};
|
||||
}
|
||||
|
||||
return {
|
||||
_groupValues: _groupValues,
|
||||
|
|
|
@ -37,9 +37,10 @@ define(function (require) {
|
|||
return courier.indexPatterns.getIds()
|
||||
.then(function (list) {
|
||||
var stateRison = $location.search()._a;
|
||||
|
||||
var state;
|
||||
try { state = rison.decode(stateRison); } catch (e) {}
|
||||
state = state || {};
|
||||
try { state = rison.decode(stateRison); }
|
||||
catch (e) { state = {}; }
|
||||
|
||||
var specified = !!state.index;
|
||||
var exists = _.contains(list, state.index);
|
||||
|
@ -444,7 +445,7 @@ define(function (require) {
|
|||
};
|
||||
|
||||
var loadingVis;
|
||||
var setupVisualization = function () {
|
||||
function setupVisualization() {
|
||||
// If we're not setting anything up we need to return an empty promise
|
||||
if (!$scope.opts.timefield) return Promise.resolve();
|
||||
if (loadingVis) return loadingVis;
|
||||
|
@ -509,7 +510,7 @@ define(function (require) {
|
|||
});
|
||||
|
||||
return loadingVis;
|
||||
};
|
||||
}
|
||||
|
||||
function resolveIndexPatternLoading() {
|
||||
var props = $route.current.locals.ip;
|
||||
|
|
|
@ -34,4 +34,4 @@ describe('Settings', function () {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -19,4 +19,4 @@ define(function (require) {
|
|||
display: 'About',
|
||||
url: '#/settings/about'
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,4 +7,4 @@ define(function (require) {
|
|||
require('plugins/kibana/settings/sections/objects/index'),
|
||||
require('plugins/kibana/settings/sections/about/index')
|
||||
];
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
var moment = require('moment');
|
||||
var errors = require('ui/errors');
|
||||
var { IndexPatternMissingIndices } = require('ui/errors');
|
||||
|
||||
require('ui/directives/validate_index_name');
|
||||
require('ui/directives/auto_select_if_only_one');
|
||||
|
@ -14,7 +14,6 @@ define(function (require) {
|
|||
require('ui/modules').get('apps/settings')
|
||||
.controller('settingsIndicesCreate', function ($scope, kbnUrl, Private, Notifier, indexPatterns, es, config, Promise) {
|
||||
var notify = new Notifier();
|
||||
var MissingIndices = errors.IndexPatternMissingIndices;
|
||||
var refreshKibanaIndex = Private(require('plugins/kibana/settings/sections/indices/_refresh_kibana_index'));
|
||||
var intervals = indexPatterns.intervals;
|
||||
var samplePromise;
|
||||
|
@ -69,7 +68,7 @@ define(function (require) {
|
|||
// .then(function () { indexPattern.save(); })
|
||||
})
|
||||
.catch(function (err) {
|
||||
if (err instanceof MissingIndices) {
|
||||
if (err instanceof IndexPatternMissingIndices) {
|
||||
notify.error('Could not locate any indices matching that pattern. Please add the index to Elasticsearch');
|
||||
}
|
||||
else notify.fatal(err);
|
||||
|
@ -209,7 +208,7 @@ define(function (require) {
|
|||
return indexPatterns.mapper.getFieldsForIndexPattern(pattern, true)
|
||||
.catch(function (err) {
|
||||
// TODO: we should probably display a message of some kind
|
||||
if (err instanceof MissingIndices) {
|
||||
if (err instanceof IndexPatternMissingIndices) {
|
||||
fetchFieldsError = 'Unable to fetch mapping. Do you have indices matching the pattern?';
|
||||
return [];
|
||||
}
|
||||
|
|
|
@ -25,4 +25,4 @@ define(function (require) {
|
|||
|
||||
return dateScripts;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,4 +23,4 @@ define(function (require) {
|
|||
}];
|
||||
};
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -143,7 +143,8 @@ define(function (require) {
|
|||
} else {
|
||||
$scope.aceInvalidEditors = _.without($scope.aceInvalidEditors, fieldName);
|
||||
}
|
||||
$rootScope.$$phase || $scope.$apply();
|
||||
|
||||
if ($rootScope.$$phase) $scope.$apply();
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -25,4 +25,4 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,4 +7,4 @@ define(function (require) {
|
|||
.filter('aggFilter', function () {
|
||||
return propFilter('name');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,3 +1,5 @@
|
|||
var _ = require('lodash');
|
||||
|
||||
define(function (require) {
|
||||
require('ui/modules')
|
||||
.get('app/visualize')
|
||||
|
@ -33,15 +35,7 @@ define(function (require) {
|
|||
});
|
||||
|
||||
$scope.availableSchema = $scope.schemas.filter(function (schema) {
|
||||
var count = 0;
|
||||
|
||||
if ($scope.group) {
|
||||
count = $scope.group.reduce(function (count, aggConfig) {
|
||||
if (aggConfig.schema === schema) count += 1;
|
||||
return count;
|
||||
}, 0);
|
||||
}
|
||||
|
||||
var count = _.where($scope.group, { schema }).length;
|
||||
if (count < schema.max) return true;
|
||||
});
|
||||
});
|
||||
|
@ -49,4 +43,4 @@ define(function (require) {
|
|||
};
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -28,4 +28,4 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -47,7 +47,6 @@ define(function (require) {
|
|||
])
|
||||
.controller('VisEditor', function ($scope, $route, timefilter, AppState, $location, kbnUrl, $timeout, courier, Private, Promise) {
|
||||
|
||||
var _ = require('lodash');
|
||||
var angular = require('angular');
|
||||
var ConfigTemplate = require('ui/ConfigTemplate');
|
||||
var Notifier = require('ui/notify/Notifier');
|
||||
|
@ -92,7 +91,7 @@ define(function (require) {
|
|||
vis: savedVisState
|
||||
};
|
||||
|
||||
var $state = new AppState(stateDefaults);
|
||||
$state = new AppState(stateDefaults);
|
||||
|
||||
if (!angular.equals($state.vis, savedVisState)) {
|
||||
Promise.try(function () {
|
||||
|
|
|
@ -21,7 +21,7 @@ define(function (require) {
|
|||
var bars = $scope.list.slice(0, index + 1);
|
||||
var colors = getColors(bars.length);
|
||||
|
||||
$el.html(bars.map(function (item, i) {
|
||||
$el.html(bars.map(function (bar, i) {
|
||||
return $(document.createElement('span'))
|
||||
.css('background-color', colors[i]);
|
||||
}));
|
||||
|
@ -29,4 +29,4 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -22,4 +22,4 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -101,10 +101,12 @@ define(function (require) {
|
|||
self.visState = Vis.convertOldState(self.typeName, JSON.parse(self.stateJSON));
|
||||
}
|
||||
|
||||
return self.vis = new Vis(
|
||||
self.vis = new Vis(
|
||||
self.searchSource.get('index'),
|
||||
self.visState
|
||||
);
|
||||
|
||||
return self.vis;
|
||||
};
|
||||
|
||||
SavedVis.prototype._updateVis = function () {
|
||||
|
|
|
@ -68,4 +68,4 @@ define(function (require) {
|
|||
kbnUrl.change('/visualize/create?type={{type}}&indexPattern={{pattern}}', {type: type, pattern: pattern});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,4 +23,4 @@ describe('markdown vis controller', function () {
|
|||
expect($scope).to.have.property('html');
|
||||
expect($scope.html.toString().indexOf('<a href')).to.be.greaterThan(-1);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -12,4 +12,4 @@ define(function (require) {
|
|||
$scope.html = $sce.trustAsHtml(marked(html));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -90,7 +90,7 @@ describe('Integration', function () {
|
|||
}
|
||||
|
||||
it('passes the table groups to the kbnAggTableGroup directive', function () {
|
||||
init(OneRangeVis(), fixtures.oneRangeBucket);
|
||||
init(new OneRangeVis(), fixtures.oneRangeBucket);
|
||||
|
||||
var $atg = $el.find('kbn-agg-table-group').first();
|
||||
expect($atg.size()).to.be(1);
|
||||
|
@ -99,7 +99,7 @@ describe('Integration', function () {
|
|||
});
|
||||
|
||||
it('displays an error if the search had no hits', function () {
|
||||
init(OneRangeVis(), { hits: { total: 0, hits: [] }});
|
||||
init(new OneRangeVis(), { hits: { total: 0, hits: [] }});
|
||||
|
||||
expect($el.find('kbn-agg-table-group').size()).to.be(0);
|
||||
|
||||
|
@ -122,7 +122,7 @@ describe('Integration', function () {
|
|||
});
|
||||
});
|
||||
|
||||
init(ThreeTermVis(visParams), resp);
|
||||
init(new ThreeTermVis(visParams), resp);
|
||||
|
||||
expect($el.find('kbn-agg-table-group').size()).to.be(0);
|
||||
|
||||
|
|
|
@ -75,7 +75,7 @@ describe('Controller', function () {
|
|||
}
|
||||
|
||||
it('exposes #tableGroups and #hasSomeRows when a response is attached to scope', function () {
|
||||
initController(OneRangeVis());
|
||||
initController(new OneRangeVis());
|
||||
|
||||
expect(!$scope.tableGroups).to.be.ok();
|
||||
expect(!$scope.hasSomeRows).to.be.ok();
|
||||
|
@ -90,7 +90,7 @@ describe('Controller', function () {
|
|||
});
|
||||
|
||||
it('clears #tableGroups and #hasSomeRows when the response is removed', function () {
|
||||
initController(OneRangeVis());
|
||||
initController(new OneRangeVis());
|
||||
|
||||
attachEsResponseToScope(fixtures.oneRangeBucket);
|
||||
removeEsResponseFromScope();
|
||||
|
@ -100,7 +100,7 @@ describe('Controller', function () {
|
|||
});
|
||||
|
||||
it('sets #hasSomeRows properly if the table group is empty', function () {
|
||||
initController(OneRangeVis());
|
||||
initController(new OneRangeVis());
|
||||
|
||||
// modify the data to not have any buckets
|
||||
var resp = _.cloneDeep(fixtures.oneRangeBucket);
|
||||
|
@ -118,7 +118,7 @@ describe('Controller', function () {
|
|||
var spiedTabify = sinon.spy(Private(tabifyPm));
|
||||
Private.stub(tabifyPm, spiedTabify);
|
||||
|
||||
var vis = OneRangeVis({ showPartialRows: true });
|
||||
var vis = new OneRangeVis({ showPartialRows: true });
|
||||
initController(vis);
|
||||
attachEsResponseToScope(fixtures.oneRangeBucket);
|
||||
|
||||
|
@ -132,7 +132,7 @@ describe('Controller', function () {
|
|||
var spiedTabify = sinon.spy(Private(tabifyPm));
|
||||
Private.stub(tabifyPm, spiedTabify);
|
||||
|
||||
var vis = OneRangeVis({ showPartialRows: false });
|
||||
var vis = new OneRangeVis({ showPartialRows: false });
|
||||
initController(vis);
|
||||
attachEsResponseToScope(fixtures.oneRangeBucket);
|
||||
|
||||
|
@ -146,7 +146,7 @@ describe('Controller', function () {
|
|||
var spiedTabify = sinon.spy(Private(tabifyPm));
|
||||
Private.stub(tabifyPm, spiedTabify);
|
||||
|
||||
var vis = OneRangeVis({ showPartialRows: true });
|
||||
var vis = new OneRangeVis({ showPartialRows: true });
|
||||
initController(vis);
|
||||
attachEsResponseToScope(fixtures.oneRangeBucket);
|
||||
|
||||
|
@ -160,7 +160,7 @@ describe('Controller', function () {
|
|||
var spiedTabify = sinon.spy(Private(tabifyPm));
|
||||
Private.stub(tabifyPm, spiedTabify);
|
||||
|
||||
var vis = OneRangeVis({ showPartialRows: false });
|
||||
var vis = new OneRangeVis({ showPartialRows: false });
|
||||
initController(vis);
|
||||
attachEsResponseToScope(fixtures.oneRangeBucket);
|
||||
|
||||
|
|
|
@ -23,4 +23,4 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -11,7 +11,7 @@ module.exports = function (dot, flatObject) {
|
|||
if (!memo[_key]) memo[_key] = {};
|
||||
walk(memo[_key], keys, value);
|
||||
}
|
||||
})(fullObject, keys, value);
|
||||
}(fullObject, keys, value));
|
||||
});
|
||||
return fullObject;
|
||||
};
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
module.exports = function (program) {
|
||||
module.exports = function (program) {
|
||||
function isCommand(val) {
|
||||
return typeof val === 'object' && val._name;
|
||||
}
|
||||
|
@ -6,4 +6,4 @@
|
|||
program.isCommandSpecified = function () {
|
||||
return program.args.some(isCommand);
|
||||
};
|
||||
};
|
||||
};
|
||||
|
|
|
@ -21,7 +21,7 @@ module.exports = Promise.method(function (kbnServer, server, config) {
|
|||
|
||||
if (config.get('pid.exclusive')) {
|
||||
server.log(['pid', 'fatal'], log);
|
||||
process.exit(1);
|
||||
process.exit(1); // eslint-disable-line no-process-exit
|
||||
} else {
|
||||
server.log(['pid', 'warning'], log);
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
let _ = require('lodash');
|
||||
let Joi = require('joi');
|
||||
let Promise = require('bluebird');
|
||||
let { resolve } = require('path');
|
||||
let { resolve } = require('path');
|
||||
let { inherits } = require('util');
|
||||
|
||||
const defaultConfigSchema = Joi.object({
|
||||
|
|
|
@ -45,7 +45,8 @@ module.exports = function (kbnServer, server, config) {
|
|||
})
|
||||
.filter(function (dir) {
|
||||
let path;
|
||||
try { path = require.resolve(dir); } catch (e) {}
|
||||
try { path = require.resolve(dir); }
|
||||
catch (e) { path = false; }
|
||||
|
||||
if (!path) {
|
||||
warning({ tmpl: 'Skipping non-plugin directory at <%= dir %>', dir: dir });
|
||||
|
|
|
@ -60,7 +60,7 @@ module.exports = class ServerStatus {
|
|||
|
||||
toString() {
|
||||
var overall = this.overall();
|
||||
return `${overall.title} – ${overall.nickname}`;
|
||||
return `${overall.title} – ${overall.nickname}`;
|
||||
}
|
||||
|
||||
toJSON() {
|
||||
|
|
|
@ -99,7 +99,8 @@ define(function (require) {
|
|||
if (type === 'keyup') setModifier(key, false);
|
||||
|
||||
var $target = _.isFunction($el) ? $el() : $el;
|
||||
$target.trigger($.Event(type, _.defaults({ keyCode: keyCode }, modifierState)));
|
||||
var $event = new $.Event(type, _.defaults({ keyCode: keyCode }, modifierState));
|
||||
$target.trigger($event);
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -43,4 +43,4 @@ define(function (require) {
|
|||
}
|
||||
|
||||
return inflector;
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
var _ = require('lodash');
|
||||
|
||||
var err = new Error();
|
||||
try { setByAssignment(err, 'john'); } catch (e) {}
|
||||
try { setByAssignment(err, 'john'); } catch (e) {} // eslint-disable-line
|
||||
|
||||
// err.stack is not always writeable, so we
|
||||
// do some detection for support and fallback to a
|
||||
|
|
|
@ -24,7 +24,7 @@ define(function () {
|
|||
path.unshift(result);
|
||||
if (result.$parent) return walk(result.$parent, path);
|
||||
return path;
|
||||
})(this, []);
|
||||
}(this, []));
|
||||
};
|
||||
|
||||
/**
|
||||
|
|
|
@ -49,11 +49,11 @@ define(function (require) {
|
|||
AggConfigs.prototype.toDsl = function () {
|
||||
var dslTopLvl = {};
|
||||
var dslLvlCursor;
|
||||
var nestedMetric;
|
||||
var nestedMetrics;
|
||||
|
||||
if (this.vis.isHierarchical()) {
|
||||
// collect all metrics, and filter out the ones that we won't be copying
|
||||
var nestedMetrics = _(this.vis.aggs.bySchemaGroup.metrics)
|
||||
nestedMetrics = _(this.vis.aggs.bySchemaGroup.metrics)
|
||||
.filter(function (agg) {
|
||||
return agg.type.name !== 'count';
|
||||
})
|
||||
|
|
|
@ -24,4 +24,4 @@ describe('buildHierarchicalData()', function () {
|
|||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -54,4 +54,4 @@ describe('collectBranch()', function () {
|
|||
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -78,4 +78,4 @@ describe('buildHierarchicalData()', function () {
|
|||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -42,4 +42,4 @@ describe('buildHierarchicalData()', function () {
|
|||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -93,4 +93,4 @@ describe('buildHierarchicalData()', function () {
|
|||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -7,4 +7,4 @@ define(function (require) {
|
|||
geoJson: Private(require('ui/agg_response/geo_json/geo_json'))
|
||||
};
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -14,4 +14,4 @@ define(function (require) {
|
|||
};
|
||||
};
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -26,4 +26,4 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -31,4 +31,4 @@ define(function (require) {
|
|||
|
||||
return Buckets;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -48,4 +48,4 @@ define(function (require) {
|
|||
return columns;
|
||||
};
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -72,7 +72,7 @@ define(function (require) {
|
|||
if (group) {
|
||||
table.aggConfig = agg;
|
||||
table.key = key;
|
||||
table.title = (table.fieldFormatter()(key)) + ': ' + agg.makeLabel() ;
|
||||
table.title = (table.fieldFormatter()(key)) + ': ' + agg.makeLabel();
|
||||
}
|
||||
|
||||
// link the parent and child
|
||||
|
|
|
@ -37,4 +37,4 @@ define(function (require) {
|
|||
|
||||
return Table;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,4 +23,4 @@ define(function (require) {
|
|||
|
||||
return TableGroup;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
describe('AggConfig Filters', function () {
|
||||
describe('date_histogram', function () {
|
||||
var _ = require('lodash');
|
||||
|
@ -99,4 +98,4 @@ describe('AggConfig Filters', function () {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -44,4 +44,4 @@ describe('AggConfig Filters', function () {
|
|||
expect(filter.range['@timestamp']).to.have.property('lt', +new Date('7 Feb 2015'));
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -43,4 +43,4 @@ describe('AggConfig Filters', function () {
|
|||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -42,4 +42,4 @@ describe('AggConfig Filters', function () {
|
|||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
describe('AggConfig Filters', function () {
|
||||
var expect = require('expect.js');
|
||||
var ngMock = require('ngMock');
|
||||
|
@ -77,4 +76,4 @@ describe('AggConfig Filters', function () {
|
|||
expect(filter.range.ip).to.have.property('lte', '67.129.65.223');
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
describe('AggConfig Filters', function () {
|
||||
var expect = require('expect.js');
|
||||
var ngMock = require('ngMock');
|
||||
|
@ -45,4 +44,4 @@ describe('AggConfig Filters', function () {
|
|||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
describe('AggConfig Filters', function () {
|
||||
var expect = require('expect.js');
|
||||
var ngMock = require('ngMock');
|
||||
|
@ -35,4 +34,4 @@ describe('AggConfig Filters', function () {
|
|||
});
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
describe('NumberList directive', function () {
|
||||
var $ = require('jquery');
|
||||
var _ = require('lodash');
|
||||
|
@ -149,4 +148,4 @@ describe('NumberList directive', function () {
|
|||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
var _ = require('lodash');
|
||||
var expect = require('expect.js');
|
||||
var ngMock = require('ngMock');
|
||||
|
@ -82,4 +81,4 @@ describe('calculateInterval()', function () {
|
|||
description: 'year'
|
||||
});
|
||||
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
|
||||
describe('ParamTypes', function () {
|
||||
require('./_field');
|
||||
require('./_optioned');
|
||||
require('./_regex');
|
||||
require('./_string');
|
||||
require('./_raw_json');
|
||||
});
|
||||
});
|
||||
|
|
|
@ -26,18 +26,18 @@ function ParamClassStub(parent, body) {
|
|||
module.exports = function stubParamClasses(Private) {
|
||||
var BaseAggParam = Private.stub(
|
||||
require('ui/agg_types/param_types/base'),
|
||||
ParamClassStub(null, function (config) {
|
||||
new ParamClassStub(null, function (config) {
|
||||
_.assign(this, config);
|
||||
})
|
||||
);
|
||||
|
||||
Private.stub(
|
||||
require('ui/agg_types/param_types/field'),
|
||||
ParamClassStub(BaseAggParam)
|
||||
new ParamClassStub(BaseAggParam)
|
||||
);
|
||||
|
||||
Private.stub(
|
||||
require('ui/agg_types/param_types/optioned'),
|
||||
ParamClassStub(BaseAggParam)
|
||||
new ParamClassStub(BaseAggParam)
|
||||
);
|
||||
};
|
||||
|
|
|
@ -18,4 +18,4 @@ define(function (require) {
|
|||
|
||||
return BucketAggType;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -50,4 +50,4 @@ define(function (require) {
|
|||
}
|
||||
];
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -44,4 +44,4 @@ define(function (require) {
|
|||
}]
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -43,4 +43,4 @@ define(function (require) {
|
|||
]
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -48,4 +48,4 @@ define(function (require) {
|
|||
return ResponseAggConfig;
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,4 +16,4 @@ define(function (require) {
|
|||
]
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,4 +16,4 @@ define(function (require) {
|
|||
]
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -58,4 +58,4 @@ define(function (require) {
|
|||
}
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,4 +16,4 @@ define(function (require) {
|
|||
]
|
||||
});
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,4 +8,4 @@ define(function (require) {
|
|||
|
||||
return BaseAggParam;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -52,4 +52,4 @@ define(function (require) {
|
|||
|
||||
return OptionedAggParam;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -68,4 +68,4 @@ define(function (require) {
|
|||
|
||||
return RegexAggParam;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -23,10 +23,11 @@ define(function (require) {
|
|||
* @return {undefined}
|
||||
*/
|
||||
ScriptAggParam.prototype.write = function (aggConfig, output) {
|
||||
if (aggConfig.params[this.name] && aggConfig.params[this.name].length)
|
||||
if (aggConfig.params[this.name] && aggConfig.params[this.name].length) {
|
||||
output.params[this.name] = aggConfig.params[this.name];
|
||||
}
|
||||
};
|
||||
|
||||
return ScriptAggParam;
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
|
||||
describe('$scope.$bind', function () {
|
||||
var sinon = require('auto-release-sinon');
|
||||
var expect = require('expect.js');
|
||||
|
@ -68,4 +67,4 @@ describe('$scope.$bind', function () {
|
|||
$self.$bind('localVal', 'val', $self);
|
||||
expect($self.localVal).to.be('bar');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue