mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 17:28:26 -04:00
Merge branch 'master' of github.com:elastic/kibana into feature/hapi-server
This commit is contained in:
commit
cf8bfd0f10
23 changed files with 2161 additions and 390 deletions
10
.travis.yml
10
.travis.yml
|
@ -1,11 +1,7 @@
|
|||
language: node_js
|
||||
node_js:
|
||||
- '0.10'
|
||||
install:
|
||||
- npm install grunt-cli bower
|
||||
- npm install
|
||||
script:
|
||||
- npm test
|
||||
node_js: '0.12'
|
||||
install: npm install
|
||||
script: npm test
|
||||
sudo: false
|
||||
cache:
|
||||
directories:
|
||||
|
|
58
bower.json
58
bower.json
|
@ -21,41 +21,39 @@
|
|||
],
|
||||
"dependencies": {
|
||||
"angular": "1.2.28",
|
||||
"angular-bindonce": "~0.3.1",
|
||||
"angular-bootstrap": "~0.10.0",
|
||||
"angular-elastic": "~2.4.2",
|
||||
"angular-mocks": "~1.2.14",
|
||||
"angular-route": "~1.2.14",
|
||||
"angular-ui-ace": "~0.2.3",
|
||||
"async": "~0.2.10",
|
||||
"angular-bindonce": "0.3.3",
|
||||
"angular-bootstrap": "0.10.0",
|
||||
"angular-elastic": "2.4.2",
|
||||
"angular-mocks": "1.2.28",
|
||||
"angular-route": "1.2.28",
|
||||
"angular-ui-ace": "0.2.3",
|
||||
"bluebird": "~2.1.3",
|
||||
"bootstrap": "~3.3.1",
|
||||
"d3": "~3.4.8",
|
||||
"elasticsearch": "~4.1.0",
|
||||
"Faker": "~1.1.0",
|
||||
"FileSaver": "*",
|
||||
"font-awesome": "~4.2.0",
|
||||
"gridster": "~0.5.0",
|
||||
"inflection": "~1.3.5",
|
||||
"jquery": "~2.1.0",
|
||||
"bootstrap": "3.3.4",
|
||||
"d3": "3.4.13",
|
||||
"elasticsearch": "4.1.0",
|
||||
"Faker": "1.1.0",
|
||||
"FileSaver": "babc6d9d8f",
|
||||
"font-awesome": "4.2.0",
|
||||
"gridster": "0.5.6",
|
||||
"inflection": "1.3.8",
|
||||
"jquery": "2.1.4",
|
||||
"leaflet": "0.7.3",
|
||||
"Leaflet.heat": "Leaflet/Leaflet.heat#627ede7c11bbe43",
|
||||
"lesshat": "~3.0.2",
|
||||
"lodash": "~2.4.1",
|
||||
"moment": "~2.9.0",
|
||||
"moment-timezone": "~0.0.3",
|
||||
"ng-clip": "~0.2.4",
|
||||
"require-css": "~0.1.2",
|
||||
"requirejs": "~2.1.10",
|
||||
"requirejs-text": "~2.0.10",
|
||||
"lodash-deep": "spenceralger/lodash-deep#compat",
|
||||
"marked": "~0.3.2",
|
||||
"numeral": "~1.5.3",
|
||||
"leaflet-draw": "~0.2.4"
|
||||
"lesshat": "3.0.2",
|
||||
"lodash": "2.4.2",
|
||||
"moment": "2.9.0",
|
||||
"moment-timezone": "0.0.6",
|
||||
"ng-clip": "0.2.6",
|
||||
"require-css": "0.1.8",
|
||||
"requirejs": "2.1.18",
|
||||
"requirejs-text": "2.0.14",
|
||||
"lodash-deep": "spenceralger/lodash-deep#1a7eca8344",
|
||||
"marked": "0.3.3",
|
||||
"numeral": "1.5.3",
|
||||
"leaflet-draw": "0.2.4"
|
||||
},
|
||||
"devDependencies": {},
|
||||
"resolutions": {
|
||||
"angular-bootstrap": "~0.12",
|
||||
"elasticsearch": "~4.1.0"
|
||||
"angular": "1.2.28"
|
||||
}
|
||||
}
|
||||
|
|
1784
npm-shrinkwrap.json
generated
Normal file
1784
npm-shrinkwrap.json
generated
Normal file
File diff suppressed because it is too large
Load diff
85
package.json
85
package.json
|
@ -30,9 +30,9 @@
|
|||
],
|
||||
"scripts": {
|
||||
"test": "grunt test",
|
||||
"start": "node ./src/server/index.js",
|
||||
"server": "node ./src/server/bin/kibana.js",
|
||||
"postinstall": "bower install",
|
||||
"start": "node ./src/server/bin/kibana.js",
|
||||
"postinstall": "bower install && grunt licenses --check-validity",
|
||||
"precommit": "grunt lintStagedFiles"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -41,82 +41,89 @@
|
|||
},
|
||||
"dependencies": {
|
||||
"ansicolors": "^0.3.2",
|
||||
"bluebird": "~2.0.7",
|
||||
"body-parser": "~1.10.1",
|
||||
"bluebird": "^2.0.7",
|
||||
"body-parser": "^1.10.1",
|
||||
"bunyan": "^1.2.3",
|
||||
"commander": "^2.6.0",
|
||||
"compression": "^1.3.0",
|
||||
"cookie-parser": "~1.3.3",
|
||||
"debug": "~2.1.1",
|
||||
"cookie-parser": "^1.3.3",
|
||||
"debug": "^2.1.1",
|
||||
"elasticsearch": "^3.1.1",
|
||||
"express": "~4.10.6",
|
||||
"express": "^4.10.6",
|
||||
"glob": "^4.3.2",
|
||||
"good": "^5.1.2",
|
||||
"good-console": "^4.1.0",
|
||||
"good-file": "^4.0.2",
|
||||
"good-reporter": "^3.0.1",
|
||||
"hapi": "^8.4.0",
|
||||
"good-reporter": "^3.1.0",
|
||||
"hapi": "^8.6.1",
|
||||
"http-auth": "^2.2.5",
|
||||
"jade": "~1.8.2",
|
||||
"joi": "^6.2.0",
|
||||
"jade": "^1.8.2",
|
||||
"joi": "^6.4.3",
|
||||
"js-yaml": "^3.2.5",
|
||||
"json-stringify-safe": "^5.0.0",
|
||||
"json-stringify-safe": "^5.0.1",
|
||||
"less-middleware": "1.0.x",
|
||||
"lodash": "^2.4.1",
|
||||
"lodash-deep": "^1.6.0",
|
||||
"moment": "^2.9.0",
|
||||
"moment": "^2.10.3",
|
||||
"morgan": "~1.5.1",
|
||||
"numeral": "^1.5.3",
|
||||
"request": "^2.40.0",
|
||||
"requirefrom": "^0.2.0",
|
||||
"semver": "^4.2.0",
|
||||
"serve-favicon": "~2.2.0",
|
||||
"serve-favicon": "^2.2.0",
|
||||
"through": "^2.3.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"connect": "~2.19.5",
|
||||
"event-stream": "~3.1.5",
|
||||
"expect.js": "~0.3.1",
|
||||
"glob": "~4.1.3",
|
||||
"grunt": "~0.4.5",
|
||||
"grunt-contrib-clean": "~0.5.0",
|
||||
"grunt-contrib-compress": "~0.9.1",
|
||||
"grunt-contrib-copy": "~0.5.0",
|
||||
"grunt-contrib-jade": "~0.10.0",
|
||||
"bower": "^1.4.1",
|
||||
"bower-license": "^0.2.6",
|
||||
"connect": "^2.19.5",
|
||||
"event-stream": "^3.1.5",
|
||||
"expect.js": "^0.3.1",
|
||||
"glob": "^4.1.3",
|
||||
"grunt": "^0.4.5",
|
||||
"grunt-cli": "0.1.13",
|
||||
"grunt-contrib-clean": "^0.5.0",
|
||||
"grunt-contrib-compress": "^0.9.1",
|
||||
"grunt-contrib-copy": "^0.5.0",
|
||||
"grunt-contrib-jade": "^0.10.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-contrib-less": "^0.10.0",
|
||||
"grunt-contrib-requirejs": "^0.4.4",
|
||||
"grunt-contrib-watch": "^0.5.3",
|
||||
"grunt-esvm": "^0.3.2",
|
||||
"grunt-jscs": "^1.8.0",
|
||||
"grunt-mocha": "^0.4.10",
|
||||
"grunt-replace": "^0.7.9",
|
||||
"grunt-run": "^0.2.3",
|
||||
"grunt-s3": "~0.2.0-alpha.3",
|
||||
"grunt-saucelabs": "~8.3.2",
|
||||
"grunt-s3": "^0.2.0-alpha.3",
|
||||
"grunt-simple-mocha": "^0.4.0",
|
||||
"html-entities": "^1.1.1",
|
||||
"http-proxy": "~1.8.1",
|
||||
"husky": "~0.6.0",
|
||||
"istanbul": "~0.2.4",
|
||||
"libesvm": "0.0.12",
|
||||
"load-grunt-config": "~0.7.0",
|
||||
"lodash": "~2.4.1",
|
||||
"http-proxy": "^1.8.1",
|
||||
"husky": "^0.6.0",
|
||||
"istanbul": "^0.2.4",
|
||||
"license-checker": "3.0.3",
|
||||
"load-grunt-config": "^0.7.0",
|
||||
"lodash": "^2.4.1",
|
||||
"marked": "^0.3.2",
|
||||
"marked-text-renderer": "^0.1.0",
|
||||
"mkdirp": "^0.5.0",
|
||||
"mocha": "^2.2.5",
|
||||
"mocha-screencast-reporter": "~0.1.4",
|
||||
"nock": "^1.6.0",
|
||||
"opn": "~1.0.0",
|
||||
"npm": "^2.11.0",
|
||||
"opn": "^1.0.0",
|
||||
"path-browserify": "0.0.0",
|
||||
"portscanner": "^1.0.0",
|
||||
"progress": "^1.1.8",
|
||||
"requirejs": "~2.1.14",
|
||||
"requirejs": "^2.1.14",
|
||||
"rjs-build-analysis": "0.0.3",
|
||||
"simple-git": "^0.11.0",
|
||||
"sinon": "^1.12.2",
|
||||
"sinon-as-promised": "^2.0.3",
|
||||
"tar": "^1.0.1"
|
||||
},
|
||||
"engines": {
|
||||
"node": "~0.10 || ~0.12",
|
||||
"iojs": ">=1.5"
|
||||
}
|
||||
}
|
||||
|
|
|
@ -23,10 +23,11 @@ define(function (require) {
|
|||
* ```
|
||||
*/
|
||||
module.directive('kbnTableRow', function ($compile) {
|
||||
var noWhiteSpace = require('utils/no_white_space');
|
||||
var openRowHtml = require('text!components/doc_table/components/table_row/open.html');
|
||||
var detailsHtml = require('text!components/doc_table/components/table_row/details.html');
|
||||
var cellTemplate = _.template(require('text!components/doc_table/components/table_row/cell.html'));
|
||||
var truncateByHeightTemplate = _.template(require('text!partials/truncate_by_height.html'));
|
||||
var cellTemplate = _.template(noWhiteSpace(require('text!components/doc_table/components/table_row/cell.html')));
|
||||
var truncateByHeightTemplate = _.template(noWhiteSpace(require('text!partials/truncate_by_height.html')));
|
||||
|
||||
return {
|
||||
restrict: 'A',
|
||||
|
@ -106,6 +107,7 @@ define(function (require) {
|
|||
$scope.columns.forEach(function (column) {
|
||||
newHtmls.push(cellTemplate({
|
||||
timefield: false,
|
||||
sourcefield: (column === '_source'),
|
||||
formatted: _displayField(row, column, true)
|
||||
}));
|
||||
});
|
||||
|
|
|
@ -1,3 +1,13 @@
|
|||
<td <%= timefield ? 'class="discover-table-timefield" width="1%"' : '' %>>
|
||||
<%
|
||||
var attributes = '';
|
||||
if (timefield) {
|
||||
attributes='class="discover-table-timefield" width="1%"';
|
||||
} else if (sourcefield) {
|
||||
attributes='class="discover-table-sourcefield"';
|
||||
} else {
|
||||
attributes='class="discover-table-datafield"';
|
||||
}
|
||||
%>
|
||||
<td <%= attributes %>>
|
||||
<%= formatted %>
|
||||
</td>
|
||||
</td>
|
||||
|
|
|
@ -7,6 +7,10 @@ doc-table {
|
|||
margin: 5px;
|
||||
.flex(1, 1, 100%);
|
||||
|
||||
.discover-table-datafield {
|
||||
white-space: pre;
|
||||
}
|
||||
|
||||
.loading {
|
||||
opacity: @loading-opacity;
|
||||
}
|
||||
|
|
|
@ -22,9 +22,10 @@ define(function (require) {
|
|||
indexed: true,
|
||||
type: 'date'
|
||||
},
|
||||
_source: {
|
||||
type: '_source'
|
||||
}
|
||||
_source: { type: '_source' },
|
||||
_index: { type: 'string' },
|
||||
_type: { type: 'string' },
|
||||
_id: { type: 'string' }
|
||||
};
|
||||
|
||||
if (!mapping.index || mapping.index === 'no') {
|
||||
|
|
|
@ -16,6 +16,9 @@ define(function (require) {
|
|||
|
||||
typeaheadCtrl.setInputModel(model);
|
||||
|
||||
// disable browser autocomplete
|
||||
$el.attr('autocomplete', 'off');
|
||||
|
||||
// handle keypresses
|
||||
$el.on('keydown', function (ev) {
|
||||
typeaheadCtrl.keypressHandler(ev);
|
||||
|
@ -44,4 +47,4 @@ define(function (require) {
|
|||
}
|
||||
};
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -108,11 +108,16 @@ define(function (require) {
|
|||
div.append('svg')
|
||||
.attr('width', function () {
|
||||
if (dataType === 'rows') {
|
||||
return 15;
|
||||
return height;
|
||||
}
|
||||
return width;
|
||||
})
|
||||
.attr('height', height)
|
||||
.attr('height', function () {
|
||||
if (dataType === 'rows') {
|
||||
return width;
|
||||
}
|
||||
return height;
|
||||
})
|
||||
.append('text')
|
||||
.attr('transform', function () {
|
||||
if (dataType === 'rows') {
|
||||
|
@ -121,9 +126,7 @@ define(function (require) {
|
|||
return 'translate(' + width / 2 + ',' + txtHtOffset + ')';
|
||||
})
|
||||
.attr('text-anchor', 'middle')
|
||||
.text(function (d) {
|
||||
return d.label;
|
||||
});
|
||||
.text(function (d) { return d.label; });
|
||||
|
||||
// truncate long chart titles
|
||||
div.selectAll('text')
|
||||
|
|
|
@ -119,8 +119,8 @@ define(function (require) {
|
|||
var dataLengths = {};
|
||||
|
||||
dataLengths.charts = data.length;
|
||||
dataLengths.stacks = data[i].series.length;
|
||||
dataLengths.values = data[i].series[j].values.length;
|
||||
dataLengths.stacks = dataLengths.charts ? data[i].series.length : 0;
|
||||
dataLengths.values = dataLengths.stacks ? data[i].series[j].values.length : 0;
|
||||
|
||||
return dataLengths;
|
||||
};
|
||||
|
@ -185,8 +185,9 @@ define(function (require) {
|
|||
}
|
||||
|
||||
// get stack and value count for next chart
|
||||
this._cache.count.stacks = data[this._cache.index.chart].series.length; // number of stack layers
|
||||
this._cache.count.values = data[this._cache.index.chart].series[this._cache.index.stack].values.length; // number of values
|
||||
var chartSeries = data[this._cache.index.chart].series;
|
||||
this._cache.count.stacks = chartSeries.length;
|
||||
this._cache.count.values = chartSeries.length ? chartSeries[this._cache.index.stack].values.length : 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
@ -351,7 +352,10 @@ define(function (require) {
|
|||
// for each object in the dataArray,
|
||||
// push the calculated y value to the initialized array (arr)
|
||||
_.each(this.chartData(), function (chart) {
|
||||
min = Math.min(min, self._getYExtent(chart, 'min', getValue));
|
||||
var calculatedMin = self._getYExtent(chart, 'min', getValue);
|
||||
if (!_.isUndefined(calculatedMin)) {
|
||||
min = Math.min(min, calculatedMin);
|
||||
}
|
||||
});
|
||||
|
||||
return min;
|
||||
|
@ -387,7 +391,10 @@ define(function (require) {
|
|||
// for each object in the dataArray,
|
||||
// push the calculated y value to the initialized array (arr)
|
||||
_.each(this.chartData(), function (chart) {
|
||||
max = Math.max(max, self._getYExtent(chart, 'max', getValue));
|
||||
var calculatedMax = self._getYExtent(chart, 'max', getValue);
|
||||
if (!_.isUndefined(calculatedMax)) {
|
||||
max = Math.max(max, calculatedMax);
|
||||
}
|
||||
});
|
||||
|
||||
return max;
|
||||
|
|
|
@ -15,6 +15,30 @@ define(function (require) {
|
|||
PointSeriesChart.Super.apply(this, arguments);
|
||||
}
|
||||
|
||||
PointSeriesChart.prototype._stackMixedValues = function (stackCount) {
|
||||
var currentStackOffsets = [0, 0];
|
||||
var currentStackIndex = 0;
|
||||
|
||||
return function (d, y0, y) {
|
||||
var firstStack = currentStackIndex % stackCount === 0;
|
||||
var lastStack = ++currentStackIndex === stackCount;
|
||||
|
||||
if (firstStack) {
|
||||
currentStackOffsets = [0, 0];
|
||||
}
|
||||
|
||||
if (lastStack) currentStackIndex = 0;
|
||||
|
||||
if (y >= 0) {
|
||||
d.y0 = currentStackOffsets[1];
|
||||
currentStackOffsets[1] += y;
|
||||
} else {
|
||||
d.y0 = currentStackOffsets[0];
|
||||
currentStackOffsets[0] += y;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
/**
|
||||
* Stacks chart data values
|
||||
*
|
||||
|
@ -24,8 +48,11 @@ define(function (require) {
|
|||
*/
|
||||
PointSeriesChart.prototype.stackData = function (data) {
|
||||
var self = this;
|
||||
var isHistogram = (this._attr.type === 'histogram' && this._attr.mode === 'stacked');
|
||||
var stack = this._attr.stack;
|
||||
|
||||
if (isHistogram) stack.out(self._stackMixedValues(data.series.length));
|
||||
|
||||
return stack(data.series.map(function (d) {
|
||||
var label = d.label;
|
||||
return d.values.map(function (e, i) {
|
||||
|
|
|
@ -4,6 +4,8 @@ define(function (require) {
|
|||
var $ = require('jquery');
|
||||
var moment = require('moment');
|
||||
|
||||
var DataClass = Private(require('components/vislib/lib/data'));
|
||||
|
||||
var PointSeriesChart = Private(require('components/vislib/visualizations/_point_series_chart'));
|
||||
var TimeMarker = Private(require('components/vislib/visualizations/time_marker'));
|
||||
var errors = require('errors');
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
aria-label="{{ editorOpen ? 'Close Editor' : 'Open Editor' }}"
|
||||
ng-click="editorOpen = !editorOpen"
|
||||
type="button"
|
||||
class="btn btn-xs vis-editor-agg-header-toggle">
|
||||
class="btn btn-default btn-xs vis-editor-agg-header-toggle">
|
||||
<i aria-hidden="true" ng-class="{ 'fa-caret-down': editorOpen, 'fa-caret-right': !editorOpen }" class="fa"></i>
|
||||
</button>
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@
|
|||
{{ indexPattern.id }}
|
||||
</div>
|
||||
|
||||
<nav class="navbar navbar-default navbar-static-top subnav">
|
||||
<nav class="navbar navbar-default subnav">
|
||||
<div class="container-fluid">
|
||||
|
||||
<!-- tabs -->
|
||||
|
|
|
@ -77,6 +77,9 @@
|
|||
// margin-bottom: (@input-height-base * 2) - 3;
|
||||
}
|
||||
|
||||
nav {
|
||||
border-radius: 0px;
|
||||
}
|
||||
|
||||
.sidebar-item {
|
||||
border-top: 0 !important;
|
||||
|
@ -91,8 +94,13 @@
|
|||
.flex-parent(1, 1, auto);
|
||||
|
||||
> div.vis-editor-config {
|
||||
.flex-parent(1, 1, 1px);
|
||||
overflow: auto;
|
||||
@media (min-width: @screen-md-min) {
|
||||
.flex-parent(1, 1, 1px);
|
||||
overflow: auto;
|
||||
}
|
||||
@media (max-width: @screen-md-min) {
|
||||
.flex-parent(1, 1, auto);
|
||||
}
|
||||
}
|
||||
|
||||
> .vis-edit-sidebar-buttons {
|
||||
|
|
41
tasks/config/licenses.js
Normal file
41
tasks/config/licenses.js
Normal file
|
@ -0,0 +1,41 @@
|
|||
module.exports = function (grunt) {
|
||||
return {
|
||||
options: {
|
||||
licenses: [
|
||||
'MIT',
|
||||
'MIT*',
|
||||
'MIT/X11',
|
||||
'new BSD, and MIT',
|
||||
'BSD',
|
||||
'BSD*',
|
||||
'BSD New',
|
||||
'BSD-like',
|
||||
'BSD-2-Clause',
|
||||
'BSD-3-Clause',
|
||||
'Apache',
|
||||
'Apache*',
|
||||
'Apache v2',
|
||||
'Apache 2.0',
|
||||
'Apache2',
|
||||
'Apache-2.0',
|
||||
'Apache, Version 2.0',
|
||||
'ISC',
|
||||
'WTFPL',
|
||||
'Public-Domain'
|
||||
],
|
||||
overrides: {
|
||||
'assert-plus@0.1.5': ['MIT'],
|
||||
'angular-bootstrap@0.10.0': ['MIT'],
|
||||
'angular-ui-ace@0.2.3': ['MIT'],
|
||||
'commander@2.2.0': ['MIT'],
|
||||
'leaflet@0.7.2': ['BSD-2-Clause'],
|
||||
'moment-timezone@0.0.6': ['MIT'],
|
||||
'zeroclipboard@2.2.0': ['MIT'],
|
||||
'FileSaver@undefined': ['MIT'],
|
||||
'cycle@1.0.3': ['Public-Domain'],
|
||||
'pkginfo@0.2.3': ['MIT'],
|
||||
'uglify-js@2.2.5': ['BSD']
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
|
@ -1,39 +0,0 @@
|
|||
var config = require('../utils/server-config');
|
||||
var unitTestUrl = require('util').format('http://localhost:%d/test/unit/?saucelabs=true', config.get('kibana.server.port'));
|
||||
var buildId = 'test build';
|
||||
if (process.env.TRAVIS_BUILD_ID) {
|
||||
buildId = 'travis build #' + process.env.TRAVIS_BUILD_ID;
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
unit: {
|
||||
options: {
|
||||
username: 'kibana',
|
||||
key: process.env.SAUCE_ACCESS_KEY,
|
||||
urls: [ unitTestUrl ],
|
||||
testname: 'Kibana Browser Tests',
|
||||
build: buildId,
|
||||
concurrency: 10,
|
||||
'max-duration': 60,
|
||||
maxRetries: 2,
|
||||
browsers: [
|
||||
{
|
||||
browserName: 'chrome',
|
||||
platform: 'Windows 7'
|
||||
},
|
||||
{
|
||||
browserName: 'safari',
|
||||
platform: 'OS X 10.9',
|
||||
},
|
||||
{
|
||||
browserName: 'firefox',
|
||||
platform: 'Windows 7',
|
||||
},
|
||||
{
|
||||
browserName: 'internet explorer',
|
||||
platform: 'Windows 8'
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
83
tasks/licenses.js
Normal file
83
tasks/licenses.js
Normal file
|
@ -0,0 +1,83 @@
|
|||
var _ = require('lodash');
|
||||
var npm = require('npm');
|
||||
var bowerLicense = require('bower-license');
|
||||
var npmLicense = require('license-checker');
|
||||
|
||||
module.exports = function (grunt) {
|
||||
grunt.registerTask('licenses', 'Checks dependency licenses', function () {
|
||||
|
||||
var config = this.options();
|
||||
|
||||
var done = this.async();
|
||||
|
||||
var result = {};
|
||||
var options = {start: process.cwd(), json: true };
|
||||
var checkQueueLength = 2;
|
||||
|
||||
function processPackage(info, dependency) {
|
||||
var pkgInfo = {};
|
||||
pkgInfo.name = dependency;
|
||||
pkgInfo.licenses = config.overrides[dependency] || info.licenses;
|
||||
pkgInfo.licenses = _.isArray(pkgInfo.licenses) ? pkgInfo.licenses : [pkgInfo.licenses];
|
||||
pkgInfo.valid = (function () {
|
||||
if (_.intersection(pkgInfo.licenses, config.licenses).length > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
})();
|
||||
return pkgInfo;
|
||||
}
|
||||
|
||||
function dequeue(output) {
|
||||
checkQueueLength--;
|
||||
_.extend(result, output);
|
||||
|
||||
if (!checkQueueLength) {
|
||||
var licenseStats = _.map(result, processPackage);
|
||||
var invalidLicenses = _.filter(licenseStats, function (pkg) { return !pkg.valid;});
|
||||
|
||||
if (grunt.option('only-invalid')) {
|
||||
console.log(invalidLicenses);
|
||||
} else {
|
||||
console.log(licenseStats);
|
||||
}
|
||||
|
||||
if (invalidLicenses.length) {
|
||||
grunt.fail.warn('Non-confirming licenses: ' + _.pluck(invalidLicenses, 'name').join(', ') +
|
||||
'. Use --only-invalid for details.', invalidLicenses.length);
|
||||
}
|
||||
done();
|
||||
}
|
||||
}
|
||||
|
||||
bowerLicense.init(options, dequeue);
|
||||
npmLicense.init(options, function (allDependencies) {
|
||||
// Only check production NPM dependencies, not dev
|
||||
npm.load({production: true}, function () {
|
||||
npm.commands.list([], true, function (a, b, npmList) {
|
||||
|
||||
// Recurse npm --production --json ls output, create array of package@version
|
||||
var getDependencies = function (dependencies, list) {
|
||||
list = list || [];
|
||||
_.each(dependencies, function (info, dependency) {
|
||||
list.push(dependency + '@' + info.version);
|
||||
if (info.dependencies) {
|
||||
getDependencies(info.dependencies, list);
|
||||
}
|
||||
});
|
||||
return list;
|
||||
};
|
||||
|
||||
var productionDependencies = {};
|
||||
_.each(getDependencies(npmList.dependencies), function (packageAndVersion) {
|
||||
productionDependencies[packageAndVersion] = allDependencies[packageAndVersion];
|
||||
});
|
||||
dequeue(productionDependencies);
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
});
|
||||
};
|
|
@ -1,23 +1,5 @@
|
|||
var _ = require('lodash');
|
||||
module.exports = function (grunt) {
|
||||
function addTestTask(tasks) {
|
||||
var testTask = 'mocha:unit';
|
||||
|
||||
if (grunt.option('use-sauce') || process.env.TRAVIS) {
|
||||
if (!process.env.SAUCE_ACCESS_KEY) {
|
||||
grunt.log.writeln(grunt.log.wordlist([
|
||||
'>> SAUCE_ACCESS_KEY not set in env, running with Phantom'
|
||||
], {color: 'yellow'}));
|
||||
} else {
|
||||
testTask = 'saucelabs-mocha:unit';
|
||||
}
|
||||
}
|
||||
|
||||
tasks.push('simplemocha:all', testTask);
|
||||
|
||||
return testTask;
|
||||
}
|
||||
|
||||
grunt.registerTask('test', function () {
|
||||
if (grunt.option('quick')) {
|
||||
grunt.task.run('quick-test');
|
||||
|
@ -25,23 +7,27 @@ module.exports = function (grunt) {
|
|||
}
|
||||
|
||||
var tasks = [
|
||||
'licenses',
|
||||
'jshint:source',
|
||||
'jscs:source',
|
||||
'maybe_start_kibana',
|
||||
'jade',
|
||||
'less:build'
|
||||
'less:build',
|
||||
'simplemocha:all',
|
||||
'mocha:unit'
|
||||
];
|
||||
addTestTask(tasks);
|
||||
|
||||
if (process.env.TRAVIS) tasks.unshift('esvm:dev');
|
||||
|
||||
grunt.task.run(tasks);
|
||||
});
|
||||
|
||||
grunt.registerTask('quick-test', function () {
|
||||
var tasks = [
|
||||
'maybe_start_kibana'
|
||||
];
|
||||
addTestTask(tasks);
|
||||
grunt.task.run(tasks);
|
||||
grunt.task.run([
|
||||
'maybe_start_kibana',
|
||||
'simplemocha:all',
|
||||
'mocha:unit'
|
||||
]);
|
||||
});
|
||||
|
||||
grunt.registerTask('coverage', [
|
||||
|
|
|
@ -12,7 +12,6 @@
|
|||
/* globals mocha */
|
||||
|
||||
var COVERAGE = window.COVERAGE = !!(/coverage/i.test(window.location.search));
|
||||
var SAUCELABS = window.SAUCELABS = !!(/saucelabs/i.test(window.location.search));
|
||||
var DISABLE_RESIZE_CHECKER = window.DISABLE_RESIZE_CHECKER = true;
|
||||
|
||||
function wrap(obj, method, fn) {
|
||||
|
@ -54,9 +53,7 @@
|
|||
sinon: '../../test/utils/sinon',
|
||||
bluebird: 'bower_components/bluebird/js/browser/bluebird',
|
||||
angular: 'bower_components/angular-mocks/angular-mocks',
|
||||
angular_src: 'bower_components/angular/angular',
|
||||
screencast_reporter_css: '../../node_modules/mocha-screencast-reporter/screencast-reporter',
|
||||
ScreencastReporter: '../../node_modules/mocha-screencast-reporter/screencast-reporter'
|
||||
angular_src: 'bower_components/angular/angular'
|
||||
},
|
||||
shim: {
|
||||
angular_src: {
|
||||
|
@ -94,16 +91,6 @@
|
|||
});
|
||||
}
|
||||
|
||||
function setupSaucelabsReporter(done) {
|
||||
require([
|
||||
'ScreencastReporter',
|
||||
'css!screencast_reporter_css'
|
||||
], function (ScreencastReporter) {
|
||||
mocha.reporter(ScreencastReporter);
|
||||
done();
|
||||
});
|
||||
}
|
||||
|
||||
function runTests() {
|
||||
require([
|
||||
'text!specList',
|
||||
|
@ -169,15 +156,8 @@
|
|||
}
|
||||
|
||||
|
||||
if (COVERAGE) {
|
||||
setupCoverage(runTests);
|
||||
}
|
||||
else if (SAUCELABS) {
|
||||
setupSaucelabsReporter(runTests);
|
||||
}
|
||||
else {
|
||||
runTests();
|
||||
}
|
||||
if (COVERAGE) setupCoverage(runTests);
|
||||
else runTests();
|
||||
|
||||
})();</script>
|
||||
</head>
|
||||
|
|
|
@ -2,6 +2,11 @@ define(function (require) {
|
|||
var angular = require('angular');
|
||||
var _ = require('lodash');
|
||||
|
||||
var Data;
|
||||
var dataSeries = require('vislib_fixtures/mock_data/date_histogram/_series');
|
||||
var dataSeriesNeg = require('vislib_fixtures/mock_data/date_histogram/_series_neg');
|
||||
var dataStacked = require('vislib_fixtures/mock_data/stacked/_stacked');
|
||||
|
||||
var seriesData = {
|
||||
'label': '',
|
||||
'series': [
|
||||
|
@ -94,118 +99,31 @@ define(function (require) {
|
|||
]
|
||||
};
|
||||
|
||||
var seriesData2 = {
|
||||
'label': '',
|
||||
'series': [
|
||||
{
|
||||
'label': '100',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
},
|
||||
{
|
||||
'label': '200',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var rowsData2 = {
|
||||
'rows': [
|
||||
{
|
||||
'label': 'a',
|
||||
'series': [
|
||||
{
|
||||
'label': '100',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
},
|
||||
{
|
||||
'label': '200',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'label': 'b',
|
||||
'series': [
|
||||
{
|
||||
'label': '100',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
},
|
||||
{
|
||||
'label': '200',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var colsData2 = {
|
||||
'columns': [
|
||||
{
|
||||
'label': 'a',
|
||||
'series': [
|
||||
{
|
||||
'label': '100',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
},
|
||||
{
|
||||
'label': '200',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
'label': 'b',
|
||||
'series': [
|
||||
{
|
||||
'label': '100',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
},
|
||||
{
|
||||
'label': '200',
|
||||
'values': [{x: 0, y: 1}, {x: 1, y: 2}, {x: 2, y: 3}]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var flattenedData = [
|
||||
[{x: 0, y: 0}, {x: 1, y: 2}, {x: 2, y: 4}, {x: 3, y: 6}, {x: 4, y: 8}],
|
||||
[{x: 0, y: 0}, {x: 1, y: 2}, {x: 2, y: 4}, {x: 3, y: 6}, {x: 4, y: 8}],
|
||||
[{x: 0, y: 0}, {x: 1, y: 2}, {x: 2, y: 4}, {x: 3, y: 6}, {x: 4, y: 8}]
|
||||
];
|
||||
|
||||
angular.module('DataFactory', ['kibana']);
|
||||
|
||||
describe('Vislib Data Class Test Suite', function () {
|
||||
|
||||
beforeEach(function () {
|
||||
module('DataFactory');
|
||||
|
||||
inject(function (Private) {
|
||||
Data = Private(require('components/vislib/lib/data'));
|
||||
});
|
||||
});
|
||||
|
||||
describe('Data Class (main)', function () {
|
||||
var DataFactory;
|
||||
var rowIn;
|
||||
|
||||
beforeEach(function () {
|
||||
module('DataFactory');
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
inject(function (d3, Private) {
|
||||
DataFactory = Private(require('components/vislib/lib/data'));
|
||||
});
|
||||
rowIn = new DataFactory(rowsData, {});
|
||||
});
|
||||
|
||||
it('should be a function', function () {
|
||||
expect(_.isFunction(DataFactory)).to.be(true);
|
||||
expect(_.isFunction(Data)).to.be(true);
|
||||
});
|
||||
|
||||
it('should return an object', function () {
|
||||
var rowIn = new Data(rowsData, {});
|
||||
expect(_.isObject(rowIn)).to.be(true);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('_removeZeroSlices', function () {
|
||||
var data;
|
||||
var pieData = {
|
||||
slices: {
|
||||
children: [
|
||||
|
@ -215,19 +133,10 @@ define(function (require) {
|
|||
]
|
||||
}
|
||||
};
|
||||
var DataFactory;
|
||||
var data;
|
||||
|
||||
beforeEach(function () {
|
||||
module('DataFactory');
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
inject(function (Private) {
|
||||
DataFactory = Private(require('components/vislib/lib/data'));
|
||||
data = new DataFactory(pieData, {});
|
||||
data._removeZeroSlices(pieData.slices);
|
||||
});
|
||||
data = new Data(pieData, {});
|
||||
data._removeZeroSlices(pieData.slices);
|
||||
});
|
||||
|
||||
it('should remove zero values', function () {
|
||||
|
@ -237,7 +146,6 @@ define(function (require) {
|
|||
});
|
||||
|
||||
describe('Data.flatten', function () {
|
||||
var DataFactory;
|
||||
var serIn;
|
||||
var rowIn;
|
||||
var colIn;
|
||||
|
@ -246,16 +154,9 @@ define(function (require) {
|
|||
var colOut;
|
||||
|
||||
beforeEach(function () {
|
||||
module('DataFactory');
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
inject(function (d3, Private) {
|
||||
DataFactory = Private(require('components/vislib/lib/data'));
|
||||
});
|
||||
serIn = new DataFactory(seriesData, {});
|
||||
rowIn = new DataFactory(rowsData, {});
|
||||
colIn = new DataFactory(colsData, {});
|
||||
serIn = new Data(seriesData, {});
|
||||
rowIn = new Data(rowsData, {});
|
||||
colIn = new Data(colsData, {});
|
||||
serOut = serIn.flatten();
|
||||
rowOut = rowIn.flatten();
|
||||
colOut = colIn.flatten();
|
||||
|
@ -265,9 +166,13 @@ define(function (require) {
|
|||
expect(serOut.every(_.isObject)).to.be(true);
|
||||
});
|
||||
|
||||
it('should return all points from every series', testLength(seriesData));
|
||||
it('should return all points from every series', testLength(rowsData));
|
||||
it('should return all points from every series', testLength(colsData));
|
||||
|
||||
function testLength(inputData) {
|
||||
return function () {
|
||||
var data = new DataFactory(inputData, {});
|
||||
var data = new Data(inputData, {});
|
||||
var len = _.reduce(data.chartData(), function (sum, chart) {
|
||||
return sum + chart.series.reduce(function (sum, series) {
|
||||
return sum + series.values.length;
|
||||
|
@ -277,39 +182,20 @@ define(function (require) {
|
|||
expect(data.flatten()).to.have.length(len);
|
||||
};
|
||||
}
|
||||
|
||||
it('should return all points from every series', testLength(seriesData));
|
||||
it('should return all points from every series', testLength(rowsData));
|
||||
it('should return all points from every series', testLength(colsData));
|
||||
});
|
||||
|
||||
describe('getYMin method', function () {
|
||||
var Data;
|
||||
var dataSeries;
|
||||
var stackedDataSeries;
|
||||
var visData;
|
||||
var stackedVisData;
|
||||
var series;
|
||||
var stackedSeries;
|
||||
var minValue;
|
||||
var stackedMinValue;
|
||||
var visDataNeg;
|
||||
var visDataStacked;
|
||||
var minValue = 4;
|
||||
var minValueNeg = -41;
|
||||
var minValueStacked = 15;
|
||||
|
||||
beforeEach(function () {
|
||||
module('DataFactory');
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
inject(function (d3, Private) {
|
||||
Data = Private(require('components/vislib/lib/data'));
|
||||
dataSeries = require('vislib_fixtures/mock_data/date_histogram/_series');
|
||||
stackedDataSeries = require('vislib_fixtures/mock_data/stacked/_stacked');
|
||||
visData = new Data(dataSeries, {});
|
||||
stackedVisData = new Data(stackedDataSeries, { type: 'histogram' });
|
||||
series = _.pluck(visData.chartData(), 'series');
|
||||
stackedSeries = _.pluck(stackedVisData.chartData(), 'series');
|
||||
minValue = 4;
|
||||
stackedMinValue = 15;
|
||||
});
|
||||
visData = new Data(dataSeries, {});
|
||||
visDataNeg = new Data(dataSeriesNeg, {});
|
||||
visDataStacked = new Data(dataStacked, { type: 'histogram' });
|
||||
});
|
||||
|
||||
// The first value in the time series is less than the min date in the
|
||||
|
@ -317,12 +203,15 @@ define(function (require) {
|
|||
// when calculating the Y max value since it falls outside of the range.
|
||||
it('should return the Y domain min value', function () {
|
||||
expect(visData.getYMin()).to.be(minValue);
|
||||
expect(stackedVisData.getYMin()).to.be(stackedMinValue);
|
||||
expect(visDataNeg.getYMin()).to.be(minValueNeg);
|
||||
expect(visDataStacked.getYMin()).to.be(minValueStacked);
|
||||
});
|
||||
|
||||
it('should have a minimum date value that is greater than the max value within the date range', function () {
|
||||
var series = _.pluck(visData.chartData(), 'series');
|
||||
var stackedSeries = _.pluck(visDataStacked.chartData(), 'series');
|
||||
expect(_.min(series.values, function (d) { return d.x; })).to.be.greaterThan(minValue);
|
||||
expect(_.min(stackedSeries.values, function (d) { return d.x; })).to.be.greaterThan(stackedMinValue);
|
||||
expect(_.min(stackedSeries.values, function (d) { return d.x; })).to.be.greaterThan(minValueStacked);
|
||||
});
|
||||
|
||||
it('allows passing a value getter for manipulating the values considered', function () {
|
||||
|
@ -333,32 +222,17 @@ define(function (require) {
|
|||
});
|
||||
|
||||
describe('getYMax method', function () {
|
||||
var Data;
|
||||
var dataSeries;
|
||||
var stackedDataSeries;
|
||||
var visData;
|
||||
var stackedVisData;
|
||||
var series;
|
||||
var stackedSeries;
|
||||
var maxValue;
|
||||
var stackedMaxValue;
|
||||
var visDataNeg;
|
||||
var visDataStacked;
|
||||
var maxValue = 41;
|
||||
var maxValueNeg = -4;
|
||||
var maxValueStacked = 115;
|
||||
|
||||
beforeEach(function () {
|
||||
module('DataFactory');
|
||||
});
|
||||
|
||||
beforeEach(function () {
|
||||
inject(function (d3, Private) {
|
||||
Data = Private(require('components/vislib/lib/data'));
|
||||
dataSeries = require('vislib_fixtures/mock_data/date_histogram/_series');
|
||||
stackedDataSeries = require('vislib_fixtures/mock_data/stacked/_stacked');
|
||||
visData = new Data(dataSeries, {});
|
||||
stackedVisData = new Data(stackedDataSeries, { type: 'histogram' });
|
||||
series = _.pluck(visData.chartData(), 'series');
|
||||
stackedSeries = _.pluck(stackedVisData.chartData(), 'series');
|
||||
maxValue = 41;
|
||||
stackedMaxValue = 115;
|
||||
});
|
||||
visData = new Data(dataSeries, {});
|
||||
visDataNeg = new Data(dataSeriesNeg, {});
|
||||
visDataStacked = new Data(dataStacked, { type: 'histogram' });
|
||||
});
|
||||
|
||||
// The first value in the time series is less than the min date in the
|
||||
|
@ -366,12 +240,15 @@ define(function (require) {
|
|||
// when calculating the Y max value since it falls outside of the range.
|
||||
it('should return the Y domain min value', function () {
|
||||
expect(visData.getYMax()).to.be(maxValue);
|
||||
expect(stackedVisData.getYMax()).to.be(stackedMaxValue);
|
||||
expect(visDataNeg.getYMax()).to.be(maxValueNeg);
|
||||
expect(visDataStacked.getYMax()).to.be(maxValueStacked);
|
||||
});
|
||||
|
||||
it('should have a minimum date value that is greater than the max value within the date range', function () {
|
||||
var series = _.pluck(visData.chartData(), 'series');
|
||||
var stackedSeries = _.pluck(visDataStacked.chartData(), 'series');
|
||||
expect(_.min(series, function (d) { return d.x; })).to.be.greaterThan(maxValue);
|
||||
expect(_.min(stackedSeries, function (d) { return d.x; })).to.be.greaterThan(stackedMaxValue);
|
||||
expect(_.min(stackedSeries, function (d) { return d.x; })).to.be.greaterThan(maxValueStacked);
|
||||
});
|
||||
|
||||
it('allows passing a value getter for manipulating the values considered', function () {
|
||||
|
|
|
@ -11,41 +11,31 @@ define(function (require) {
|
|||
var termsColumns = require('vislib_fixtures/mock_data/terms/_columns');
|
||||
//var histogramRows = require('vislib_fixtures/mock_data/histogram/_rows');
|
||||
var stackedSeries = require('vislib_fixtures/mock_data/date_histogram/_stacked_series');
|
||||
var dataArray = [
|
||||
series,
|
||||
seriesPosNeg,
|
||||
seriesNeg,
|
||||
termsColumns,
|
||||
//histogramRows,
|
||||
stackedSeries
|
||||
];
|
||||
var names = [
|
||||
'series',
|
||||
'series with positive and negative values',
|
||||
'series with negative values',
|
||||
'terms columns',
|
||||
//'histogram rows',
|
||||
'stackedSeries'
|
||||
];
|
||||
var modes = [
|
||||
'stacked',
|
||||
'stacked',
|
||||
'stacked',
|
||||
'grouped',
|
||||
//'percentage',
|
||||
'stacked'
|
||||
|
||||
// tuple, with the format [description, mode, data]
|
||||
var dataTypesArray = [
|
||||
['series', 'stacked', series],
|
||||
['series with positive and negative values', 'stacked', seriesPosNeg],
|
||||
['series with negative values', 'stacked', seriesNeg],
|
||||
['terms columns', 'grouped', termsColumns],
|
||||
// ['histogram rows', 'percentage', histogramRows],
|
||||
['stackedSeries', 'stacked', stackedSeries],
|
||||
];
|
||||
|
||||
angular.module('ColumnChartFactory', ['kibana']);
|
||||
|
||||
dataArray.forEach(function (data, i) {
|
||||
describe('VisLib Column Chart Test Suite for ' + names[i] + ' Data', function () {
|
||||
dataTypesArray.forEach(function (dataType, i) {
|
||||
var name = dataType[0];
|
||||
var mode = dataType[1];
|
||||
var data = dataType[2];
|
||||
|
||||
describe('VisLib Column Chart Test Suite for ' + name + ' Data', function () {
|
||||
var vis;
|
||||
var visLibParams = {
|
||||
type: 'histogram',
|
||||
addLegend: true,
|
||||
addTooltip: true,
|
||||
mode: modes[i]
|
||||
mode: mode
|
||||
};
|
||||
|
||||
beforeEach(function () {
|
||||
|
@ -206,10 +196,11 @@ define(function (require) {
|
|||
it('should return yAxis extents equal to data extents', function () {
|
||||
vis.handler.charts.forEach(function (chart) {
|
||||
var yAxis = chart.handler.yAxis;
|
||||
var yVals = [vis.handler.data.getYMin(), vis.handler.data.getYMax()];
|
||||
var min = vis.handler.data.getYMin();
|
||||
var max = vis.handler.data.getYMax();
|
||||
|
||||
expect(yAxis.domain[0]).to.equal(yVals[0]);
|
||||
expect(yAxis.domain[1]).to.equal(yVals[1]);
|
||||
expect(yAxis.domain[0]).to.equal(min);
|
||||
expect(yAxis.domain[1]).to.equal(max);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue