mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
commit
d48c80d1a1
100 changed files with 640 additions and 1149 deletions
10
.editorconfig
Normal file
10
.editorconfig
Normal file
|
@ -0,0 +1,10 @@
|
|||
# editorconfig.org
|
||||
root = true
|
||||
|
||||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
58
.jscsrc
Normal file
58
.jscsrc
Normal file
|
@ -0,0 +1,58 @@
|
|||
{
|
||||
"maximumLineLength": {
|
||||
"value": 140,
|
||||
"allowComments": true
|
||||
},
|
||||
"requireCurlyBraces": [
|
||||
"for",
|
||||
"do",
|
||||
"try",
|
||||
"catch"
|
||||
],
|
||||
"requireSpaceAfterKeywords": [
|
||||
"if",
|
||||
"else",
|
||||
"for",
|
||||
"while",
|
||||
"do",
|
||||
"switch",
|
||||
"case",
|
||||
"return",
|
||||
"try",
|
||||
"catch",
|
||||
"function",
|
||||
"typeof"
|
||||
],
|
||||
"requireSpaceBeforeBlockStatements": true,
|
||||
"requireParenthesesAroundIIFE": true,
|
||||
"requireSpacesInConditionalExpression": true,
|
||||
"disallowSpacesInNamedFunctionExpression": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"disallowSpacesInFunctionDeclaration": {
|
||||
"beforeOpeningRoundBrace": true
|
||||
},
|
||||
"requireSpaceBetweenArguments": true,
|
||||
"disallowMultipleVarDecl": "exceptUndefined",
|
||||
"disallowEmptyBlocks": true,
|
||||
"requireCommaBeforeLineBreak": true,
|
||||
"disallowSpaceAfterPrefixUnaryOperators": true,
|
||||
"disallowSpaceBeforePostfixUnaryOperators": true,
|
||||
"disallowSpaceBeforeBinaryOperators": [
|
||||
","
|
||||
],
|
||||
"requireSpacesInForStatement": true,
|
||||
"requireSpaceBeforeBinaryOperators": true,
|
||||
"requireSpaceAfterBinaryOperators": true,
|
||||
"disallowKeywords": [
|
||||
"with"
|
||||
],
|
||||
"validateIndentation": 2,
|
||||
"validateQuoteMarks": { "mark": "'", "escape": true },
|
||||
"disallowMixedSpacesAndTabs": true,
|
||||
"disallowTrailingWhitespace": true,
|
||||
"requireCapitalizedConstructors": true,
|
||||
"requireDotNotation": true,
|
||||
"disallowNewlineBeforeBlockStatements": true,
|
||||
"disallowMultipleLineStrings": true
|
||||
}
|
13
.jshintrc
13
.jshintrc
|
@ -1,32 +1,27 @@
|
|||
{
|
||||
"unused": false,
|
||||
"browser": false,
|
||||
// for files at project root
|
||||
"node": true,
|
||||
"camelcase": false,
|
||||
"white": true,
|
||||
|
||||
// shared with .jshintrc files for browser and node
|
||||
"unused": false,
|
||||
"bitwise": false,
|
||||
"eqnull": true,
|
||||
"eqeqeq": true,
|
||||
"forin": true,
|
||||
"immed": true,
|
||||
"expr": true,
|
||||
"indent": 2,
|
||||
"latedef": "nofunc",
|
||||
"newcap": false,
|
||||
"noarg": true,
|
||||
"noempty": true,
|
||||
"undef": true,
|
||||
"quotmark": "single",
|
||||
"plusplus": false,
|
||||
"boss": true,
|
||||
"trailing": true,
|
||||
"laxbreak": true,
|
||||
"laxcomma": true,
|
||||
"validthis": true,
|
||||
"sub": true,
|
||||
"maxlen": 140,
|
||||
"-W084": true,
|
||||
"maxerr": 10,
|
||||
"scripturl": true,
|
||||
"evil": true
|
||||
}
|
||||
|
|
13
.jshintrc.browser
Normal file
13
.jshintrc.browser
Normal file
|
@ -0,0 +1,13 @@
|
|||
{
|
||||
"extends": "./.jshintrc",
|
||||
"node": false,
|
||||
"browser": true,
|
||||
|
||||
"predef": {
|
||||
// require.js
|
||||
"define": true,
|
||||
"require": true,
|
||||
"console": false,
|
||||
"-event": true
|
||||
}
|
||||
}
|
8
.jshintrc.node
Normal file
8
.jshintrc.node
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"extends": "./.jshintrc",
|
||||
"node": true,
|
||||
|
||||
"globals": {
|
||||
"Promise": true
|
||||
}
|
||||
}
|
|
@ -8,7 +8,7 @@ The process for contributing to any of the Elasticsearch repositories is similar
|
|||
|
||||
Please make sure you have signed the [Contributor License Agreement](http://www.elastic.co/contributor-agreement/). We are not asking you to assign copyright to us, but to give us the right to distribute your code without restriction. We ask this of all contributors in order to assure our users of the origin and continuing existence of the code. You only need to sign the CLA once.
|
||||
|
||||
#### Development Environment Setup
|
||||
### Development Environment Setup
|
||||
|
||||
- Install node.js (we recommend using [nvm](https://github.com/creationix/nvm))
|
||||
|
||||
|
@ -34,8 +34,22 @@ Please make sure you have signed the [Contributor License Agreement](http://www.
|
|||
```sh
|
||||
grunt dev # use the "--with-es" flag to install & start elasticsearch too
|
||||
```
|
||||
|
||||
#### Testing and building
|
||||
|
||||
#### 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.
|
||||
|
||||
Here are some hints for setting up the linters in your favorite editor:
|
||||
|
||||
| Editor | JSHint | JSCS |
|
||||
| --- | --- | --- |
|
||||
| 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 | « |
|
||||
|
||||
|
||||
### Testing and building
|
||||
|
||||
To ensure that your changes will not break other functionality, please run the test suite and build process before submitting your pull request.
|
||||
|
||||
|
|
10
Gruntfile.js
10
Gruntfile.js
|
@ -30,7 +30,15 @@ module.exports = function (grunt) {
|
|||
' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= package.author.company %>;' +
|
||||
' Licensed <%= package.license %> */\n'
|
||||
},
|
||||
|
||||
lintThese: [
|
||||
'Gruntfile.js',
|
||||
'<%= root %>/tasks/**/*.js',
|
||||
'<%= src %>/kibana/*.js',
|
||||
'<%= src %>/server/*.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',
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
"test": "grunt test",
|
||||
"start": "node ./src/server/bin/kibana.js",
|
||||
"server": "node ./src/server/bin/kibana.js",
|
||||
"precommit": "grunt hintStagedFiles"
|
||||
"precommit": "grunt lintStagedFiles"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
|
@ -72,11 +72,12 @@
|
|||
"grunt-contrib-compress": "~0.9.1",
|
||||
"grunt-contrib-copy": "~0.5.0",
|
||||
"grunt-contrib-jade": "~0.10.0",
|
||||
"grunt-contrib-jshint": "~0.8.0",
|
||||
"grunt-contrib-jshint": "^0.11",
|
||||
"grunt-contrib-less": "~0.10.0",
|
||||
"grunt-contrib-requirejs": "~0.4.4",
|
||||
"grunt-contrib-watch": "~0.5.3",
|
||||
"grunt-esvm": "~0.3.2",
|
||||
"grunt-jscs": "git://github.com/spalger/grunt-jscs.git#addFix",
|
||||
"grunt-mocha": "~0.4.10",
|
||||
"grunt-replace": "^0.7.9",
|
||||
"grunt-run": "^0.2.3",
|
||||
|
|
332
src/.jshintrc
332
src/.jshintrc
|
@ -1,332 +0,0 @@
|
|||
{
|
||||
"extends": "../.jshintrc",
|
||||
|
||||
"browser": false, // handled by globals list below
|
||||
"node": false,
|
||||
|
||||
"globals": {
|
||||
// require.js
|
||||
"define": true,
|
||||
"require": true,
|
||||
|
||||
// standard "browser" env, modified slightly
|
||||
"Audio": false,
|
||||
"Blob": false,
|
||||
"addEventListener": false,
|
||||
"applicationCache": false,
|
||||
"atob": false,
|
||||
"blur": false,
|
||||
"btoa": false,
|
||||
"cancelAnimationFrame": false,
|
||||
"CanvasGradient": false,
|
||||
"CanvasPattern": false,
|
||||
"CanvasRenderingContext2D": false,
|
||||
"CSS": false,
|
||||
"clearInterval": false,
|
||||
"clearTimeout": false,
|
||||
"close": false,
|
||||
"closed": false,
|
||||
"Comment": false,
|
||||
"console": true,
|
||||
"CustomEvent": false,
|
||||
"DOMParser": false,
|
||||
"defaultStatus": false,
|
||||
"Document": false,
|
||||
"document": false,
|
||||
"DocumentFragment": false,
|
||||
"Element": false,
|
||||
"ElementTimeControl": false,
|
||||
"Event": false,
|
||||
// "event": false,
|
||||
"FileReader": false,
|
||||
"FormData": false,
|
||||
"focus": false,
|
||||
"frames": false,
|
||||
"getComputedStyle": false,
|
||||
"HTMLElement": false,
|
||||
"HTMLAnchorElement": false,
|
||||
"HTMLBaseElement": false,
|
||||
"HTMLBlockquoteElement": false,
|
||||
"HTMLBodyElement": false,
|
||||
"HTMLBRElement": false,
|
||||
"HTMLButtonElement": false,
|
||||
"HTMLCanvasElement": false,
|
||||
"HTMLDirectoryElement": false,
|
||||
"HTMLDivElement": false,
|
||||
"HTMLDListElement": false,
|
||||
"HTMLFieldSetElement": false,
|
||||
"HTMLFontElement": false,
|
||||
"HTMLFormElement": false,
|
||||
"HTMLFrameElement": false,
|
||||
"HTMLFrameSetElement": false,
|
||||
"HTMLHeadElement": false,
|
||||
"HTMLHeadingElement": false,
|
||||
"HTMLHRElement": false,
|
||||
"HTMLHtmlElement": false,
|
||||
"HTMLIFrameElement": false,
|
||||
"HTMLImageElement": false,
|
||||
"HTMLInputElement": false,
|
||||
"HTMLIsIndexElement": false,
|
||||
"HTMLLabelElement": false,
|
||||
"HTMLLayerElement": false,
|
||||
"HTMLLegendElement": false,
|
||||
"HTMLLIElement": false,
|
||||
"HTMLLinkElement": false,
|
||||
"HTMLMapElement": false,
|
||||
"HTMLMenuElement": false,
|
||||
"HTMLMetaElement": false,
|
||||
"HTMLModElement": false,
|
||||
"HTMLObjectElement": false,
|
||||
"HTMLOListElement": false,
|
||||
"HTMLOptGroupElement": false,
|
||||
"HTMLOptionElement": false,
|
||||
"HTMLParagraphElement": false,
|
||||
"HTMLParamElement": false,
|
||||
"HTMLPreElement": false,
|
||||
"HTMLQuoteElement": false,
|
||||
"HTMLScriptElement": false,
|
||||
"HTMLSelectElement": false,
|
||||
"HTMLStyleElement": false,
|
||||
"HTMLTableCaptionElement": false,
|
||||
"HTMLTableCellElement": false,
|
||||
"HTMLTableColElement": false,
|
||||
"HTMLTableElement": false,
|
||||
"HTMLTableRowElement": false,
|
||||
"HTMLTableSectionElement": false,
|
||||
"HTMLTextAreaElement": false,
|
||||
"HTMLTitleElement": false,
|
||||
"HTMLUListElement": false,
|
||||
"HTMLVideoElement": false,
|
||||
"history": false,
|
||||
"Image": false,
|
||||
"Intl": false,
|
||||
"length": false,
|
||||
"localStorage": false,
|
||||
"location": false,
|
||||
"matchMedia": false,
|
||||
"MessageChannel": false,
|
||||
"MessageEvent": false,
|
||||
"MessagePort": false,
|
||||
"MouseEvent": false,
|
||||
"moveBy": false,
|
||||
"moveTo": false,
|
||||
"MutationObserver": false,
|
||||
"name": false,
|
||||
"Node": false,
|
||||
"NodeFilter": false,
|
||||
"NodeList": false,
|
||||
"Notification": false,
|
||||
"navigator": false,
|
||||
"onbeforeunload": true,
|
||||
"onblur": true,
|
||||
"onerror": true,
|
||||
"onfocus": true,
|
||||
"onload": true,
|
||||
"onresize": true,
|
||||
"onunload": true,
|
||||
"open": false,
|
||||
"openDatabase": false,
|
||||
"opener": false,
|
||||
"Option": false,
|
||||
"parent": false,
|
||||
"print": false,
|
||||
"Range": false,
|
||||
"requestAnimationFrame": false,
|
||||
"removeEventListener": false,
|
||||
"resizeBy": false,
|
||||
"resizeTo": false,
|
||||
"screen": false,
|
||||
"scroll": false,
|
||||
"scrollBy": false,
|
||||
"scrollTo": false,
|
||||
"sessionStorage": false,
|
||||
"setInterval": false,
|
||||
"setTimeout": false,
|
||||
"SharedWorker": false,
|
||||
"status": false,
|
||||
"SVGAElement": false,
|
||||
"SVGAltGlyphDefElement": false,
|
||||
"SVGAltGlyphElement": false,
|
||||
"SVGAltGlyphItemElement": false,
|
||||
"SVGAngle": false,
|
||||
"SVGAnimateColorElement": false,
|
||||
"SVGAnimateElement": false,
|
||||
"SVGAnimateMotionElement": false,
|
||||
"SVGAnimateTransformElement": false,
|
||||
"SVGAnimatedAngle": false,
|
||||
"SVGAnimatedBoolean": false,
|
||||
"SVGAnimatedEnumeration": false,
|
||||
"SVGAnimatedInteger": false,
|
||||
"SVGAnimatedLength": false,
|
||||
"SVGAnimatedLengthList": false,
|
||||
"SVGAnimatedNumber": false,
|
||||
"SVGAnimatedNumberList": false,
|
||||
"SVGAnimatedPathData": false,
|
||||
"SVGAnimatedPoints": false,
|
||||
"SVGAnimatedPreserveAspectRatio": false,
|
||||
"SVGAnimatedRect": false,
|
||||
"SVGAnimatedString": false,
|
||||
"SVGAnimatedTransformList": false,
|
||||
"SVGAnimationElement": false,
|
||||
"SVGCSSRule": false,
|
||||
"SVGCircleElement": false,
|
||||
"SVGClipPathElement": false,
|
||||
"SVGColor": false,
|
||||
"SVGColorProfileElement": false,
|
||||
"SVGColorProfileRule": false,
|
||||
"SVGComponentTransferFunctionElement": false,
|
||||
"SVGCursorElement": false,
|
||||
"SVGDefsElement": false,
|
||||
"SVGDescElement": false,
|
||||
"SVGDocument": false,
|
||||
"SVGElement": false,
|
||||
"SVGElementInstance": false,
|
||||
"SVGElementInstanceList": false,
|
||||
"SVGEllipseElement": false,
|
||||
"SVGExternalResourcesRequired": false,
|
||||
"SVGFEBlendElement": false,
|
||||
"SVGFEColorMatrixElement": false,
|
||||
"SVGFEComponentTransferElement": false,
|
||||
"SVGFECompositeElement": false,
|
||||
"SVGFEConvolveMatrixElement": false,
|
||||
"SVGFEDiffuseLightingElement": false,
|
||||
"SVGFEDisplacementMapElement": false,
|
||||
"SVGFEDistantLightElement": false,
|
||||
"SVGFEFloodElement": false,
|
||||
"SVGFEFuncAElement": false,
|
||||
"SVGFEFuncBElement": false,
|
||||
"SVGFEFuncGElement": false,
|
||||
"SVGFEFuncRElement": false,
|
||||
"SVGFEGaussianBlurElement": false,
|
||||
"SVGFEImageElement": false,
|
||||
"SVGFEMergeElement": false,
|
||||
"SVGFEMergeNodeElement": false,
|
||||
"SVGFEMorphologyElement": false,
|
||||
"SVGFEOffsetElement": false,
|
||||
"SVGFEPointLightElement": false,
|
||||
"SVGFESpecularLightingElement": false,
|
||||
"SVGFESpotLightElement": false,
|
||||
"SVGFETileElement": false,
|
||||
"SVGFETurbulenceElement": false,
|
||||
"SVGFilterElement": false,
|
||||
"SVGFilterPrimitiveStandardAttributes": false,
|
||||
"SVGFitToViewBox": false,
|
||||
"SVGFontElement": false,
|
||||
"SVGFontFaceElement": false,
|
||||
"SVGFontFaceFormatElement": false,
|
||||
"SVGFontFaceNameElement": false,
|
||||
"SVGFontFaceSrcElement": false,
|
||||
"SVGFontFaceUriElement": false,
|
||||
"SVGForeignObjectElement": false,
|
||||
"SVGGElement": false,
|
||||
"SVGGlyphElement": false,
|
||||
"SVGGlyphRefElement": false,
|
||||
"SVGGradientElement": false,
|
||||
"SVGHKernElement": false,
|
||||
"SVGICCColor": false,
|
||||
"SVGImageElement": false,
|
||||
"SVGLangSpace": false,
|
||||
"SVGLength": false,
|
||||
"SVGLengthList": false,
|
||||
"SVGLineElement": false,
|
||||
"SVGLinearGradientElement": false,
|
||||
"SVGLocatable": false,
|
||||
"SVGMPathElement": false,
|
||||
"SVGMarkerElement": false,
|
||||
"SVGMaskElement": false,
|
||||
"SVGMatrix": false,
|
||||
"SVGMetadataElement": false,
|
||||
"SVGMissingGlyphElement": false,
|
||||
"SVGNumber": false,
|
||||
"SVGNumberList": false,
|
||||
"SVGPaint": false,
|
||||
"SVGPathElement": false,
|
||||
"SVGPathSeg": false,
|
||||
"SVGPathSegArcAbs": false,
|
||||
"SVGPathSegArcRel": false,
|
||||
"SVGPathSegClosePath": false,
|
||||
"SVGPathSegCurvetoCubicAbs": false,
|
||||
"SVGPathSegCurvetoCubicRel": false,
|
||||
"SVGPathSegCurvetoCubicSmoothAbs": false,
|
||||
"SVGPathSegCurvetoCubicSmoothRel": false,
|
||||
"SVGPathSegCurvetoQuadraticAbs": false,
|
||||
"SVGPathSegCurvetoQuadraticRel": false,
|
||||
"SVGPathSegCurvetoQuadraticSmoothAbs": false,
|
||||
"SVGPathSegCurvetoQuadraticSmoothRel": false,
|
||||
"SVGPathSegLinetoAbs": false,
|
||||
"SVGPathSegLinetoHorizontalAbs": false,
|
||||
"SVGPathSegLinetoHorizontalRel": false,
|
||||
"SVGPathSegLinetoRel": false,
|
||||
"SVGPathSegLinetoVerticalAbs": false,
|
||||
"SVGPathSegLinetoVerticalRel": false,
|
||||
"SVGPathSegList": false,
|
||||
"SVGPathSegMovetoAbs": false,
|
||||
"SVGPathSegMovetoRel": false,
|
||||
"SVGPatternElement": false,
|
||||
"SVGPoint": false,
|
||||
"SVGPointList": false,
|
||||
"SVGPolygonElement": false,
|
||||
"SVGPolylineElement": false,
|
||||
"SVGPreserveAspectRatio": false,
|
||||
"SVGRadialGradientElement": false,
|
||||
"SVGRect": false,
|
||||
"SVGRectElement": false,
|
||||
"SVGRenderingIntent": false,
|
||||
"SVGSVGElement": false,
|
||||
"SVGScriptElement": false,
|
||||
"SVGSetElement": false,
|
||||
"SVGStopElement": false,
|
||||
"SVGStringList": false,
|
||||
"SVGStylable": false,
|
||||
"SVGStyleElement": false,
|
||||
"SVGSwitchElement": false,
|
||||
"SVGSymbolElement": false,
|
||||
"SVGTRefElement": false,
|
||||
"SVGTSpanElement": false,
|
||||
"SVGTests": false,
|
||||
"SVGTextContentElement": false,
|
||||
"SVGTextElement": false,
|
||||
"SVGTextPathElement": false,
|
||||
"SVGTextPositioningElement": false,
|
||||
"SVGTitleElement": false,
|
||||
"SVGTransform": false,
|
||||
"SVGTransformList": false,
|
||||
"SVGTransformable": false,
|
||||
"SVGURIReference": false,
|
||||
"SVGUnitTypes": false,
|
||||
"SVGUseElement": false,
|
||||
"SVGVKernElement": false,
|
||||
"SVGViewElement": false,
|
||||
"SVGViewSpec": false,
|
||||
"SVGZoomAndPan": false,
|
||||
"Text": false,
|
||||
"TextDecoder": false,
|
||||
"TextEncoder": false,
|
||||
"TimeEvent": false,
|
||||
"top": false,
|
||||
"URL": false,
|
||||
"WebGLActiveInfo": false,
|
||||
"WebGLBuffer": false,
|
||||
"WebGLContextEvent": false,
|
||||
"WebGLFramebuffer": false,
|
||||
"WebGLProgram": false,
|
||||
"WebGLRenderbuffer": false,
|
||||
"WebGLRenderingContext": false,
|
||||
"WebGLShader": false,
|
||||
"WebGLShaderPrecisionFormat": false,
|
||||
"WebGLTexture": false,
|
||||
"WebGLUniformLocation": false,
|
||||
"WebSocket": false,
|
||||
"window": false,
|
||||
"Worker": false,
|
||||
"XDomainRequest": false,
|
||||
"XMLHttpRequest": false,
|
||||
"XMLSerializer": false,
|
||||
"XPathEvaluator": false,
|
||||
"XPathException": false,
|
||||
"XPathExpression": false,
|
||||
"XPathNamespace": false,
|
||||
"XPathNSResolver": false,
|
||||
"XPathResult": false
|
||||
}
|
||||
}
|
3
src/kibana/.jshintrc
Normal file
3
src/kibana/.jshintrc
Normal file
|
@ -0,0 +1,3 @@
|
|||
{
|
||||
"extends": "../../.jshintrc.browser"
|
||||
}
|
|
@ -17,7 +17,7 @@ define(function (require) {
|
|||
// Set the bucket name, and use the converter to format the field if
|
||||
// the field exists.
|
||||
var bucket = item.name;
|
||||
if (col) {
|
||||
if (col) {
|
||||
bucket = col.fieldFormatter()(bucket);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
define(function (require) {
|
||||
var errors = require('errors');
|
||||
var _ = require('lodash');
|
||||
|
||||
|
||||
require('services/es');
|
||||
require('services/promises');
|
||||
require('components/index_patterns/index_patterns');
|
||||
|
|
|
@ -31,15 +31,23 @@ define(function (require) {
|
|||
doc._storeVersion(resp._version);
|
||||
doc.id(resp._id);
|
||||
|
||||
var docFetchProm;
|
||||
if (method !== 'index') {
|
||||
docFetchProm = doc.fetch();
|
||||
} else {
|
||||
// we already know what the response will be
|
||||
docFetchProm = Promise.resolve({
|
||||
_id: resp._id,
|
||||
_index: params.index,
|
||||
_source: body,
|
||||
_type: params.type,
|
||||
_version: doc._getVersion(),
|
||||
found: true
|
||||
});
|
||||
}
|
||||
|
||||
// notify pending request for this same document that we have updates
|
||||
Promise.cast(method !== 'index' ? doc.fetch() : {
|
||||
_id: resp._id,
|
||||
_index: params.index,
|
||||
_source: body,
|
||||
_type: params.type,
|
||||
_version: doc._getVersion(),
|
||||
found: true
|
||||
}).then(function (fetchResp) {
|
||||
docFetchProm.then(function (fetchResp) {
|
||||
// use the key to compair sources
|
||||
var key = doc._versionKey();
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
define(function (require) {
|
||||
'use strict';
|
||||
var _ = require('lodash');
|
||||
var module = require('modules').get('kibana');
|
||||
var template = require('text!components/filter_bar/filter_bar.html');
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
return function mapAndFlattenFiltersProvider(Private, Promise) {
|
||||
var mapFilter = Private(require('components/filter_bar/lib/mapFilter'));
|
||||
return function (filters) {
|
||||
filters = _(filters)
|
||||
.filter(function (filter) {
|
||||
return filter;
|
||||
})
|
||||
.flatten(true)
|
||||
.value();
|
||||
return function mapAndFlattenFiltersProvider(Private, Promise) {
|
||||
var mapFilter = Private(require('components/filter_bar/lib/mapFilter'));
|
||||
return function (filters) {
|
||||
filters = _(filters)
|
||||
.filter(function (filter) {
|
||||
return filter;
|
||||
})
|
||||
.flatten(true)
|
||||
.value();
|
||||
|
||||
return Promise.map(filters, mapFilter);
|
||||
};
|
||||
};
|
||||
return Promise.map(filters, mapFilter);
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -2,14 +2,14 @@ define(function (require) {
|
|||
return function mapDefaultProvider(Promise) {
|
||||
var angular = require('angular');
|
||||
|
||||
return function (filter) {
|
||||
var key, value;
|
||||
if (filter.query) {
|
||||
key = 'query';
|
||||
return function (filter) {
|
||||
var key, value;
|
||||
if (filter.query) {
|
||||
key = 'query';
|
||||
value = angular.toJson(filter.query);
|
||||
return Promise.resolve({ key: key, value: value });
|
||||
}
|
||||
return Promise.reject(filter);
|
||||
};
|
||||
return Promise.resolve({ key: key, value: value });
|
||||
}
|
||||
return Promise.reject(filter);
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
define(function (require) {
|
||||
return function mapExistsProvider(Promise) {
|
||||
return function (filter) {
|
||||
var key, value;
|
||||
if (filter.exists) {
|
||||
key = 'exists';
|
||||
value = filter.exists.field;
|
||||
return Promise.resolve({ key: key, value: value });
|
||||
}
|
||||
return Promise.reject(filter);
|
||||
};
|
||||
};
|
||||
return function mapExistsProvider(Promise) {
|
||||
return function (filter) {
|
||||
var key, value;
|
||||
if (filter.exists) {
|
||||
key = 'exists';
|
||||
value = filter.exists.field;
|
||||
return Promise.resolve({ key: key, value: value });
|
||||
}
|
||||
return Promise.reject(filter);
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
return function mapFlattenAndWrapFilters(Private) {
|
||||
var mapAndFlattenFilters = Private(require('components/filter_bar/lib/mapAndFlattenFilters'));
|
||||
return function (filters) {
|
||||
return mapAndFlattenFilters(filters).then(function (filters) {
|
||||
return _.map(filters, function (filter) {
|
||||
return function mapFlattenAndWrapFilters(Private) {
|
||||
var mapAndFlattenFilters = Private(require('components/filter_bar/lib/mapAndFlattenFilters'));
|
||||
return function (filters) {
|
||||
return mapAndFlattenFilters(filters).then(function (filters) {
|
||||
return _.map(filters, function (filter) {
|
||||
filter.meta = filter.meta || {};
|
||||
filter.meta.apply = true;
|
||||
return filter;
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
define(function (require) {
|
||||
return function mapMissingProvider(Promise) {
|
||||
return function (filter) {
|
||||
var key, value;
|
||||
if (filter.missing) {
|
||||
key = 'missing';
|
||||
value = filter.missing.field;
|
||||
return Promise.resolve({ key: key, value: value });
|
||||
}
|
||||
return Promise.reject(filter);
|
||||
};
|
||||
};
|
||||
return function mapMissingProvider(Promise) {
|
||||
return function (filter) {
|
||||
var key, value;
|
||||
if (filter.missing) {
|
||||
key = 'missing';
|
||||
value = filter.missing.field;
|
||||
return Promise.resolve({ key: key, value: value });
|
||||
}
|
||||
return Promise.reject(filter);
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
define(function (require) {
|
||||
return function mapQueryStringProvider(Promise) {
|
||||
return function (filter) {
|
||||
var key, value;
|
||||
if (filter.query && filter.query.query_string) {
|
||||
key = 'query';
|
||||
value = filter.query.query_string.query;
|
||||
return Promise.resolve({ key: key, value: value });
|
||||
}
|
||||
return Promise.reject(filter);
|
||||
};
|
||||
};
|
||||
return function mapQueryStringProvider(Promise) {
|
||||
return function (filter) {
|
||||
var key, value;
|
||||
if (filter.query && filter.query.query_string) {
|
||||
key = 'query';
|
||||
value = filter.query.query_string.query;
|
||||
return Promise.resolve({ key: key, value: value });
|
||||
}
|
||||
return Promise.reject(filter);
|
||||
};
|
||||
};
|
||||
});
|
||||
|
|
|
@ -1,32 +1,30 @@
|
|||
/* jshint ignore:start */
|
||||
/* markdown
|
||||
/**
|
||||
|
||||
### Formatting a value
|
||||
To format a response value, you need to get ahold of the field list, which is usually available at `indexPattern.fields`. Each field object has a `format` property*, which is an object detailed in [_field_formats.js](https://github.com/elastic/kibana4/blob/master/src/kibana/components/index_patterns/_field_formats.js).
|
||||
### Formatting a value
|
||||
To format a response value, you need to get ahold of the field list, which is usually available at `indexPattern.fields`. Each field object has a `format` property*, which is an object detailed in [_field_formats.js](https://github.com/elastic/kibana4/blob/master/src/kibana/components/index_patterns/_field_formats.js).
|
||||
|
||||
Once you have the field that a response value came from, pass the value to `field.format.convert(value)` and a formatted string representation of the field will be returned.
|
||||
Once you have the field that a response value came from, pass the value to `field.format.convert(value)` and a formatted string representation of the field will be returned.
|
||||
|
||||
\* the `format` property on field object's is a non-enumerable getter, meaning that if you itterate/clone/stringify the field object the format property will not be present.
|
||||
\* the `format` property on field object's is a non-enumerable getter, meaning that if you itterate/clone/stringify the field object the format property will not be present.
|
||||
|
||||
### Changing a field's format
|
||||
### Changing a field's format
|
||||
|
||||
Currently only one field format exists, `"string"`, which just [flattens any value down to a string](https://github.com/elastic/kibana4/blob/master/src/kibana/components/index_patterns/_field_formats.js#L18-L24).
|
||||
Currently only one field format exists, `"string"`, which just [flattens any value down to a string](https://github.com/elastic/kibana4/blob/master/src/kibana/components/index_patterns/_field_formats.js#L18-L24).
|
||||
|
||||
To change the format for a specific field you can either change the default for a field type modify the [default format mapping here](https://github.com/elastic/kibana4/blob/master/src/kibana/components/index_patterns/_field_formats.js#L37-L46).
|
||||
To change the format for a specific field you can either change the default for a field type modify the [default format mapping here](https://github.com/elastic/kibana4/blob/master/src/kibana/components/index_patterns/_field_formats.js#L37-L46).
|
||||
|
||||
To change the format for a specific indexPattern's field, add the field and format name to `indexPattern.customFormats` object property.
|
||||
To change the format for a specific indexPattern's field, add the field and format name to `indexPattern.customFormats` object property.
|
||||
|
||||
```js
|
||||
$scope.onChangeFormat = function (field, format) {
|
||||
indexPattern.customFormats[field.name] = format.name;
|
||||
};
|
||||
```
|
||||
```js
|
||||
$scope.onChangeFormat = function (field, format) {
|
||||
indexPattern.customFormats[field.name] = format.name;
|
||||
};
|
||||
```
|
||||
|
||||
### Passing the formats to a chart
|
||||
Currently, the [histogram formatter](https://github.com/elastic/kibana4/blob/master/src/plugins/visualize/saved_visualizations/resp_converters/histogram.js) passes the formatting function as the `xAxisFormatter` and `yAxisFormatter` function.
|
||||
### Passing the formats to a chart
|
||||
Currently, the [histogram formatter](https://github.com/elastic/kibana4/blob/master/src/plugins/visualize/saved_visualizations/resp_converters/histogram.js) passes the formatting function as the `xAxisFormatter` and `yAxisFormatter` function.
|
||||
|
||||
*/
|
||||
/* jshint ignore:end */
|
||||
|
||||
define(function (require) {
|
||||
return function FieldFormattingService($rootScope, config) {
|
||||
|
|
|
@ -7,7 +7,7 @@ define(function (require) {
|
|||
var scriptFields = {};
|
||||
var fielddataFields = [];
|
||||
|
||||
fielddataFields = _.pluck(self.fields.byType['date'], 'name');
|
||||
fielddataFields = _.pluck(self.fields.byType.date, 'name');
|
||||
|
||||
_.each(self.getFields('scripted'), function (field) {
|
||||
scriptFields[field.name] = { script: field.script, lang: field.lang };
|
||||
|
|
|
@ -265,7 +265,7 @@ define(function (require) {
|
|||
var interval = this.getInterval();
|
||||
var rules = config.get('dateFormat:scaled');
|
||||
|
||||
for (var i = rules.length - 1; i >= 0; i --) {
|
||||
for (var i = rules.length - 1; i >= 0; i--) {
|
||||
var rule = rules[i];
|
||||
if (!rule[0] || interval >= moment.duration(rule[0])) {
|
||||
return rule[1];
|
||||
|
|
|
@ -169,7 +169,7 @@ define(function (require) {
|
|||
|
||||
// persist selection on enter, when not selecting from the list
|
||||
if (_.contains([keyMap.ENTER], keyCode)) {
|
||||
if (! self.active) {
|
||||
if (!self.active) {
|
||||
self.persistEntry();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
define(function (require) {
|
||||
var module = require('modules').get('kibana/vislib', ['kibana']);
|
||||
|
||||
|
||||
require('services/private');
|
||||
|
||||
module.service('d3', function () {
|
||||
|
|
|
@ -53,7 +53,7 @@ define(function (require) {
|
|||
var div = d3.select(el);
|
||||
var width = $(el).width();
|
||||
var height = $(el).height();
|
||||
|
||||
|
||||
self.validateWidthandHeight(width, height);
|
||||
|
||||
div.append('svg')
|
||||
|
|
|
@ -92,12 +92,12 @@ define(function (require) {
|
|||
var chart = new self.ChartClass(self, this, chartData);
|
||||
var enabledEvents;
|
||||
|
||||
/*
|
||||
* inside handler: if there are charts, bind events to charts
|
||||
* functionality: track in array that event is enabled
|
||||
* clean up event handlers every time it destroys the chart
|
||||
* rebind them every time it creates the charts
|
||||
*/
|
||||
/*
|
||||
* inside handler: if there are charts, bind events to charts
|
||||
* functionality: track in array that event is enabled
|
||||
* clean up event handlers every time it destroys the chart
|
||||
* rebind them every time it creates the charts
|
||||
*/
|
||||
if (chart.events.dispatch) {
|
||||
enabledEvents = self.vis.eventTypes.enabled;
|
||||
|
||||
|
|
|
@ -48,15 +48,20 @@ define(function (require) {
|
|||
tmpScope.$destroy();
|
||||
tmpScope = $scope.$new();
|
||||
|
||||
element.html(!tmpl ? '' : $compile('' +
|
||||
'<div class="config" ng-show="configTemplate">' +
|
||||
wrapTmpl(tmpl) +
|
||||
' <div class="config-close remove" ng-click="close()">' +
|
||||
' <i class="fa fa-chevron-up"></i>' +
|
||||
' </div>' +
|
||||
'</div>' +
|
||||
''
|
||||
)(tmpScope));
|
||||
var html = '';
|
||||
if (tmpl) {
|
||||
html = $compile('' +
|
||||
'<div class="config" ng-show="configTemplate">' +
|
||||
wrapTmpl(tmpl) +
|
||||
' <div class="config-close remove" ng-click="close()">' +
|
||||
' <i class="fa fa-chevron-up"></i>' +
|
||||
' </div>' +
|
||||
'</div>' +
|
||||
''
|
||||
)(tmpScope);
|
||||
}
|
||||
|
||||
element.html(html);
|
||||
};
|
||||
|
||||
$scope.$watch('configSubmit', render);
|
||||
|
|
|
@ -9,7 +9,7 @@ define(function (require) {
|
|||
restrict: 'A',
|
||||
require: 'ngModel',
|
||||
link: function ($scope, $elem, attrs, ngModel) {
|
||||
|
||||
|
||||
var format = 'YYYY-MM-DD HH:mm:ss.SSS';
|
||||
|
||||
$elem.after('<div class="input-datetime-format">' + format + '</div>');
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
define(function (require) {
|
||||
var moment = require('moment');
|
||||
var moment = require('moment');
|
||||
var _ = require('lodash');
|
||||
|
||||
require('modules')
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
define(function (require) {
|
||||
var module = require('modules').get('app/dashboard');
|
||||
var _ = require('lodash');
|
||||
// bring in the factory
|
||||
// bring in the factory
|
||||
require('plugins/dashboard/services/_saved_dashboard');
|
||||
|
||||
|
||||
|
@ -37,7 +37,9 @@ define(function (require) {
|
|||
|
||||
this.find = function (searchString) {
|
||||
var self = this;
|
||||
var body = searchString ? {
|
||||
var body;
|
||||
if (searchString) {
|
||||
body = {
|
||||
query: {
|
||||
simple_query_string: {
|
||||
query: searchString + '*',
|
||||
|
@ -45,7 +47,11 @@ define(function (require) {
|
|||
default_operator: 'AND'
|
||||
}
|
||||
}
|
||||
}: { query: {match_all: {}}};
|
||||
};
|
||||
} else {
|
||||
body = { query: {match_all: {}}};
|
||||
}
|
||||
|
||||
return es.search({
|
||||
index: config.file.kibana_index,
|
||||
type: 'dashboard',
|
||||
|
|
|
@ -23,9 +23,9 @@ define(function (require) {
|
|||
return { error: 'Analysis is not available for geo fields.' };
|
||||
}
|
||||
|
||||
var allValues = getFieldValues(params.data, params.field),
|
||||
exists = 0,
|
||||
counts;
|
||||
var allValues = getFieldValues(params.data, params.field);
|
||||
var exists = 0;
|
||||
var counts;
|
||||
|
||||
var missing = _countMissing(allValues);
|
||||
|
||||
|
@ -68,13 +68,11 @@ define(function (require) {
|
|||
|
||||
|
||||
var _groupValues = function (allValues, params) {
|
||||
var groups = {},
|
||||
value, k;
|
||||
|
||||
for (var i = 0; i < allValues.length; ++i) {
|
||||
|
||||
value = allValues[i];
|
||||
var groups = {};
|
||||
var value;
|
||||
var k;
|
||||
|
||||
allValues.forEach(function (value) {
|
||||
if (_.isObject(value) && !_.isArray(value)) {
|
||||
throw new Error('Analysis is not available for object fields');
|
||||
}
|
||||
|
@ -85,7 +83,6 @@ define(function (require) {
|
|||
k = value == null ? undefined : [value];
|
||||
}
|
||||
|
||||
/* jshint -W083 */
|
||||
_.each(k, function (key) {
|
||||
if (_.has(groups, key)) {
|
||||
groups[key].count++;
|
||||
|
@ -96,7 +93,8 @@ define(function (require) {
|
|||
};
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
return groups;
|
||||
};
|
||||
|
||||
|
|
|
@ -41,7 +41,9 @@ define(function (require) {
|
|||
|
||||
this.find = function (searchString) {
|
||||
var self = this;
|
||||
var body = searchString ? {
|
||||
var body;
|
||||
if (searchString) {
|
||||
body = {
|
||||
query: {
|
||||
simple_query_string: {
|
||||
query: searchString + '*',
|
||||
|
@ -49,7 +51,11 @@ define(function (require) {
|
|||
default_operator: 'AND'
|
||||
}
|
||||
}
|
||||
}: { query: {match_all: {}}};
|
||||
};
|
||||
} else {
|
||||
body = { query: {match_all: {}}};
|
||||
}
|
||||
|
||||
return es.search({
|
||||
index: configFile.kibana_index,
|
||||
type: 'search',
|
||||
|
|
|
@ -99,7 +99,7 @@ define(function (require) {
|
|||
delete index.nameInterval;
|
||||
delete index.timeField;
|
||||
} else {
|
||||
index.nameInterval = index.nameInterval || intervals.byName['days'];
|
||||
index.nameInterval = index.nameInterval || intervals.byName.days;
|
||||
index.name = index.name || getPatternDefault(index.nameInterval);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -15,7 +15,7 @@ define(function (require) {
|
|||
__year: 'year'
|
||||
};
|
||||
|
||||
_.each(indexPattern.fields.byType['date'], function (field) {
|
||||
_.each(indexPattern.fields.byType.date, function (field) {
|
||||
if (field.indexed) {
|
||||
_.each(scripts, function (value, key) {
|
||||
dateScripts[field.name + '.' + key] = 'doc["' + field.name + '"].date.' + value;
|
||||
|
|
|
@ -35,7 +35,7 @@ define(function (require) {
|
|||
* @returns {array}
|
||||
*/
|
||||
var createField = function (memo, val, key, collection, parents) {
|
||||
if (_.isArray(parents)) {
|
||||
if (_.isArray(parents)) {
|
||||
parents.push(key);
|
||||
} else {
|
||||
parents = [key];
|
||||
|
|
|
@ -36,7 +36,9 @@ define(function (require) {
|
|||
|
||||
this.find = function (searchString) {
|
||||
var self = this;
|
||||
var body = searchString ? {
|
||||
var body;
|
||||
if (searchString) {
|
||||
body = {
|
||||
query: {
|
||||
simple_query_string: {
|
||||
query: searchString + '*',
|
||||
|
@ -44,7 +46,11 @@ define(function (require) {
|
|||
default_operator: 'AND'
|
||||
}
|
||||
}
|
||||
}: { query: {match_all: {}}};
|
||||
};
|
||||
} else {
|
||||
body = { query: {match_all: {}}};
|
||||
}
|
||||
|
||||
return es.search({
|
||||
index: config.file.kibana_index,
|
||||
type: 'visualization',
|
||||
|
|
|
@ -160,7 +160,7 @@ define(function (require) {
|
|||
chunk: function (arr, count) {
|
||||
var size = Math.ceil(arr.length / count);
|
||||
var chunks = new Array(count);
|
||||
for (var i = 0; i < count; i ++) {
|
||||
for (var i = 0; i < count; i++) {
|
||||
var start = i * size;
|
||||
chunks[i] = arr.slice(start, start + size);
|
||||
}
|
||||
|
|
|
@ -34,7 +34,9 @@ define(function (require) {
|
|||
*/
|
||||
repeat: function (str, times) {
|
||||
var out = '';
|
||||
for (var i = 0; i < times; i++) out += str;
|
||||
for (var i = 0; i < times; i++) {
|
||||
out += str;
|
||||
}
|
||||
return out;
|
||||
},
|
||||
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
define(function (require) {
|
||||
var moment = require('moment');
|
||||
|
||||
|
||||
return {
|
||||
toString: function (range, format) {
|
||||
if (!range.from) {
|
||||
|
@ -24,4 +24,4 @@ define(function (require) {
|
|||
throw new Error('Error attempting to parse date range: ' + rangeString);
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -8,16 +8,17 @@ define(function (require) {
|
|||
});
|
||||
var unitsDesc = unitsAsc.reverse();
|
||||
|
||||
/* This is a simplified version of elasticsearch's date parser */
|
||||
/* This is a simplified version of elasticsearch's date parser */
|
||||
function parse(text, roundUp) {
|
||||
if (!text) return undefined;
|
||||
if (moment.isMoment(text)) return text;
|
||||
if (_.isDate(text)) return moment(text);
|
||||
|
||||
var time,
|
||||
mathString = '',
|
||||
index,
|
||||
parseString;
|
||||
var time;
|
||||
var mathString = '';
|
||||
var index;
|
||||
var parseString;
|
||||
|
||||
if (text.substring(0, 3) === 'now') {
|
||||
time = moment();
|
||||
mathString = text.substring('now'.length);
|
||||
|
@ -45,10 +46,11 @@ define(function (require) {
|
|||
var dateTime = time;
|
||||
|
||||
for (var i = 0; i < mathString.length;) {
|
||||
var c = mathString.charAt(i++),
|
||||
type,
|
||||
num,
|
||||
unit;
|
||||
var c = mathString.charAt(i++);
|
||||
var type;
|
||||
var num;
|
||||
var unit;
|
||||
|
||||
if (c === '/') {
|
||||
type = 0;
|
||||
} else if (c === '+') {
|
||||
|
|
|
@ -6,7 +6,10 @@ define(function (require) {
|
|||
return function parseInterval(interval) {
|
||||
// Assume interval is in the form (value)(unit), such as "1h"
|
||||
var regex = new RegExp('^([0-9\\.]*)\\s*(' + datemath.units.join('|') + ')$');
|
||||
var matches = regex.exec(interval), value, unit;
|
||||
var matches = regex.exec(interval);
|
||||
var value;
|
||||
var unit;
|
||||
|
||||
if (matches && matches.length) {
|
||||
value = parseFloat(matches[1]) || 1;
|
||||
unit = matches[2];
|
||||
|
@ -30,4 +33,4 @@ define(function (require) {
|
|||
return null;
|
||||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
|
|
|
@ -38,7 +38,10 @@ define(function (require) {
|
|||
* @returns {Object.<string,boolean|Array>}
|
||||
*/
|
||||
qs.decode = function (keyValue) {
|
||||
var obj = {}, key_value, key;
|
||||
var obj = {};
|
||||
var key_value;
|
||||
var key;
|
||||
|
||||
(keyValue || '').split('&').forEach(function (keyValue) {
|
||||
if (keyValue) {
|
||||
key_value = keyValue.split('=');
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
define(function () {
|
||||
var rison = {};
|
||||
/* jshint ignore:start */
|
||||
/* jscs: disable */
|
||||
//////////////////////////////////////////////////
|
||||
//
|
||||
// the stringifier is based on
|
||||
|
@ -493,6 +494,7 @@ define(function () {
|
|||
this.index = i;
|
||||
return c;
|
||||
};
|
||||
/* jscs: enable */
|
||||
/* jshint ignore:end */
|
||||
return rison;
|
||||
});
|
||||
|
|
|
@ -41,7 +41,7 @@ define(function (require) {
|
|||
var defer = Promise.defer();
|
||||
userWork.push(defer);
|
||||
return defer.promise.then(function () {
|
||||
return $injector[angular.isString(expr) ? 'get': 'invoke'](expr);
|
||||
return $injector[angular.isString(expr) ? 'get' : 'invoke'](expr);
|
||||
});
|
||||
};
|
||||
});
|
||||
|
|
|
@ -32,8 +32,8 @@ define(function (require) {
|
|||
*/
|
||||
var is = function (equation, versions) {
|
||||
var _versions = sortVersions(versions);
|
||||
var _v = equation,
|
||||
_cf;
|
||||
var _v = equation;
|
||||
var _cf;
|
||||
|
||||
if (_v.charAt(0) === '>') {
|
||||
_cf = _v.charAt(1) === '=' ? gte(_v.slice(2), _versions) : gt(_v.slice(1), _versions);
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
{
|
||||
"extends": "../.jshintrc",
|
||||
"node": true
|
||||
}
|
||||
|
||||
"extends": "../../.jshintrc.node"
|
||||
}
|
|
@ -1,5 +1,3 @@
|
|||
/* jshint node:true */
|
||||
|
||||
var express = require('express');
|
||||
var instrumentationMiddleware = require('./_instrumentation');
|
||||
var amdRapperMiddleware = require('./_amd_rapper');
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
{
|
||||
"extends": "../.jshintrc",
|
||||
"node": true
|
||||
"extends": "../.jshintrc.node"
|
||||
}
|
20
tasks/config/jscs.js
Normal file
20
tasks/config/jscs.js
Normal file
|
@ -0,0 +1,20 @@
|
|||
module.exports = function (grunt) {
|
||||
return {
|
||||
options: {
|
||||
config: '.jscsrc'
|
||||
},
|
||||
|
||||
// just lint the source dir
|
||||
source: {
|
||||
src: '<%= lintThese %>',
|
||||
},
|
||||
|
||||
// fix any linting errors that can be fixed
|
||||
fixup: {
|
||||
src: '<%= lintThese %>',
|
||||
options: {
|
||||
fix: true
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -3,14 +3,7 @@ module.exports = function (grunt) {
|
|||
// just lint the source dir
|
||||
source: {
|
||||
files: {
|
||||
src: [
|
||||
'Gruntfile.js',
|
||||
'<%= root %>/tasks/**/*.js',
|
||||
'<%= src %>/kibana/*.js',
|
||||
'<%= src %>/server/*.js',
|
||||
'<%= src %>/kibana/{components,directives,factories,filters,plugins,registry,services,utils}/**/*.js',
|
||||
'<%= unitTestDir %>/**/*.js'
|
||||
]
|
||||
src: '<%= lintThese %>'
|
||||
}
|
||||
},
|
||||
options: {
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// Lint and build CSS
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('default', ['jshint:source', 'less']);
|
||||
grunt.registerTask('default', ['jshint:source', 'jscs:source', 'less']);
|
||||
};
|
|
@ -1,26 +0,0 @@
|
|||
var path = require('path');
|
||||
var workingPath = path.resolve(__dirname, '..');
|
||||
var simplegit = require('simple-git')(workingPath);
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('hintStagedFiles', 'JSHint staged filed', function () {
|
||||
grunt.log.debug('git working path', workingPath);
|
||||
|
||||
var done = this.async();
|
||||
var files = simplegit.diff('--name-only --cached', function (err, files) {
|
||||
// match these patterns
|
||||
var patterns = grunt.config.get('jshint.source.files.src');
|
||||
files = files.split('\n').filter(Boolean).map(function (file) {
|
||||
return path.join(workingPath, file);
|
||||
});
|
||||
|
||||
files = grunt.file.match(patterns, files);
|
||||
grunt.log.debug(files);
|
||||
|
||||
grunt.config.set('jshint.staged.files.src', files);
|
||||
|
||||
grunt.task.run(['jshint:staged']);
|
||||
done();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
34
tasks/lintStagedFiles.js
Normal file
34
tasks/lintStagedFiles.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
var resolve = require('path').resolve;
|
||||
var root = resolve(__dirname, '..');
|
||||
var simpleGit = require('simple-git')(root);
|
||||
var diff = require('bluebird').promisify(simpleGit.diff, simpleGit);
|
||||
|
||||
module.exports = function (grunt) {
|
||||
|
||||
grunt.registerTask(
|
||||
'lintStagedFiles',
|
||||
'Run staged files through JSHint/JSCS',
|
||||
function () {
|
||||
|
||||
diff('--name-only --cached')
|
||||
.then(function (files) {
|
||||
// match these patterns
|
||||
var patterns = grunt.config.get('lintThese');
|
||||
files = files.split('\n').filter(Boolean).map(function (file) {
|
||||
return resolve(root, file);
|
||||
});
|
||||
|
||||
files = grunt.file.match(patterns, files);
|
||||
grunt.log.debug(files);
|
||||
|
||||
grunt.config.set('jshint.staged.files.src', files);
|
||||
grunt.config.set('jscs.staged.files.src', files);
|
||||
|
||||
grunt.task.run(['jshint:staged', 'jscs:staged']);
|
||||
})
|
||||
.nodeify(this.async());
|
||||
|
||||
}
|
||||
);
|
||||
};
|
||||
|
|
@ -7,8 +7,8 @@ module.exports = function (grunt) {
|
|||
'normalize.js'
|
||||
].forEach(function (dep) {
|
||||
grunt.file.copy(
|
||||
join(grunt.config.get('bowerComponentsDir'), 'require-css', dep),
|
||||
join(grunt.config.get('build'), 'src', dep)
|
||||
join(grunt.config.get('bowerComponentsDir'), 'require-css', dep),
|
||||
join(grunt.config.get('build'), 'src', dep)
|
||||
);
|
||||
});
|
||||
});
|
||||
|
|
|
@ -25,7 +25,8 @@ module.exports = function (grunt) {
|
|||
}
|
||||
|
||||
var tasks = [
|
||||
'jshint',
|
||||
'jshint:source',
|
||||
'jscs:source',
|
||||
'maybe_start_kibana',
|
||||
'jade',
|
||||
'less:build'
|
||||
|
|
|
@ -29,7 +29,7 @@ module.exports = function (cmd, args, cwd, silent) {
|
|||
.pipe(estream.split())
|
||||
.pipe(
|
||||
estream.map(function (line, cb) {
|
||||
if (!line) { empty ++; if (empty > maxEmpty) return; }
|
||||
if (!line) { empty++; if (empty > maxEmpty) return; }
|
||||
else empty = 0;
|
||||
|
||||
buffer += line + '\n';
|
||||
|
|
344
test/.jshintrc
344
test/.jshintrc
|
@ -1,344 +1,12 @@
|
|||
{
|
||||
"extends": "../.jshintrc",
|
||||
|
||||
"browser": false, // handled by globals list below
|
||||
"node": false,
|
||||
|
||||
"extends": "../.jshintrc.browser",
|
||||
"mocha": true,
|
||||
"globals": {
|
||||
// mocha
|
||||
"module": false,
|
||||
"inject": false,
|
||||
"console": false,
|
||||
"describe": true,
|
||||
"it": true,
|
||||
"beforeEach": true,
|
||||
"afterEach": true,
|
||||
"before": true,
|
||||
"after": true,
|
||||
// expect.js
|
||||
"expect": true,
|
||||
|
||||
// require.js
|
||||
"define": true,
|
||||
"require": true,
|
||||
|
||||
// standard "browser" env, modified slightly
|
||||
"Audio": false,
|
||||
"Blob": false,
|
||||
"addEventListener": false,
|
||||
"applicationCache": false,
|
||||
"atob": false,
|
||||
"blur": false,
|
||||
"btoa": false,
|
||||
"cancelAnimationFrame": false,
|
||||
"CanvasGradient": false,
|
||||
"CanvasPattern": false,
|
||||
"CanvasRenderingContext2D": false,
|
||||
"CSS": false,
|
||||
"clearInterval": false,
|
||||
"clearTimeout": false,
|
||||
"close": false,
|
||||
"closed": false,
|
||||
"Comment": false,
|
||||
"console": true,
|
||||
"CustomEvent": false,
|
||||
"DOMParser": false,
|
||||
"defaultStatus": false,
|
||||
"Document": false,
|
||||
"document": false,
|
||||
"DocumentFragment": false,
|
||||
"Element": false,
|
||||
"ElementTimeControl": false,
|
||||
"Event": false,
|
||||
// "event": false,
|
||||
"FileReader": false,
|
||||
"FormData": false,
|
||||
"focus": false,
|
||||
"frames": false,
|
||||
"getComputedStyle": false,
|
||||
"HTMLElement": false,
|
||||
"HTMLAnchorElement": false,
|
||||
"HTMLBaseElement": false,
|
||||
"HTMLBlockquoteElement": false,
|
||||
"HTMLBodyElement": false,
|
||||
"HTMLBRElement": false,
|
||||
"HTMLButtonElement": false,
|
||||
"HTMLCanvasElement": false,
|
||||
"HTMLDirectoryElement": false,
|
||||
"HTMLDivElement": false,
|
||||
"HTMLDListElement": false,
|
||||
"HTMLFieldSetElement": false,
|
||||
"HTMLFontElement": false,
|
||||
"HTMLFormElement": false,
|
||||
"HTMLFrameElement": false,
|
||||
"HTMLFrameSetElement": false,
|
||||
"HTMLHeadElement": false,
|
||||
"HTMLHeadingElement": false,
|
||||
"HTMLHRElement": false,
|
||||
"HTMLHtmlElement": false,
|
||||
"HTMLIFrameElement": false,
|
||||
"HTMLImageElement": false,
|
||||
"HTMLInputElement": false,
|
||||
"HTMLIsIndexElement": false,
|
||||
"HTMLLabelElement": false,
|
||||
"HTMLLayerElement": false,
|
||||
"HTMLLegendElement": false,
|
||||
"HTMLLIElement": false,
|
||||
"HTMLLinkElement": false,
|
||||
"HTMLMapElement": false,
|
||||
"HTMLMenuElement": false,
|
||||
"HTMLMetaElement": false,
|
||||
"HTMLModElement": false,
|
||||
"HTMLObjectElement": false,
|
||||
"HTMLOListElement": false,
|
||||
"HTMLOptGroupElement": false,
|
||||
"HTMLOptionElement": false,
|
||||
"HTMLParagraphElement": false,
|
||||
"HTMLParamElement": false,
|
||||
"HTMLPreElement": false,
|
||||
"HTMLQuoteElement": false,
|
||||
"HTMLScriptElement": false,
|
||||
"HTMLSelectElement": false,
|
||||
"HTMLStyleElement": false,
|
||||
"HTMLTableCaptionElement": false,
|
||||
"HTMLTableCellElement": false,
|
||||
"HTMLTableColElement": false,
|
||||
"HTMLTableElement": false,
|
||||
"HTMLTableRowElement": false,
|
||||
"HTMLTableSectionElement": false,
|
||||
"HTMLTextAreaElement": false,
|
||||
"HTMLTitleElement": false,
|
||||
"HTMLUListElement": false,
|
||||
"HTMLVideoElement": false,
|
||||
"history": false,
|
||||
"Image": false,
|
||||
"Intl": false,
|
||||
"length": false,
|
||||
"localStorage": false,
|
||||
"location": false,
|
||||
"matchMedia": false,
|
||||
"MessageChannel": false,
|
||||
"MessageEvent": false,
|
||||
"MessagePort": false,
|
||||
"MouseEvent": false,
|
||||
"moveBy": false,
|
||||
"moveTo": false,
|
||||
"MutationObserver": false,
|
||||
"name": false,
|
||||
"Node": false,
|
||||
"NodeFilter": false,
|
||||
"NodeList": false,
|
||||
"Notification": false,
|
||||
"navigator": false,
|
||||
"onbeforeunload": true,
|
||||
"onblur": true,
|
||||
"onerror": true,
|
||||
"onfocus": true,
|
||||
"onload": true,
|
||||
"onresize": true,
|
||||
"onunload": true,
|
||||
"open": false,
|
||||
"openDatabase": false,
|
||||
"opener": false,
|
||||
"Option": false,
|
||||
"parent": false,
|
||||
"print": false,
|
||||
"Range": false,
|
||||
"requestAnimationFrame": false,
|
||||
"removeEventListener": false,
|
||||
"resizeBy": false,
|
||||
"resizeTo": false,
|
||||
"screen": false,
|
||||
"scroll": false,
|
||||
"scrollBy": false,
|
||||
"scrollTo": false,
|
||||
"sessionStorage": false,
|
||||
"setInterval": false,
|
||||
"setTimeout": false,
|
||||
"SharedWorker": false,
|
||||
"status": false,
|
||||
"SVGAElement": false,
|
||||
"SVGAltGlyphDefElement": false,
|
||||
"SVGAltGlyphElement": false,
|
||||
"SVGAltGlyphItemElement": false,
|
||||
"SVGAngle": false,
|
||||
"SVGAnimateColorElement": false,
|
||||
"SVGAnimateElement": false,
|
||||
"SVGAnimateMotionElement": false,
|
||||
"SVGAnimateTransformElement": false,
|
||||
"SVGAnimatedAngle": false,
|
||||
"SVGAnimatedBoolean": false,
|
||||
"SVGAnimatedEnumeration": false,
|
||||
"SVGAnimatedInteger": false,
|
||||
"SVGAnimatedLength": false,
|
||||
"SVGAnimatedLengthList": false,
|
||||
"SVGAnimatedNumber": false,
|
||||
"SVGAnimatedNumberList": false,
|
||||
"SVGAnimatedPathData": false,
|
||||
"SVGAnimatedPoints": false,
|
||||
"SVGAnimatedPreserveAspectRatio": false,
|
||||
"SVGAnimatedRect": false,
|
||||
"SVGAnimatedString": false,
|
||||
"SVGAnimatedTransformList": false,
|
||||
"SVGAnimationElement": false,
|
||||
"SVGCSSRule": false,
|
||||
"SVGCircleElement": false,
|
||||
"SVGClipPathElement": false,
|
||||
"SVGColor": false,
|
||||
"SVGColorProfileElement": false,
|
||||
"SVGColorProfileRule": false,
|
||||
"SVGComponentTransferFunctionElement": false,
|
||||
"SVGCursorElement": false,
|
||||
"SVGDefsElement": false,
|
||||
"SVGDescElement": false,
|
||||
"SVGDocument": false,
|
||||
"SVGElement": false,
|
||||
"SVGElementInstance": false,
|
||||
"SVGElementInstanceList": false,
|
||||
"SVGEllipseElement": false,
|
||||
"SVGExternalResourcesRequired": false,
|
||||
"SVGFEBlendElement": false,
|
||||
"SVGFEColorMatrixElement": false,
|
||||
"SVGFEComponentTransferElement": false,
|
||||
"SVGFECompositeElement": false,
|
||||
"SVGFEConvolveMatrixElement": false,
|
||||
"SVGFEDiffuseLightingElement": false,
|
||||
"SVGFEDisplacementMapElement": false,
|
||||
"SVGFEDistantLightElement": false,
|
||||
"SVGFEFloodElement": false,
|
||||
"SVGFEFuncAElement": false,
|
||||
"SVGFEFuncBElement": false,
|
||||
"SVGFEFuncGElement": false,
|
||||
"SVGFEFuncRElement": false,
|
||||
"SVGFEGaussianBlurElement": false,
|
||||
"SVGFEImageElement": false,
|
||||
"SVGFEMergeElement": false,
|
||||
"SVGFEMergeNodeElement": false,
|
||||
"SVGFEMorphologyElement": false,
|
||||
"SVGFEOffsetElement": false,
|
||||
"SVGFEPointLightElement": false,
|
||||
"SVGFESpecularLightingElement": false,
|
||||
"SVGFESpotLightElement": false,
|
||||
"SVGFETileElement": false,
|
||||
"SVGFETurbulenceElement": false,
|
||||
"SVGFilterElement": false,
|
||||
"SVGFilterPrimitiveStandardAttributes": false,
|
||||
"SVGFitToViewBox": false,
|
||||
"SVGFontElement": false,
|
||||
"SVGFontFaceElement": false,
|
||||
"SVGFontFaceFormatElement": false,
|
||||
"SVGFontFaceNameElement": false,
|
||||
"SVGFontFaceSrcElement": false,
|
||||
"SVGFontFaceUriElement": false,
|
||||
"SVGForeignObjectElement": false,
|
||||
"SVGGElement": false,
|
||||
"SVGGlyphElement": false,
|
||||
"SVGGlyphRefElement": false,
|
||||
"SVGGradientElement": false,
|
||||
"SVGHKernElement": false,
|
||||
"SVGICCColor": false,
|
||||
"SVGImageElement": false,
|
||||
"SVGLangSpace": false,
|
||||
"SVGLength": false,
|
||||
"SVGLengthList": false,
|
||||
"SVGLineElement": false,
|
||||
"SVGLinearGradientElement": false,
|
||||
"SVGLocatable": false,
|
||||
"SVGMPathElement": false,
|
||||
"SVGMarkerElement": false,
|
||||
"SVGMaskElement": false,
|
||||
"SVGMatrix": false,
|
||||
"SVGMetadataElement": false,
|
||||
"SVGMissingGlyphElement": false,
|
||||
"SVGNumber": false,
|
||||
"SVGNumberList": false,
|
||||
"SVGPaint": false,
|
||||
"SVGPathElement": false,
|
||||
"SVGPathSeg": false,
|
||||
"SVGPathSegArcAbs": false,
|
||||
"SVGPathSegArcRel": false,
|
||||
"SVGPathSegClosePath": false,
|
||||
"SVGPathSegCurvetoCubicAbs": false,
|
||||
"SVGPathSegCurvetoCubicRel": false,
|
||||
"SVGPathSegCurvetoCubicSmoothAbs": false,
|
||||
"SVGPathSegCurvetoCubicSmoothRel": false,
|
||||
"SVGPathSegCurvetoQuadraticAbs": false,
|
||||
"SVGPathSegCurvetoQuadraticRel": false,
|
||||
"SVGPathSegCurvetoQuadraticSmoothAbs": false,
|
||||
"SVGPathSegCurvetoQuadraticSmoothRel": false,
|
||||
"SVGPathSegLinetoAbs": false,
|
||||
"SVGPathSegLinetoHorizontalAbs": false,
|
||||
"SVGPathSegLinetoHorizontalRel": false,
|
||||
"SVGPathSegLinetoRel": false,
|
||||
"SVGPathSegLinetoVerticalAbs": false,
|
||||
"SVGPathSegLinetoVerticalRel": false,
|
||||
"SVGPathSegList": false,
|
||||
"SVGPathSegMovetoAbs": false,
|
||||
"SVGPathSegMovetoRel": false,
|
||||
"SVGPatternElement": false,
|
||||
"SVGPoint": false,
|
||||
"SVGPointList": false,
|
||||
"SVGPolygonElement": false,
|
||||
"SVGPolylineElement": false,
|
||||
"SVGPreserveAspectRatio": false,
|
||||
"SVGRadialGradientElement": false,
|
||||
"SVGRect": false,
|
||||
"SVGRectElement": false,
|
||||
"SVGRenderingIntent": false,
|
||||
"SVGSVGElement": false,
|
||||
"SVGScriptElement": false,
|
||||
"SVGSetElement": false,
|
||||
"SVGStopElement": false,
|
||||
"SVGStringList": false,
|
||||
"SVGStylable": false,
|
||||
"SVGStyleElement": false,
|
||||
"SVGSwitchElement": false,
|
||||
"SVGSymbolElement": false,
|
||||
"SVGTRefElement": false,
|
||||
"SVGTSpanElement": false,
|
||||
"SVGTests": false,
|
||||
"SVGTextContentElement": false,
|
||||
"SVGTextElement": false,
|
||||
"SVGTextPathElement": false,
|
||||
"SVGTextPositioningElement": false,
|
||||
"SVGTitleElement": false,
|
||||
"SVGTransform": false,
|
||||
"SVGTransformList": false,
|
||||
"SVGTransformable": false,
|
||||
"SVGURIReference": false,
|
||||
"SVGUnitTypes": false,
|
||||
"SVGUseElement": false,
|
||||
"SVGVKernElement": false,
|
||||
"SVGViewElement": false,
|
||||
"SVGViewSpec": false,
|
||||
"SVGZoomAndPan": false,
|
||||
"Text": false,
|
||||
"TextDecoder": false,
|
||||
"TextEncoder": false,
|
||||
"TimeEvent": false,
|
||||
"top": false,
|
||||
"URL": false,
|
||||
"WebGLActiveInfo": false,
|
||||
"WebGLBuffer": false,
|
||||
"WebGLContextEvent": false,
|
||||
"WebGLFramebuffer": false,
|
||||
"WebGLProgram": false,
|
||||
"WebGLRenderbuffer": false,
|
||||
"WebGLRenderingContext": false,
|
||||
"WebGLShader": false,
|
||||
"WebGLShaderPrecisionFormat": false,
|
||||
"WebGLTexture": false,
|
||||
"WebGLUniformLocation": false,
|
||||
"WebSocket": false,
|
||||
"window": false,
|
||||
"Worker": false,
|
||||
"XDomainRequest": false,
|
||||
"XMLHttpRequest": false,
|
||||
"XMLSerializer": false,
|
||||
"XPathEvaluator": false,
|
||||
"XPathException": false,
|
||||
"XPathExpression": false,
|
||||
"XPathNamespace": false,
|
||||
"XPathNSResolver": false,
|
||||
"XPathResult": false
|
||||
// angular mocks
|
||||
"module": true,
|
||||
"inject": true
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
define(function (require) {
|
||||
/* Extensions:
|
||||
|
||||
/*
|
||||
Extensions:
|
||||
gif: 5
|
||||
html: 8
|
||||
php: 5 (thus 5 with phpmemory fields)
|
||||
|
@ -14,6 +16,7 @@ define(function (require) {
|
|||
|
||||
All have the same index, ids are unique
|
||||
*/
|
||||
|
||||
return [
|
||||
{
|
||||
'_index': 'logstash-2014.09.09',
|
||||
|
@ -221,4 +224,4 @@ define(function (require) {
|
|||
}
|
||||
}
|
||||
];
|
||||
});
|
||||
});
|
||||
|
|
|
@ -46,17 +46,17 @@ define(function (require) {
|
|||
|
||||
it('should have a a key for value in the array when not grouping array terms', function (done) {
|
||||
expect(_.keys(groups).length).to.be(3);
|
||||
expect(groups['foo']).to.be.a(Object);
|
||||
expect(groups['bar']).to.be.a(Object);
|
||||
expect(groups['baz']).to.be.a(Object);
|
||||
expect(groups.foo).to.be.a(Object);
|
||||
expect(groups.bar).to.be.a(Object);
|
||||
expect(groups.baz).to.be.a(Object);
|
||||
done();
|
||||
});
|
||||
|
||||
it('should count array terms independently', function (done) {
|
||||
expect(groups['foo,bar']).to.be(undefined);
|
||||
expect(groups['foo'].count).to.be(5);
|
||||
expect(groups['bar'].count).to.be(3);
|
||||
expect(groups['baz'].count).to.be(1);
|
||||
expect(groups.foo.count).to.be(5);
|
||||
expect(groups.bar.count).to.be(3);
|
||||
expect(groups.baz.count).to.be(1);
|
||||
done();
|
||||
});
|
||||
|
||||
|
@ -79,8 +79,8 @@ define(function (require) {
|
|||
|
||||
it('should count the pairs seperately from the values they contain', function (done) {
|
||||
expect(groups['foo,bar'].count).to.be(2);
|
||||
expect(groups['foo'].count).to.be(3);
|
||||
expect(groups['bar'].count).to.be(1);
|
||||
expect(groups.foo.count).to.be(3);
|
||||
expect(groups.bar.count).to.be(1);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
|
@ -222,8 +222,8 @@ define(function (require) {
|
|||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
]
|
||||
});
|
||||
// We need to set the aggs to a known value.
|
||||
_.each(vis.aggs, function (agg) { agg.id = 'agg_' + id++; });
|
||||
results = buildHierarchicalData(vis, fixtures.oneFilterBucket);
|
||||
|
@ -254,8 +254,8 @@ define(function (require) {
|
|||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
]
|
||||
});
|
||||
// We need to set the aggs to a known value.
|
||||
_.each(vis.aggs, function (agg) { agg.id = 'agg_' + id++; });
|
||||
results = buildHierarchicalData(vis, fixtures.oneFilterBucket);
|
||||
|
|
|
@ -63,7 +63,7 @@ define(function (require) {
|
|||
new_param: 'should exist in output'
|
||||
});
|
||||
|
||||
output.params['existing'] = 'true';
|
||||
output.params.existing = 'true';
|
||||
aggConfig.params[paramName] = jsonData;
|
||||
|
||||
aggParam.write(aggConfig, output);
|
||||
|
@ -82,7 +82,7 @@ define(function (require) {
|
|||
existing: 'should be used'
|
||||
});
|
||||
|
||||
output.params['existing'] = 'true';
|
||||
output.params.existing = 'true';
|
||||
aggConfig.params[paramName] = jsonData;
|
||||
|
||||
aggParam.write(aggConfig, output);
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
var moment = require('moment');
|
||||
describe('Filter Bar Directive', function () {
|
||||
|
@ -8,10 +7,10 @@ define(function (require) {
|
|||
|
||||
beforeEach(module('kibana'));
|
||||
|
||||
beforeEach(inject(function (Private, _timefilter_) {
|
||||
beforeEach(inject(function (Private, _timefilter_) {
|
||||
changeTimeFilter = Private(require('components/filter_bar/lib/changeTimeFilter'));
|
||||
timefilter = _timefilter_;
|
||||
}));
|
||||
}));
|
||||
|
||||
it('should change the timefilter to match the range gt/lt', function () {
|
||||
var filter = { range: { '@timestamp': { gt: 1388559600000, lt: 1388646000000 } } };
|
||||
|
|
|
@ -1,9 +1,8 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
describe('Filter Bar Directive', function () {
|
||||
describe('extractTimeFilter()', function () {
|
||||
|
||||
var extractTimeFilter,
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var extractTimeFilter,
|
||||
$rootScope,
|
||||
indexPattern,
|
||||
getIndexPatternStub;
|
||||
|
@ -20,12 +19,12 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
|
||||
beforeEach(inject(function (Private, _$rootScope_, Promise) {
|
||||
beforeEach(inject(function (Private, _$rootScope_, Promise) {
|
||||
extractTimeFilter = Private(require('components/filter_bar/lib/extractTimeFilter'));
|
||||
$rootScope = _$rootScope_;
|
||||
$rootScope = _$rootScope_;
|
||||
indexPattern = Private(require('fixtures/stubbed_logstash_index_pattern'));
|
||||
getIndexPatternStub.returns(Promise.resolve(indexPattern));
|
||||
}));
|
||||
}));
|
||||
|
||||
it('should return the matching filter for the defualt time field', function (done) {
|
||||
var filters = [
|
||||
|
|
|
@ -16,6 +16,4 @@ define(function (require) {
|
|||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
|
@ -1,9 +1,9 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
describe('Filter Bar Directive', function () {
|
||||
describe('filterOutTimeBasedFilter()', function () {
|
||||
|
||||
var filterOutTimeBasedFilter,
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var filterOutTimeBasedFilter,
|
||||
$rootScope,
|
||||
indexPattern,
|
||||
getIndexPatternStub;
|
||||
|
@ -20,12 +20,12 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
|
||||
beforeEach(inject(function (Private, _$rootScope_, Promise) {
|
||||
beforeEach(inject(function (Private, _$rootScope_, Promise) {
|
||||
filterOutTimeBasedFilter = Private(require('components/filter_bar/lib/filterOutTimeBasedFilter'));
|
||||
$rootScope = _$rootScope_;
|
||||
$rootScope = _$rootScope_;
|
||||
indexPattern = Private(require('fixtures/stubbed_logstash_index_pattern'));
|
||||
getIndexPatternStub.returns(Promise.resolve(indexPattern));
|
||||
}));
|
||||
}));
|
||||
|
||||
it('should return the matching filter for the defualt time field', function (done) {
|
||||
var filters = [
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
var angular = require('angular');
|
||||
var _ = require('lodash');
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
var generateMappingChain = require('components/filter_bar/lib/generateMappingChain');
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
|
||||
describe('Filter Bar Directive', function () {
|
||||
describe('generateMappingChain()', function () {
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
describe('Filter Bar Directive', function () {
|
||||
describe('mapAndFlattenFilters()', function () {
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var mapAndFlattenFilters, $rootScope, indexPattern, getIndexPatternStub;
|
||||
|
||||
var mapAndFlattenFilters, $rootScope, indexPattern, getIndexPatternStub;
|
||||
beforeEach(module('kibana'));
|
||||
beforeEach(module('kibana'));
|
||||
|
||||
beforeEach(function () {
|
||||
getIndexPatternStub = sinon.stub();
|
||||
|
@ -16,12 +16,12 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
|
||||
beforeEach(inject(function (Private, _$rootScope_, Promise) {
|
||||
mapAndFlattenFilters = Private(require('components/filter_bar/lib/mapAndFlattenFilters'));
|
||||
beforeEach(inject(function (Private, _$rootScope_, Promise) {
|
||||
mapAndFlattenFilters = Private(require('components/filter_bar/lib/mapAndFlattenFilters'));
|
||||
$rootScope = _$rootScope_;
|
||||
indexPattern = Private(require('fixtures/stubbed_logstash_index_pattern'));
|
||||
getIndexPatternStub.returns(Promise.resolve(indexPattern));
|
||||
}));
|
||||
}));
|
||||
|
||||
var filters = [
|
||||
null,
|
||||
|
@ -35,25 +35,25 @@ define(function (require) {
|
|||
];
|
||||
|
||||
it('should map and flatten the filters', function (done) {
|
||||
mapAndFlattenFilters(filters).then(function (results) {
|
||||
expect(results).to.have.length(5);
|
||||
mapAndFlattenFilters(filters).then(function (results) {
|
||||
expect(results).to.have.length(5);
|
||||
expect(results[0]).to.have.property('meta');
|
||||
expect(results[1]).to.have.property('meta');
|
||||
expect(results[2]).to.have.property('meta');
|
||||
expect(results[3]).to.have.property('meta');
|
||||
expect(results[4]).to.have.property('meta');
|
||||
expect(results[0].meta).to.have.property('key', 'exists');
|
||||
expect(results[0].meta).to.have.property('value', '_type');
|
||||
expect(results[1].meta).to.have.property('key', 'missing');
|
||||
expect(results[1].meta).to.have.property('value', '_type');
|
||||
expect(results[2].meta).to.have.property('key', 'query');
|
||||
expect(results[2].meta).to.have.property('value', 'foo:bar');
|
||||
expect(results[3].meta).to.have.property('key', 'bytes');
|
||||
expect(results[3].meta).to.have.property('value', '1024 to 2048');
|
||||
expect(results[4].meta).to.have.property('key', '_type');
|
||||
expect(results[4].meta).to.have.property('value', 'apache');
|
||||
expect(results[0].meta).to.have.property('key', 'exists');
|
||||
expect(results[0].meta).to.have.property('value', '_type');
|
||||
expect(results[1].meta).to.have.property('key', 'missing');
|
||||
expect(results[1].meta).to.have.property('value', '_type');
|
||||
expect(results[2].meta).to.have.property('key', 'query');
|
||||
expect(results[2].meta).to.have.property('value', 'foo:bar');
|
||||
expect(results[3].meta).to.have.property('key', 'bytes');
|
||||
expect(results[3].meta).to.have.property('value', '1024 to 2048');
|
||||
expect(results[4].meta).to.have.property('key', '_type');
|
||||
expect(results[4].meta).to.have.property('value', 'apache');
|
||||
done();
|
||||
});
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
|
|
|
@ -2,30 +2,30 @@ define(function (require) {
|
|||
describe('Filter Bar Directive', function () {
|
||||
describe('mapDefault()', function () {
|
||||
|
||||
var mapDefault, $rootScope;
|
||||
beforeEach(module('kibana'));
|
||||
beforeEach(inject(function (Private, _$rootScope_) {
|
||||
$rootScope = _$rootScope_;
|
||||
mapDefault = Private(require('components/filter_bar/lib/mapDefault'));
|
||||
}));
|
||||
var mapDefault, $rootScope;
|
||||
beforeEach(module('kibana'));
|
||||
beforeEach(inject(function (Private, _$rootScope_) {
|
||||
$rootScope = _$rootScope_;
|
||||
mapDefault = Private(require('components/filter_bar/lib/mapDefault'));
|
||||
}));
|
||||
|
||||
it('should return the key and value for matching filters', function (done) {
|
||||
var filter = { query: { match_all: {} } };
|
||||
mapDefault(filter).then(function (result) {
|
||||
expect(result).to.have.property('key', 'query');
|
||||
expect(result).to.have.property('value', '{"match_all":{}}');
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
mapDefault(filter).then(function (result) {
|
||||
expect(result).to.have.property('key', 'query');
|
||||
expect(result).to.have.property('value', '{"match_all":{}}');
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should return undefined for none matching', function (done) {
|
||||
var filter = { range: { gt: 0, lt: 1024 } };
|
||||
mapDefault(filter).catch(function (result) {
|
||||
expect(result).to.be(filter);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
mapDefault(filter).catch(function (result) {
|
||||
expect(result).to.be(filter);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
|
||||
|
|
|
@ -2,30 +2,30 @@ define(function (require) {
|
|||
describe('Filter Bar Directive', function () {
|
||||
describe('mapExists()', function () {
|
||||
|
||||
var mapExists, $rootScope;
|
||||
beforeEach(module('kibana'));
|
||||
beforeEach(inject(function (Private, _$rootScope_) {
|
||||
$rootScope = _$rootScope_;
|
||||
mapExists = Private(require('components/filter_bar/lib/mapExists'));
|
||||
}));
|
||||
var mapExists, $rootScope;
|
||||
beforeEach(module('kibana'));
|
||||
beforeEach(inject(function (Private, _$rootScope_) {
|
||||
$rootScope = _$rootScope_;
|
||||
mapExists = Private(require('components/filter_bar/lib/mapExists'));
|
||||
}));
|
||||
|
||||
it('should return the key and value for matching filters', function (done) {
|
||||
var filter = { exists: { field: '_type' } };
|
||||
mapExists(filter).then(function (result) {
|
||||
expect(result).to.have.property('key', 'exists');
|
||||
expect(result).to.have.property('value', '_type');
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
mapExists(filter).then(function (result) {
|
||||
expect(result).to.have.property('key', 'exists');
|
||||
expect(result).to.have.property('value', '_type');
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should return undefined for none matching', function (done) {
|
||||
var filter = { query: { match: { query: 'foo' } } };
|
||||
mapExists(filter).catch(function (result) {
|
||||
expect(result).to.be(filter);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
mapExists(filter).catch(function (result) {
|
||||
expect(result).to.be(filter);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -1,11 +1,9 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
|
||||
describe('Filter Bar Directive', function () {
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var mapFilter, $rootScope, indexPattern, getIndexPatternStub;
|
||||
|
||||
var mapFilter, $rootScope, indexPattern, getIndexPatternStub;
|
||||
|
||||
beforeEach(module('kibana'));
|
||||
beforeEach(module('kibana'));
|
||||
|
||||
beforeEach(function () {
|
||||
getIndexPatternStub = sinon.stub();
|
||||
|
@ -17,74 +15,74 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
|
||||
beforeEach(inject(function (Promise, _$rootScope_, Private) {
|
||||
mapFilter = Private(require('components/filter_bar/lib/mapFilter'));
|
||||
$rootScope = _$rootScope_;
|
||||
beforeEach(inject(function (Promise, _$rootScope_, Private) {
|
||||
mapFilter = Private(require('components/filter_bar/lib/mapFilter'));
|
||||
$rootScope = _$rootScope_;
|
||||
indexPattern = Private(require('fixtures/stubbed_logstash_index_pattern'));
|
||||
getIndexPatternStub.returns(Promise.resolve(indexPattern));
|
||||
}));
|
||||
}));
|
||||
|
||||
describe('mapFilter()', function () {
|
||||
it('should map query filters', function (done) {
|
||||
var before = { meta: { index: 'logstash-*' }, query: { match: { '_type': { query: 'apache' } } } };
|
||||
mapFilter(before).then(function (after) {
|
||||
mapFilter(before).then(function (after) {
|
||||
expect(after).to.have.property('meta');
|
||||
expect(after.meta).to.have.property('key', '_type');
|
||||
expect(after.meta).to.have.property('value', 'apache');
|
||||
expect(after.meta).to.have.property('disabled', false);
|
||||
expect(after.meta).to.have.property('negate', false);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
expect(after.meta).to.have.property('key', '_type');
|
||||
expect(after.meta).to.have.property('value', 'apache');
|
||||
expect(after.meta).to.have.property('disabled', false);
|
||||
expect(after.meta).to.have.property('negate', false);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should map exists filters', function (done) {
|
||||
var before = { meta: { index: 'logstash-*' }, exists: { field: '@timestamp' } };
|
||||
mapFilter(before).then(function (after) {
|
||||
mapFilter(before).then(function (after) {
|
||||
expect(after).to.have.property('meta');
|
||||
expect(after.meta).to.have.property('key', 'exists');
|
||||
expect(after.meta).to.have.property('value', '@timestamp');
|
||||
expect(after.meta).to.have.property('disabled', false);
|
||||
expect(after.meta).to.have.property('negate', false);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
expect(after.meta).to.have.property('key', 'exists');
|
||||
expect(after.meta).to.have.property('value', '@timestamp');
|
||||
expect(after.meta).to.have.property('disabled', false);
|
||||
expect(after.meta).to.have.property('negate', false);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should map missing filters', function (done) {
|
||||
var before = { meta: { index: 'logstash-*' }, missing: { field: '@timestamp' } };
|
||||
mapFilter(before).then(function (after) {
|
||||
mapFilter(before).then(function (after) {
|
||||
expect(after).to.have.property('meta');
|
||||
expect(after.meta).to.have.property('key', 'missing');
|
||||
expect(after.meta).to.have.property('value', '@timestamp');
|
||||
expect(after.meta).to.have.property('disabled', false);
|
||||
expect(after.meta).to.have.property('negate', false);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
expect(after.meta).to.have.property('key', 'missing');
|
||||
expect(after.meta).to.have.property('value', '@timestamp');
|
||||
expect(after.meta).to.have.property('disabled', false);
|
||||
expect(after.meta).to.have.property('negate', false);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should map json filter', function (done) {
|
||||
var before = { meta: { index: 'logstash-*' }, query: { match_all: {} } };
|
||||
mapFilter(before).then(function (after) {
|
||||
mapFilter(before).then(function (after) {
|
||||
expect(after).to.have.property('meta');
|
||||
expect(after.meta).to.have.property('key', 'query');
|
||||
expect(after.meta).to.have.property('value', '{"match_all":{}}');
|
||||
expect(after.meta).to.have.property('disabled', false);
|
||||
expect(after.meta).to.have.property('negate', false);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
expect(after.meta).to.have.property('key', 'query');
|
||||
expect(after.meta).to.have.property('value', '{"match_all":{}}');
|
||||
expect(after.meta).to.have.property('disabled', false);
|
||||
expect(after.meta).to.have.property('negate', false);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should finish with a catch', function (done) {
|
||||
var before = { meta: { index: 'logstash-*' }, foo: '' };
|
||||
mapFilter(before).catch(function (error) {
|
||||
mapFilter(before).catch(function (error) {
|
||||
expect(error).to.be.an(Error);
|
||||
expect(error.message).to.be('No mappings have been found for filter.');
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
var _ = require('lodash');
|
||||
describe('Filter Bar Directive', function () {
|
||||
describe('mapFlattenAndWrapFilters()', function () {
|
||||
|
||||
var mapFlattenAndWrapFilters, $rootScope, indexPattern, getIndexPatternStub;
|
||||
beforeEach(module('kibana'));
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var mapFlattenAndWrapFilters, $rootScope, indexPattern, getIndexPatternStub;
|
||||
beforeEach(module('kibana'));
|
||||
|
||||
beforeEach(function () {
|
||||
getIndexPatternStub = sinon.stub();
|
||||
|
@ -17,12 +16,12 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
|
||||
beforeEach(inject(function (Private, _$rootScope_, Promise) {
|
||||
mapFlattenAndWrapFilters = Private(require('components/filter_bar/lib/mapFlattenAndWrapFilters'));
|
||||
beforeEach(inject(function (Private, _$rootScope_, Promise) {
|
||||
mapFlattenAndWrapFilters = Private(require('components/filter_bar/lib/mapFlattenAndWrapFilters'));
|
||||
$rootScope = _$rootScope_;
|
||||
indexPattern = Private(require('fixtures/stubbed_logstash_index_pattern'));
|
||||
getIndexPatternStub.returns(Promise.resolve(indexPattern));
|
||||
}));
|
||||
}));
|
||||
|
||||
var filters = [
|
||||
null,
|
||||
|
@ -36,12 +35,12 @@ define(function (require) {
|
|||
];
|
||||
|
||||
it('should map, flatten and wrap filters', function (done) {
|
||||
mapFlattenAndWrapFilters(filters).then(function (results) {
|
||||
expect(results).to.have.length(5);
|
||||
_.each(results, function (filter) {
|
||||
mapFlattenAndWrapFilters(filters).then(function (results) {
|
||||
expect(results).to.have.length(5);
|
||||
_.each(results, function (filter) {
|
||||
expect(filter).to.have.property('meta');
|
||||
expect(filter.meta).to.have.property('apply', true);
|
||||
});
|
||||
expect(filter.meta).to.have.property('apply', true);
|
||||
});
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
|
|
|
@ -3,30 +3,30 @@ define(function (require) {
|
|||
describe('Filter Bar Directive', function () {
|
||||
describe('mapMissing()', function () {
|
||||
|
||||
var mapMissing, $rootScope;
|
||||
beforeEach(module('kibana'));
|
||||
beforeEach(inject(function (Private, _$rootScope_) {
|
||||
$rootScope = _$rootScope_;
|
||||
mapMissing = Private(require('components/filter_bar/lib/mapMissing'));
|
||||
}));
|
||||
var mapMissing, $rootScope;
|
||||
beforeEach(module('kibana'));
|
||||
beforeEach(inject(function (Private, _$rootScope_) {
|
||||
$rootScope = _$rootScope_;
|
||||
mapMissing = Private(require('components/filter_bar/lib/mapMissing'));
|
||||
}));
|
||||
|
||||
it('should return the key and value for matching filters', function (done) {
|
||||
var filter = { missing: { field: '_type' } };
|
||||
mapMissing(filter).then(function (result) {
|
||||
expect(result).to.have.property('key', 'missing');
|
||||
expect(result).to.have.property('value', '_type');
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
mapMissing(filter).then(function (result) {
|
||||
expect(result).to.have.property('key', 'missing');
|
||||
expect(result).to.have.property('value', '_type');
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should return undefined for none matching', function (done) {
|
||||
var filter = { query: { match: { query: 'foo' } } };
|
||||
mapMissing(filter).catch(function (result) {
|
||||
expect(result).to.be(filter);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
mapMissing(filter).catch(function (result) {
|
||||
expect(result).to.be(filter);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -2,30 +2,30 @@ define(function (require) {
|
|||
describe('Filter Bar Directive', function () {
|
||||
describe('mapQueryString()', function () {
|
||||
|
||||
var mapQueryString, $rootScope;
|
||||
beforeEach(module('kibana'));
|
||||
beforeEach(inject(function (Private, _$rootScope_) {
|
||||
$rootScope = _$rootScope_;
|
||||
mapQueryString = Private(require('components/filter_bar/lib/mapQueryString'));
|
||||
}));
|
||||
var mapQueryString, $rootScope;
|
||||
beforeEach(module('kibana'));
|
||||
beforeEach(inject(function (Private, _$rootScope_) {
|
||||
$rootScope = _$rootScope_;
|
||||
mapQueryString = Private(require('components/filter_bar/lib/mapQueryString'));
|
||||
}));
|
||||
|
||||
it('should return the key and value for matching filters', function (done) {
|
||||
var filter = { query: { query_string: { query: 'foo:bar' } } };
|
||||
mapQueryString(filter).then(function (result) {
|
||||
expect(result).to.have.property('key', 'query');
|
||||
expect(result).to.have.property('value', 'foo:bar');
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
mapQueryString(filter).then(function (result) {
|
||||
expect(result).to.have.property('key', 'query');
|
||||
expect(result).to.have.property('value', 'foo:bar');
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
it('should return undefined for none matching', function (done) {
|
||||
var filter = { query: { match: { query: 'foo' } } };
|
||||
mapQueryString(filter).catch(function (result) {
|
||||
expect(result).to.be(filter);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
mapQueryString(filter).catch(function (result) {
|
||||
expect(result).to.be(filter);
|
||||
done();
|
||||
});
|
||||
$rootScope.$apply();
|
||||
});
|
||||
|
||||
});
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
describe('Filter Bar Directive', function () {
|
||||
describe('mapRange()', function () {
|
||||
|
||||
var mapRange, $rootScope, indexPattern, getIndexPatternStub;
|
||||
beforeEach(module('kibana'));
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var mapRange, $rootScope, indexPattern, getIndexPatternStub;
|
||||
beforeEach(module('kibana'));
|
||||
|
||||
beforeEach(function () {
|
||||
getIndexPatternStub = sinon.stub();
|
||||
|
@ -16,12 +15,12 @@ define(function (require) {
|
|||
});
|
||||
});
|
||||
|
||||
beforeEach(inject(function (Private, _$rootScope_, Promise) {
|
||||
beforeEach(inject(function (Private, _$rootScope_, Promise) {
|
||||
mapRange = Private(require('components/filter_bar/lib/mapRange'));
|
||||
$rootScope = _$rootScope_;
|
||||
$rootScope = _$rootScope_;
|
||||
indexPattern = Private(require('fixtures/stubbed_logstash_index_pattern'));
|
||||
getIndexPatternStub.returns(Promise.resolve(indexPattern));
|
||||
}));
|
||||
}));
|
||||
|
||||
it('should return the key and value for matching filters with gt/lt', function (done) {
|
||||
var filter = { meta: { index: 'logstash-*' }, range: { bytes: { lt: 2048, gt: 1024 } } };
|
||||
|
|
|
@ -1,8 +1,7 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
describe('Filter Bar Directive', function () {
|
||||
describe('mapScript()', function () {
|
||||
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var indexPattern, mapScript, $rootScope, getIndexPatternStub;
|
||||
beforeEach(module('kibana'));
|
||||
|
||||
|
|
|
@ -1,10 +1,9 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
describe('Filter Bar Directive', function () {
|
||||
describe('mapTerms()', function () {
|
||||
|
||||
var indexPattern, mapTerms, $rootScope, getIndexPatternStub;
|
||||
beforeEach(module('kibana'));
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var indexPattern, mapTerms, $rootScope, getIndexPatternStub;
|
||||
beforeEach(module('kibana'));
|
||||
|
||||
beforeEach(function () {
|
||||
getIndexPatternStub = sinon.stub();
|
||||
|
@ -17,11 +16,11 @@ define(function (require) {
|
|||
});
|
||||
|
||||
beforeEach(inject(function (Private, _$rootScope_, Promise) {
|
||||
$rootScope = _$rootScope_;
|
||||
mapTerms = Private(require('components/filter_bar/lib/mapTerms'));
|
||||
$rootScope = _$rootScope_;
|
||||
mapTerms = Private(require('components/filter_bar/lib/mapTerms'));
|
||||
indexPattern = Private(require('fixtures/stubbed_logstash_index_pattern'));
|
||||
getIndexPatternStub.returns(Promise.resolve(indexPattern));
|
||||
}));
|
||||
}));
|
||||
|
||||
it('should return the key and value for matching filters', function (done) {
|
||||
var filter = { meta: { index: 'logstash-*' }, query: { match: { _type: { query: 'apache', type: 'phrase' } } } };
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
|
||||
var _ = require('lodash');
|
||||
var toggleAll = require('components/filter_bar/lib/toggleAll');
|
||||
describe('Filter Bar Directive', function () {
|
||||
|
||||
var toggleAll = require('components/filter_bar/lib/toggleAll');
|
||||
var _ = require('lodash');
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var mapFilter, $rootScope, $compile, Promise, getIndexPatternStub, indexPattern;
|
||||
|
||||
beforeEach(module('kibana'));
|
||||
|
||||
beforeEach(function () {
|
||||
|
|
|
@ -1,9 +1,7 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
var toggleFilter = require('components/filter_bar/lib/toggleFilter');
|
||||
|
||||
describe('Filter Bar Directive', function () {
|
||||
|
||||
var sinon = require('test_utils/auto_release_sinon');
|
||||
var toggleFilter = require('components/filter_bar/lib/toggleFilter');
|
||||
var $rootScope, $compile, mapFilter, getIndexPatternStub, indexPattern;
|
||||
|
||||
beforeEach(module('kibana'));
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
var filterManager = require('components/filter_manager/filter_manager');
|
||||
var $state;
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
var fn = require('components/filter_manager/lib/phrase');
|
||||
var _ = require('lodash');
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
var fn = require('components/filter_manager/lib/query');
|
||||
var _ = require('lodash');
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
var fn = require('components/filter_manager/lib/range');
|
||||
var _ = require('lodash');
|
||||
|
|
|
@ -24,32 +24,32 @@ define(function (require) {
|
|||
});
|
||||
|
||||
it('should not consider _id indexed unless it is', function () {
|
||||
var mapped = fn(fields['_id'], '_id');
|
||||
var mapped = fn(fields._id, '_id');
|
||||
expect(mapped.indexed).to.be(false);
|
||||
|
||||
var mapping = _.cloneDeep(fields['_id']);
|
||||
var mapping = _.cloneDeep(fields._id);
|
||||
mapping.mapping._id.index = 'not_analyzed';
|
||||
var mapped2 = fn(mapping, '_id');
|
||||
expect(mapped2.indexed).to.be(true);
|
||||
});
|
||||
|
||||
it('should always consider _timestamp to be an indexed date', function () {
|
||||
var mapped = fn(fields['_timestamp'], '_timestamp');
|
||||
var mapped = fn(fields._timestamp, '_timestamp');
|
||||
expect(mapped.indexed).to.be(true);
|
||||
expect(mapped.type).to.be('date');
|
||||
});
|
||||
|
||||
it('should treat falsy and no as false for index', function () {
|
||||
var mapped = fn(fields['index_no_field'], 'index_no_field');
|
||||
var mapped = fn(fields.index_no_field, 'index_no_field');
|
||||
expect(mapped.indexed).to.be(false);
|
||||
|
||||
fields['index_no_field'].index = false;
|
||||
mapped = fn(fields['index_no_field'], 'index_no_field');
|
||||
fields.index_no_field.index = false;
|
||||
mapped = fn(fields.index_no_field, 'index_no_field');
|
||||
expect(mapped.indexed).to.be(false);
|
||||
});
|
||||
|
||||
it('should treat other values for index as true', function () {
|
||||
var mapped = fn(fields['not_analyzed_field'], 'not_analyzed_field');
|
||||
var mapped = fn(fields.not_analyzed_field, 'not_analyzed_field');
|
||||
expect(mapped.indexed).to.be(true);
|
||||
});
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ define(function (require) {
|
|||
{ version: '1.4.2', attributes: { client: 'true' } },
|
||||
'1.4.5'
|
||||
);
|
||||
|
||||
|
||||
return checkEsVersion();
|
||||
});
|
||||
|
||||
|
|
|
@ -130,7 +130,7 @@ define(function (require) {
|
|||
|
||||
it('should only set the number of defaults defined by the max', function () {
|
||||
var ac = new AggConfigs(vis);
|
||||
expect(ac.bySchemaName['metric']).to.have.length(2);
|
||||
expect(ac.bySchemaName.metric).to.have.length(2);
|
||||
});
|
||||
|
||||
it('should set the defaults defined in the schema when none exist', function () {
|
||||
|
|
|
@ -35,7 +35,7 @@ define(function (require) {
|
|||
expect(vis.aggs).to.have.length(3);
|
||||
|
||||
expect(vis).to.have.property('type');
|
||||
expect(vis.type).to.eql(visTypes.byName['pie']);
|
||||
expect(vis.type).to.eql(visTypes.byName.pie);
|
||||
|
||||
expect(vis).to.have.property('listeners');
|
||||
expect(vis.listeners).to.have.property('click');
|
||||
|
@ -80,7 +80,7 @@ define(function (require) {
|
|||
it('should set the state to defualts', function () {
|
||||
var vis = new Vis(indexPattern);
|
||||
expect(vis).to.have.property('type');
|
||||
expect(vis.type).to.eql(visTypes.byName['histogram']);
|
||||
expect(vis.type).to.eql(visTypes.byName.histogram);
|
||||
expect(vis).to.have.property('aggs');
|
||||
expect(vis.aggs).to.have.length(1);
|
||||
expect(vis).to.have.property('listeners');
|
||||
|
|
|
@ -93,7 +93,7 @@ define(function (require) {
|
|||
'two',
|
||||
'three'
|
||||
], function () {
|
||||
calls ++;
|
||||
calls++;
|
||||
expect(arguments).to.have.length(0);
|
||||
});
|
||||
$rootScope.$apply();
|
||||
|
|
|
@ -1,4 +1,3 @@
|
|||
/* global sinon */
|
||||
define(function (require) {
|
||||
var moment = require('moment');
|
||||
describe('Query decorator', function () {
|
||||
|
|
|
@ -16,7 +16,8 @@ define(function (require) {
|
|||
require('plugins/discover/index');
|
||||
|
||||
var $parentScope, $scope, $elem;
|
||||
var clock, anchor = '2014-01-01T06:06:06.666Z';
|
||||
var anchor = '2014-01-01T06:06:06.666Z';
|
||||
var clock;
|
||||
|
||||
var init = function () {
|
||||
// Load the application
|
||||
|
|
|
@ -54,7 +54,7 @@ define(function (require) {
|
|||
var obj = new Events();
|
||||
obj.on('test', _.noop);
|
||||
expect(obj._listeners).to.have.property('test');
|
||||
expect(obj._listeners['test']).to.have.length(1);
|
||||
expect(obj._listeners.test).to.have.length(1);
|
||||
obj.off();
|
||||
expect(obj._listeners).to.not.have.property('test');
|
||||
});
|
||||
|
|
|
@ -8,7 +8,8 @@ define(function (require) {
|
|||
require('filters/moment');
|
||||
|
||||
var filter, config;
|
||||
var clock, anchor = '2014-01-01T06:06:06.666';
|
||||
var anchor = '2014-01-01T06:06:06.666';
|
||||
var clock;
|
||||
|
||||
var init = function (expandable) {
|
||||
// Load the application
|
||||
|
|
|
@ -50,7 +50,7 @@ define(function (require) {
|
|||
|
||||
it('should preserve objects in arrays', function () {
|
||||
var obj = indexPattern.flattenSearchResponse(fixture);
|
||||
expect(obj).to.have.property('tags', fixture['tags']);
|
||||
expect(obj).to.have.property('tags', fixture.tags);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -6,11 +6,11 @@ define(function (require) {
|
|||
|
||||
describe('datemath', function () {
|
||||
// Test each of these intervals when testing relative time
|
||||
var spans = ['s', 'm', 'h', 'd', 'w', 'M', 'y'],
|
||||
anchor = '2014-01-01T06:06:06.666Z',
|
||||
unix = moment(anchor).valueOf(),
|
||||
format = 'YYYY-MM-DDTHH:mm:ss.SSSZ',
|
||||
clock;
|
||||
var spans = ['s', 'm', 'h', 'd', 'w', 'M', 'y'];
|
||||
var anchor = '2014-01-01T06:06:06.666Z';
|
||||
var unix = moment(anchor).valueOf();
|
||||
var format = 'YYYY-MM-DDTHH:mm:ss.SSSZ';
|
||||
var clock;
|
||||
|
||||
describe('errors', function () {
|
||||
it('should return undefined if passed something falsy', function () {
|
||||
|
|
|
@ -22,7 +22,7 @@ define(function (require) {
|
|||
opts = opts || {};
|
||||
|
||||
var delaySetup = opts.delayUserWork ? 0 : 50;
|
||||
var delayUserWork = opts.delayUserWork ? 50: 0;
|
||||
var delayUserWork = opts.delayUserWork ? 50 : 0;
|
||||
|
||||
return function () {
|
||||
module('kibana', 'kibana/notify');
|
||||
|
|
|
@ -31,7 +31,7 @@ define(function (require) {
|
|||
|
||||
seq.forEach(function (n, i) {
|
||||
if (i > 0 && (seq[i - 1] < n) !== up) {
|
||||
throw new Error('expected values to ' + (up ? 'increase': 'decrease'));
|
||||
throw new Error('expected values to ' + (up ? 'increase' : 'decrease'));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@ define(function (require) {
|
|||
var rowsArr;
|
||||
var uniqLabels;
|
||||
var error;
|
||||
|
||||
|
||||
var seriesData = {
|
||||
'label': '',
|
||||
'series': [
|
||||
|
@ -219,29 +219,33 @@ define(function (require) {
|
|||
}).to.throwError();
|
||||
});
|
||||
|
||||
it('should throw an error if property series, rows, or columns is not ' +
|
||||
'present', function () {
|
||||
it(
|
||||
'should throw an error if property series, rows, or ' +
|
||||
'columns is not present',
|
||||
function () {
|
||||
expect(function () {
|
||||
dataArray(childrenObject);
|
||||
}).to.throwError();
|
||||
}
|
||||
);
|
||||
|
||||
expect(function () {
|
||||
dataArray(childrenObject);
|
||||
}).to.throwError();
|
||||
});
|
||||
it(
|
||||
'should not throw an error if object has property series, rows, or ' +
|
||||
'columns',
|
||||
function () {
|
||||
expect(function () {
|
||||
dataArray(seriesObject);
|
||||
}).to.not.throwError();
|
||||
|
||||
it('should not throw an error if object has property series, rows, or ' +
|
||||
'columns', function () {
|
||||
expect(function () {
|
||||
dataArray(rowsObject);
|
||||
}).to.not.throwError();
|
||||
|
||||
expect(function () {
|
||||
dataArray(seriesObject);
|
||||
}).to.not.throwError();
|
||||
|
||||
expect(function () {
|
||||
dataArray(rowsObject);
|
||||
}).to.not.throwError();
|
||||
|
||||
expect(function () {
|
||||
dataArray(columnsObject);
|
||||
}).to.not.throwError();
|
||||
});
|
||||
expect(function () {
|
||||
dataArray(columnsObject);
|
||||
}).to.not.throwError();
|
||||
}
|
||||
);
|
||||
|
||||
it('should be a function', function () {
|
||||
expect(typeof dataArray).to.equal('function');
|
||||
|
|
|
@ -181,7 +181,7 @@ define(function (require) {
|
|||
describe('Vislib Data Class Test Suite', function () {
|
||||
|
||||
describe('Data Class (main)', function () {
|
||||
var dataFactory;
|
||||
var DataFactory;
|
||||
var rowIn;
|
||||
|
||||
beforeEach(function () {
|
||||
|
@ -190,13 +190,13 @@ define(function (require) {
|
|||
|
||||
beforeEach(function () {
|
||||
inject(function (d3, Private) {
|
||||
dataFactory = Private(require('components/vislib/lib/data'));
|
||||
DataFactory = Private(require('components/vislib/lib/data'));
|
||||
});
|
||||
rowIn = new dataFactory(rowsData, {});
|
||||
rowIn = new DataFactory(rowsData, {});
|
||||
});
|
||||
|
||||
it('should be a function', function () {
|
||||
expect(_.isFunction(dataFactory)).to.be(true);
|
||||
expect(_.isFunction(DataFactory)).to.be(true);
|
||||
});
|
||||
|
||||
it('should return an object', function () {
|
||||
|
@ -206,7 +206,7 @@ define(function (require) {
|
|||
});
|
||||
|
||||
describe('Data.flatten', function () {
|
||||
var dataFactory;
|
||||
var DataFactory;
|
||||
var serIn;
|
||||
var rowIn;
|
||||
var colIn;
|
||||
|
@ -220,11 +220,11 @@ define(function (require) {
|
|||
|
||||
beforeEach(function () {
|
||||
inject(function (d3, Private) {
|
||||
dataFactory = Private(require('components/vislib/lib/data'));
|
||||
DataFactory = Private(require('components/vislib/lib/data'));
|
||||
});
|
||||
serIn = new dataFactory(seriesData, {});
|
||||
rowIn = new dataFactory(rowsData, {});
|
||||
colIn = new dataFactory(colsData, {});
|
||||
serIn = new DataFactory(seriesData, {});
|
||||
rowIn = new DataFactory(rowsData, {});
|
||||
colIn = new DataFactory(colsData, {});
|
||||
serOut = serIn.flatten();
|
||||
rowOut = rowIn.flatten();
|
||||
colOut = colIn.flatten();
|
||||
|
@ -236,7 +236,7 @@ define(function (require) {
|
|||
|
||||
function testLength(inputData) {
|
||||
return function () {
|
||||
var data = new dataFactory(inputData, {});
|
||||
var data = new DataFactory(inputData, {});
|
||||
var len = _.reduce(data.chartData(), function (sum, chart) {
|
||||
return sum + chart.series.reduce(function (sum, series) {
|
||||
return sum + series.values.length;
|
||||
|
|
|
@ -82,7 +82,7 @@ define(function (require) {
|
|||
inject(function (d3, Private) {
|
||||
Data = Private(require('components/vislib/lib/data'));
|
||||
XAxis = Private(require('components/vislib/lib/x_axis'));
|
||||
|
||||
|
||||
el = d3.select('body').append('div')
|
||||
.attr('class', 'x-axis-wrapper')
|
||||
.style('height', '40px');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue