mirror of
https://github.com/elastic/kibana.git
synced 2025-04-24 01:38:56 -04:00
Merge branch 'master' into feature/ingest
This commit is contained in:
commit
0e7ffff4ce
289 changed files with 1517 additions and 1218 deletions
|
@ -10,7 +10,7 @@ module.exports = function ({ Plugin }) {
|
|||
require: ['kibana'],
|
||||
|
||||
config(Joi) {
|
||||
const { array, boolean, number, object, string } = Joi;
|
||||
const { array, boolean, number, object, string, ref } = Joi;
|
||||
|
||||
return object({
|
||||
enabled: boolean().default(true),
|
||||
|
@ -20,7 +20,7 @@ module.exports = function ({ Plugin }) {
|
|||
password: string(),
|
||||
shardTimeout: number().default(0),
|
||||
requestTimeout: number().default(30000),
|
||||
pingTimeout: number().default(30000),
|
||||
pingTimeout: number().default(ref('requestTimeout')),
|
||||
startupTimeout: number().default(5000),
|
||||
ssl: object({
|
||||
verify: boolean().default(true),
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
</button>
|
||||
<button
|
||||
aria-label="Save Dashboard"
|
||||
aria-haspopup="false"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="{{ configTemplate.is('save') }}"
|
||||
ng-class="{active: configTemplate.is('save')}"
|
||||
ng-click="configTemplate.toggle('save');">
|
||||
|
@ -21,7 +21,7 @@
|
|||
</button>
|
||||
<button
|
||||
aria-label="Load Saved Dashboard"
|
||||
aria-haspopup="false"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="{{ configTemplate.is('load') }}"
|
||||
ng-class="{active: configTemplate.is('load')}"
|
||||
ng-click="configTemplate.toggle('load');">
|
||||
|
@ -29,7 +29,7 @@
|
|||
</button>
|
||||
<button
|
||||
aria-label="Share Dashboard"
|
||||
aria-haspopup="false"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="{{ configTemplate.is('share') }}"
|
||||
ng-class="{active: configTemplate.is('share')}"
|
||||
ng-click="configTemplate.toggle('share');">
|
||||
|
@ -37,7 +37,7 @@
|
|||
</button>
|
||||
<button
|
||||
aria-label="Add Visualization"
|
||||
aria-haspopup="false"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="{{ configTemplate.is('pickVis') }}"
|
||||
ng-class="{active: configTemplate.is('pickVis')}"
|
||||
ng-click="configTemplate.toggle('pickVis');">
|
||||
|
@ -45,7 +45,7 @@
|
|||
</button>
|
||||
<button
|
||||
aria-label="Options"
|
||||
aria-haspopup="false"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="{{ configTemplate.is('options') }}"
|
||||
ng-class="{active: configTemplate.is('options')}"
|
||||
ng-click="configTemplate.toggle('options');">
|
||||
|
|
|
@ -18,13 +18,13 @@
|
|||
<button
|
||||
ng-click="configTemplate.toggle('save');"
|
||||
ng-class="{active: configTemplate.is('save')}"
|
||||
aria-haspopup="false"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="{{ configTemplate.is('save') }}"
|
||||
aria-label="Save Search">
|
||||
<span>Save</span>
|
||||
</button>
|
||||
<button
|
||||
aria-haspopup="false"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="{{ configTemplate.is('load') }}"
|
||||
ng-click="configTemplate.toggle('load');"
|
||||
ng-class="{active: configTemplate.is('load')}"
|
||||
|
@ -33,7 +33,7 @@
|
|||
</button>
|
||||
<button
|
||||
aria-label="Share Search"
|
||||
aria-haspopup="false"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="{{ configTemplate.is('share') }}"
|
||||
ng-class="{active: configTemplate.is('share')}"
|
||||
ng-click="configTemplate.toggle('share');">
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
ng-class="{active: configTemplate.is('save')}"
|
||||
ng-click="configTemplate.toggle('save')"
|
||||
ng-if="!editableVis.dirty"
|
||||
aria-haspopup="true"
|
||||
aria-expanded="{{ configTemplate.is('save') }}"
|
||||
aria-label="Save Visualization">
|
||||
<span>Save</span>
|
||||
|
|
|
@ -13,6 +13,14 @@
|
|||
padding: 0;
|
||||
display: flex;
|
||||
|
||||
div.wizard-small {
|
||||
flex: 2;
|
||||
}
|
||||
|
||||
div.wizard-large {
|
||||
flex: 3;
|
||||
}
|
||||
|
||||
.wizard-column {
|
||||
flex: 1;
|
||||
display: flex;
|
||||
|
@ -45,11 +53,6 @@
|
|||
|
||||
.list-group {
|
||||
margin-bottom: 0;
|
||||
|
||||
.list-group-item {
|
||||
border-radius: 0;
|
||||
border: none;
|
||||
}
|
||||
}
|
||||
|
||||
.striped {
|
||||
|
|
|
@ -1,20 +1,15 @@
|
|||
<bread-crumbs></bread-crumbs>
|
||||
<div class="wizard">
|
||||
<div class="wizard-column">
|
||||
<h3>From a New Search</h3>
|
||||
<!-- Index patterns -->
|
||||
<div class="wizard-row">
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-heading">Index Patterns</div>
|
||||
</div>
|
||||
<ul class="striped list-group">
|
||||
<li class="list-group-item" ng-repeat="pattern in indexPattern.list | orderBy: 'toString()'">
|
||||
<a class="index-link" kbn-href="{{ makeUrl(pattern) }}">{{pattern}}</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="wizard-small wizard-column">
|
||||
<h3>From a New Search, Select Index</h3>
|
||||
<paginated-selectable-list
|
||||
per-page="20"
|
||||
list="indexPattern.list"
|
||||
user-make-url="makeUrl"
|
||||
class="wizard-row">
|
||||
</paginated-selectable-list>
|
||||
</div>
|
||||
<div class="wizard-column">
|
||||
<div class="wizard-large wizard-column">
|
||||
<h3>Or, From a Saved Search</h3>
|
||||
<!-- Saved searches -->
|
||||
<saved-object-finder
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import _ from 'lodash';
|
||||
import 'plugins/kibana/visualize/saved_visualizations/saved_visualizations';
|
||||
import 'ui/directives/saved_object_finder';
|
||||
import 'ui/directives/paginated_selectable_list';
|
||||
import 'plugins/kibana/discover/saved_searches/saved_searches';
|
||||
import routes from 'ui/routes';
|
||||
import RegistryVisTypesProvider from 'ui/registry/vis_types';
|
||||
|
|
|
@ -85,7 +85,7 @@ describe('lib/config/config', function () {
|
|||
|
||||
describe('#resetTo(object)', function () {
|
||||
|
||||
var config;
|
||||
let config;
|
||||
beforeEach(function () {
|
||||
config = new Config(schema);
|
||||
});
|
||||
|
@ -102,7 +102,7 @@ describe('lib/config/config', function () {
|
|||
|
||||
describe('#has(key)', function () {
|
||||
|
||||
var config;
|
||||
let config;
|
||||
beforeEach(function () {
|
||||
config = new Config(schema);
|
||||
});
|
||||
|
@ -122,7 +122,7 @@ describe('lib/config/config', function () {
|
|||
});
|
||||
|
||||
describe('#set(key, value)', function () {
|
||||
var config;
|
||||
let config;
|
||||
|
||||
beforeEach(function () {
|
||||
config = new Config(schema);
|
||||
|
@ -171,7 +171,7 @@ describe('lib/config/config', function () {
|
|||
|
||||
describe('#get(key)', function () {
|
||||
|
||||
var config;
|
||||
let config;
|
||||
|
||||
beforeEach(function () {
|
||||
config = new Config(schema);
|
||||
|
@ -210,7 +210,7 @@ describe('lib/config/config', function () {
|
|||
});
|
||||
|
||||
describe('#extendSchema(key, schema)', function () {
|
||||
var config;
|
||||
let config;
|
||||
beforeEach(function () {
|
||||
config = new Config(schema);
|
||||
});
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import _ from 'lodash';
|
||||
module.exports = function (dot, nestedObj, flattenArrays) {
|
||||
var key; // original key
|
||||
let key; // original key
|
||||
var stack = []; // track key stack
|
||||
var flatObj = {};
|
||||
(function flattenObj(obj) {
|
||||
|
|
|
@ -7,8 +7,8 @@ import Status from '../status';
|
|||
import ServerStatus from '../server_status';
|
||||
|
||||
describe('ServerStatus class', function () {
|
||||
var server;
|
||||
var serverStatus;
|
||||
let server;
|
||||
let serverStatus;
|
||||
|
||||
beforeEach(function () {
|
||||
server = { expose: sinon.stub(), log: sinon.stub() };
|
||||
|
|
|
@ -4,8 +4,8 @@ import Status from '../status';
|
|||
import ServerStatus from '../server_status';
|
||||
|
||||
describe('Status class', function () {
|
||||
var server;
|
||||
var serverStatus;
|
||||
let server;
|
||||
let serverStatus;
|
||||
|
||||
beforeEach(function () {
|
||||
server = { expose: sinon.stub(), log: sinon.stub() };
|
||||
|
|
|
@ -9,11 +9,11 @@ import AggResponseTabifyTabifyProvider from 'ui/agg_response/tabify/tabify';
|
|||
import AggResponseGeoJsonGeoJsonProvider from 'ui/agg_response/geo_json/geo_json';
|
||||
|
||||
describe('GeoJson Agg Response Converter', function () {
|
||||
var vis;
|
||||
var tabify;
|
||||
var convert;
|
||||
var esResponse;
|
||||
var aggs;
|
||||
let vis;
|
||||
let tabify;
|
||||
let convert;
|
||||
let esResponse;
|
||||
let aggs;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
@ -108,10 +108,10 @@ describe('GeoJson Agg Response Converter', function () {
|
|||
describe('includes one feature per row in the table', function () {
|
||||
this.timeout(60000);
|
||||
|
||||
var table;
|
||||
var chart;
|
||||
var geoColI;
|
||||
var metricColI;
|
||||
let table;
|
||||
let chart;
|
||||
let geoColI;
|
||||
let metricColI;
|
||||
|
||||
before(function () {
|
||||
table = makeTable();
|
||||
|
|
|
@ -4,7 +4,7 @@ import expect from 'expect.js';
|
|||
describe('buildHierarchicalData()', function () {
|
||||
describe('arrayToLinkedList', function () {
|
||||
|
||||
var results;
|
||||
let results;
|
||||
beforeEach(function () {
|
||||
results = arrayToLinkedList([
|
||||
{ id: 1 },
|
||||
|
|
|
@ -9,11 +9,11 @@ import VisAggConfigsProvider from 'ui/vis/agg_configs';
|
|||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
import AggResponseHierarchicalBuildHierarchicalDataProvider from 'ui/agg_response/hierarchical/build_hierarchical_data';
|
||||
|
||||
var Vis;
|
||||
var Notifier;
|
||||
var AggConfigs;
|
||||
var indexPattern;
|
||||
var buildHierarchicalData;
|
||||
let Vis;
|
||||
let Notifier;
|
||||
let AggConfigs;
|
||||
let indexPattern;
|
||||
let buildHierarchicalData;
|
||||
|
||||
describe('buildHierarchicalData', function () {
|
||||
|
||||
|
@ -31,8 +31,8 @@ describe('buildHierarchicalData', function () {
|
|||
|
||||
|
||||
describe('metric only', function () {
|
||||
var vis;
|
||||
var results;
|
||||
let vis;
|
||||
let results;
|
||||
|
||||
beforeEach(function () {
|
||||
var id = 1;
|
||||
|
@ -103,8 +103,8 @@ describe('buildHierarchicalData', function () {
|
|||
});
|
||||
|
||||
describe('threeTermBuckets', function () {
|
||||
var vis;
|
||||
var results;
|
||||
let vis;
|
||||
let results;
|
||||
|
||||
beforeEach(function () {
|
||||
var id = 1;
|
||||
|
@ -145,8 +145,8 @@ describe('buildHierarchicalData', function () {
|
|||
});
|
||||
|
||||
describe('oneHistogramBucket', function () {
|
||||
var vis;
|
||||
var results;
|
||||
let vis;
|
||||
let results;
|
||||
|
||||
beforeEach(function () {
|
||||
var id = 1;
|
||||
|
@ -177,8 +177,8 @@ describe('buildHierarchicalData', function () {
|
|||
});
|
||||
|
||||
describe('oneRangeBucket', function () {
|
||||
var vis;
|
||||
var results;
|
||||
let vis;
|
||||
let results;
|
||||
|
||||
beforeEach(function () {
|
||||
var id = 1;
|
||||
|
@ -218,8 +218,8 @@ describe('buildHierarchicalData', function () {
|
|||
});
|
||||
|
||||
describe('oneFilterBucket', function () {
|
||||
var vis;
|
||||
var results;
|
||||
let vis;
|
||||
let results;
|
||||
|
||||
beforeEach(function () {
|
||||
var id = 1;
|
||||
|
@ -254,8 +254,8 @@ describe('buildHierarchicalData', function () {
|
|||
});
|
||||
|
||||
describe('oneFilterBucket that is a split', function () {
|
||||
var vis;
|
||||
var results;
|
||||
let vis;
|
||||
let results;
|
||||
|
||||
beforeEach(function () {
|
||||
var id = 1;
|
||||
|
|
|
@ -3,7 +3,7 @@ import _ from 'lodash';
|
|||
import collectBranch from 'ui/agg_response/hierarchical/_collect_branch';
|
||||
import expect from 'expect.js';
|
||||
describe('collectBranch()', function () {
|
||||
var results;
|
||||
let results;
|
||||
var convert = function (name) {
|
||||
return 'converted:' + name;
|
||||
};
|
||||
|
|
|
@ -9,14 +9,14 @@ import VisProvider from 'ui/vis';
|
|||
import VisAggConfigsProvider from 'ui/vis/agg_configs';
|
||||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
|
||||
var AggConfigs;
|
||||
var Vis;
|
||||
var indexPattern;
|
||||
let AggConfigs;
|
||||
let Vis;
|
||||
let indexPattern;
|
||||
|
||||
describe('buildHierarchicalData()', function () {
|
||||
describe('createRawData()', function () {
|
||||
var vis;
|
||||
var results;
|
||||
let vis;
|
||||
let results;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
||||
|
|
|
@ -5,8 +5,8 @@ import AggResponseHierarchicalTransformAggregationProvider from 'ui/agg_response
|
|||
|
||||
describe('buildHierarchicalData()', function () {
|
||||
describe('transformAggregation()', function () {
|
||||
var transform;
|
||||
var fixture;
|
||||
let transform;
|
||||
let fixture;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import _ from 'lodash';
|
||||
export default function (buckets) {
|
||||
var previous;
|
||||
let previous;
|
||||
_.each(buckets, function (bucket) {
|
||||
if (previous) {
|
||||
bucket._previous = previous;
|
||||
|
|
|
@ -21,7 +21,7 @@ export default function HierarchicalTooltipFormaterProvider($rootScope, $compile
|
|||
_.forEachRight($tooltipScope.rows, function (row, i, rows) {
|
||||
row.spacer = $sce.trustAsHtml(_.repeat(' ', row.depth));
|
||||
|
||||
var percent;
|
||||
let percent;
|
||||
if (row.item.percentOfGroup != null) {
|
||||
percent = row.item.percentOfGroup;
|
||||
}
|
||||
|
|
|
@ -2,7 +2,7 @@ import expect from 'expect.js';
|
|||
import ngMock from 'ng_mock';
|
||||
import AggResponsePointSeriesAddToSiriProvider from 'ui/agg_response/point_series/_add_to_siri';
|
||||
describe('addToSiri', function () {
|
||||
var addToSiri;
|
||||
let addToSiri;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -6,11 +6,11 @@ import AggTypesAggTypeProvider from 'ui/agg_types/agg_type';
|
|||
import AggResponsePointSeriesFakeXAspectProvider from 'ui/agg_response/point_series/_fake_x_aspect';
|
||||
describe('makeFakeXAspect', function () {
|
||||
|
||||
var makeFakeXAspect;
|
||||
var Vis;
|
||||
var AggType;
|
||||
var AggConfig;
|
||||
var indexPattern;
|
||||
let makeFakeXAspect;
|
||||
let Vis;
|
||||
let AggType;
|
||||
let AggConfig;
|
||||
let indexPattern;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -9,11 +9,11 @@ import AggResponsePointSeriesGetAspectsProvider from 'ui/agg_response/point_seri
|
|||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
describe('getAspects', function () {
|
||||
|
||||
var Vis;
|
||||
var Table;
|
||||
var AggConfig;
|
||||
var indexPattern;
|
||||
var getAspects;
|
||||
let Vis;
|
||||
let Table;
|
||||
let AggConfig;
|
||||
let indexPattern;
|
||||
let getAspects;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
@ -24,8 +24,8 @@ describe('getAspects', function () {
|
|||
indexPattern = Private(FixturesStubbedLogstashIndexPatternProvider);
|
||||
}));
|
||||
|
||||
var vis;
|
||||
var table;
|
||||
let vis;
|
||||
let table;
|
||||
|
||||
var date = _.memoize(function (n) {
|
||||
return moment().startOf('day').add(n, 'hour').valueOf();
|
||||
|
|
|
@ -5,7 +5,7 @@ import AggResponsePointSeriesGetPointProvider from 'ui/agg_response/point_series
|
|||
|
||||
describe('getPoint', function () {
|
||||
|
||||
var getPoint;
|
||||
let getPoint;
|
||||
|
||||
var truthFormatted = { fieldFormatter: _.constant(_.constant(true)) };
|
||||
var identFormatted = { fieldFormatter: _.constant(_.identity) };
|
||||
|
@ -16,10 +16,10 @@ describe('getPoint', function () {
|
|||
}));
|
||||
|
||||
describe('Without series aspect', function () {
|
||||
var seriesAspect;
|
||||
var xAspect;
|
||||
var yAspect;
|
||||
var yScale;
|
||||
let seriesAspect;
|
||||
let xAspect;
|
||||
let yAspect;
|
||||
let yScale;
|
||||
|
||||
beforeEach(function () {
|
||||
seriesAspect = null;
|
||||
|
@ -49,10 +49,10 @@ describe('getPoint', function () {
|
|||
});
|
||||
|
||||
describe('With series aspect', function () {
|
||||
var row;
|
||||
var xAspect;
|
||||
var yAspect;
|
||||
var yScale;
|
||||
let row;
|
||||
let xAspect;
|
||||
let yAspect;
|
||||
let yScale;
|
||||
|
||||
beforeEach(function () {
|
||||
row = [ { value: 1 }, { value: 2 }, { value: 3 }];
|
||||
|
|
|
@ -3,7 +3,7 @@ import expect from 'expect.js';
|
|||
import ngMock from 'ng_mock';
|
||||
import AggResponsePointSeriesGetSeriesProvider from 'ui/agg_response/point_series/_get_series';
|
||||
describe('getSeries', function () {
|
||||
var getSeries;
|
||||
let getSeries;
|
||||
|
||||
var agg = { fieldFormatter: _.constant(_.identity) };
|
||||
|
||||
|
|
|
@ -4,7 +4,7 @@ import ngMock from 'ng_mock';
|
|||
import AggResponsePointSeriesInitXAxisProvider from 'ui/agg_response/point_series/_init_x_axis';
|
||||
describe('initXAxis', function () {
|
||||
|
||||
var initXAxis;
|
||||
let initXAxis;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -4,7 +4,7 @@ import ngMock from 'ng_mock';
|
|||
import AggResponsePointSeriesInitYAxisProvider from 'ui/agg_response/point_series/_init_y_axis';
|
||||
describe('initYAxis', function () {
|
||||
|
||||
var initYAxis;
|
||||
let initYAxis;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -11,10 +11,10 @@ describe('pointSeriesChartDataFromTable', function () {
|
|||
this.slow(1000);
|
||||
|
||||
|
||||
var pointSeriesChartDataFromTable;
|
||||
var indexPattern;
|
||||
var Table;
|
||||
var Vis;
|
||||
let pointSeriesChartDataFromTable;
|
||||
let indexPattern;
|
||||
let Table;
|
||||
let Vis;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -28,7 +28,7 @@ describe('orderedDateAxis', function () {
|
|||
}
|
||||
};
|
||||
|
||||
var orderedDateAxis;
|
||||
let orderedDateAxis;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -5,7 +5,7 @@ import ngMock from 'ng_mock';
|
|||
import AggResponsePointSeriesTooltipFormatterProvider from 'ui/agg_response/point_series/_tooltip_formatter';
|
||||
describe('tooltipFormatter', function () {
|
||||
|
||||
var tooltipFormatter;
|
||||
let tooltipFormatter;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -37,7 +37,7 @@ export default function PointSeriesGetSeries(Private) {
|
|||
if (multiY) {
|
||||
series = _.sortBy(series, function (siri) {
|
||||
var firstVal = siri.values[0];
|
||||
var y;
|
||||
let y;
|
||||
|
||||
if (firstVal) {
|
||||
var agg = firstVal.aggConfigResult.aggConfig;
|
||||
|
|
|
@ -2,7 +2,7 @@ import expect from 'expect.js';
|
|||
import ngMock from 'ng_mock';
|
||||
import AggResponseTabifyBucketsProvider from 'ui/agg_response/tabify/_buckets';
|
||||
describe('Buckets wrapper', function () {
|
||||
var Buckets;
|
||||
let Buckets;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private, $injector) {
|
||||
|
|
|
@ -4,9 +4,9 @@ import AggResponseTabifyGetColumnsProvider from 'ui/agg_response/tabify/_get_col
|
|||
import VisProvider from 'ui/vis';
|
||||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
describe('get columns', function () {
|
||||
var getColumns;
|
||||
var Vis;
|
||||
var indexPattern;
|
||||
let getColumns;
|
||||
let Vis;
|
||||
let indexPattern;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private, $injector) {
|
||||
|
|
|
@ -7,10 +7,10 @@ import VisProvider from 'ui/vis';
|
|||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
describe('tabifyAggResponse Integration', function () {
|
||||
|
||||
var Vis;
|
||||
var Buckets;
|
||||
var indexPattern;
|
||||
var tabifyAggResponse;
|
||||
let Vis;
|
||||
let Buckets;
|
||||
let indexPattern;
|
||||
let tabifyAggResponse;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private, $injector) {
|
||||
|
@ -46,12 +46,12 @@ describe('tabifyAggResponse Integration', function () {
|
|||
describe('transforms a complex response', function () {
|
||||
this.slow(1000);
|
||||
|
||||
var vis;
|
||||
var avg;
|
||||
var ext;
|
||||
var src;
|
||||
var os;
|
||||
var esResp;
|
||||
let vis;
|
||||
let avg;
|
||||
let ext;
|
||||
let src;
|
||||
let os;
|
||||
let esResp;
|
||||
|
||||
beforeEach(function () {
|
||||
vis = new Vis(indexPattern, {
|
||||
|
|
|
@ -10,14 +10,14 @@ import VisProvider from 'ui/vis';
|
|||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
describe('ResponseWriter class', function () {
|
||||
|
||||
var Vis;
|
||||
var Table;
|
||||
var Buckets;
|
||||
var Private;
|
||||
var TableGroup;
|
||||
var getColumns;
|
||||
var indexPattern;
|
||||
var ResponseWriter;
|
||||
let Vis;
|
||||
let Table;
|
||||
let Buckets;
|
||||
let Private;
|
||||
let TableGroup;
|
||||
let getColumns;
|
||||
let indexPattern;
|
||||
let ResponseWriter;
|
||||
|
||||
function defineSetup(stubGetColumns) {
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
|
|
@ -4,7 +4,7 @@ import ngMock from 'ng_mock';
|
|||
import AggResponseTabifyTableProvider from 'ui/agg_response/tabify/_table';
|
||||
describe('Table class', function () {
|
||||
|
||||
var Table;
|
||||
let Table;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private, $injector) {
|
||||
|
|
|
@ -2,7 +2,7 @@ import expect from 'expect.js';
|
|||
import ngMock from 'ng_mock';
|
||||
import AggResponseTabifyTableGroupProvider from 'ui/agg_response/tabify/_table_group';
|
||||
describe('Table Group class', function () {
|
||||
var TableGroup;
|
||||
let TableGroup;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private, $injector) {
|
||||
|
|
|
@ -8,11 +8,11 @@ import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logsta
|
|||
import VisProvider from 'ui/vis';
|
||||
describe('AggTableGroup Directive', function () {
|
||||
|
||||
var $rootScope;
|
||||
var $compile;
|
||||
var tabifyAggResponse;
|
||||
var Vis;
|
||||
var indexPattern;
|
||||
let $rootScope;
|
||||
let $compile;
|
||||
let tabifyAggResponse;
|
||||
let Vis;
|
||||
let indexPattern;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function ($injector, Private) {
|
||||
|
@ -24,7 +24,7 @@ describe('AggTableGroup Directive', function () {
|
|||
$compile = $injector.get('$compile');
|
||||
}));
|
||||
|
||||
var $scope;
|
||||
let $scope;
|
||||
beforeEach(function () {
|
||||
$scope = $rootScope.$new();
|
||||
});
|
||||
|
|
|
@ -9,11 +9,11 @@ import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logsta
|
|||
import VisProvider from 'ui/vis';
|
||||
describe('AggTable Directive', function () {
|
||||
|
||||
var $rootScope;
|
||||
var $compile;
|
||||
var tabifyAggResponse;
|
||||
var Vis;
|
||||
var indexPattern;
|
||||
let $rootScope;
|
||||
let $compile;
|
||||
let tabifyAggResponse;
|
||||
let Vis;
|
||||
let indexPattern;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function ($injector, Private) {
|
||||
|
@ -25,7 +25,7 @@ describe('AggTable Directive', function () {
|
|||
$compile = $injector.get('$compile');
|
||||
}));
|
||||
|
||||
var $scope;
|
||||
let $scope;
|
||||
beforeEach(function () {
|
||||
$scope = $rootScope.$new();
|
||||
});
|
||||
|
@ -134,7 +134,7 @@ describe('AggTable Directive', function () {
|
|||
});
|
||||
|
||||
describe('aggTable.exportAsCsv()', function () {
|
||||
var origBlob;
|
||||
let origBlob;
|
||||
function FakeBlob(slices, opts) {
|
||||
this.slices = slices;
|
||||
this.opts = opts;
|
||||
|
|
|
@ -8,11 +8,11 @@ import AggTypesParamTypesOptionedProvider from 'ui/agg_types/param_types/optione
|
|||
import AggTypesParamTypesRegexProvider from 'ui/agg_types/param_types/regex';
|
||||
describe('AggParams class', function () {
|
||||
|
||||
var AggParams;
|
||||
var BaseAggParam;
|
||||
var FieldAggParam;
|
||||
var OptionedAggParam;
|
||||
var RegexAggParam;
|
||||
let AggParams;
|
||||
let BaseAggParam;
|
||||
let FieldAggParam;
|
||||
let OptionedAggParam;
|
||||
let RegexAggParam;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
// stub out the param classes before we get the AggParams
|
||||
|
|
|
@ -10,12 +10,12 @@ import AggTypesAggTypeProvider from 'ui/agg_types/agg_type';
|
|||
import VisAggConfigProvider from 'ui/vis/agg_config';
|
||||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
describe('AggType Class', function () {
|
||||
var AggType;
|
||||
var AggParams;
|
||||
var AggConfig;
|
||||
var indexPattern;
|
||||
var fieldFormat;
|
||||
var Vis;
|
||||
let AggType;
|
||||
let AggParams;
|
||||
let AggConfig;
|
||||
let indexPattern;
|
||||
let fieldFormat;
|
||||
let Vis;
|
||||
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
|
|
@ -8,12 +8,12 @@ import AggTypesIndexProvider from 'ui/agg_types/index';
|
|||
import VisAggConfigProvider from 'ui/vis/agg_config';
|
||||
import AggTypesBucketsBucketCountBetweenProvider from 'ui/agg_types/buckets/_bucket_count_between';
|
||||
describe('bucketCountBetween util', function () {
|
||||
var indexPattern;
|
||||
var Vis;
|
||||
var visTypes;
|
||||
var aggTypes;
|
||||
var AggConfig;
|
||||
var bucketCountBetween;
|
||||
let indexPattern;
|
||||
let Vis;
|
||||
let visTypes;
|
||||
let aggTypes;
|
||||
let AggConfig;
|
||||
let bucketCountBetween;
|
||||
|
||||
// http://cwestblog.com/2014/02/25/javascript-testing-for-negative-zero/
|
||||
// works for -0 and +0
|
||||
|
|
|
@ -6,7 +6,7 @@ import AggParamWriterProvider from '../agg_param_writer';
|
|||
describe('Histogram Agg', function () {
|
||||
|
||||
describe('ordered', function () {
|
||||
var histogram;
|
||||
let histogram;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
@ -24,7 +24,7 @@ describe('Histogram Agg', function () {
|
|||
|
||||
|
||||
describe('params', function () {
|
||||
var paramWriter;
|
||||
let paramWriter;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -11,9 +11,9 @@ describe('Range Agg', function () {
|
|||
|
||||
var buckets = values(resp.aggregations[1].buckets);
|
||||
|
||||
var range;
|
||||
var Vis;
|
||||
var indexPattern;
|
||||
let range;
|
||||
let Vis;
|
||||
let indexPattern;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -12,16 +12,16 @@ import AggTypesBucketsIntervalOptionsProvider from 'ui/agg_types/buckets/_interv
|
|||
describe('AggConfig Filters', function () {
|
||||
describe('date_histogram', function () {
|
||||
|
||||
var vis;
|
||||
var agg;
|
||||
var field;
|
||||
var filter;
|
||||
var bucketKey;
|
||||
var bucketStart;
|
||||
var getIntervalStub;
|
||||
var intervalOptions;
|
||||
let vis;
|
||||
let agg;
|
||||
let field;
|
||||
let filter;
|
||||
let bucketKey;
|
||||
let bucketStart;
|
||||
let getIntervalStub;
|
||||
let intervalOptions;
|
||||
|
||||
var init;
|
||||
let init;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private, $injector) {
|
||||
|
@ -84,7 +84,7 @@ describe('AggConfig Filters', function () {
|
|||
|
||||
it('extends the filter edge to 1ms before the next bucket for all interval options', function () {
|
||||
intervalOptions.forEach(function (option) {
|
||||
var duration;
|
||||
let duration;
|
||||
if (option.val !== 'custom' && moment(1, option.val).isValid()) {
|
||||
duration = moment.duration(10, option.val);
|
||||
|
||||
|
|
|
@ -9,10 +9,10 @@ import AggTypesBucketsCreateFilterDateRangeProvider from 'ui/agg_types/buckets/c
|
|||
|
||||
describe('AggConfig Filters', function () {
|
||||
describe('Date range', function () {
|
||||
var AggConfig;
|
||||
var indexPattern;
|
||||
var Vis;
|
||||
var createFilter;
|
||||
let AggConfig;
|
||||
let indexPattern;
|
||||
let Vis;
|
||||
let createFilter;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -9,10 +9,10 @@ import AggTypesBucketsCreateFilterFiltersProvider from 'ui/agg_types/buckets/cre
|
|||
|
||||
describe('AggConfig Filters', function () {
|
||||
describe('filters', function () {
|
||||
var AggConfig;
|
||||
var indexPattern;
|
||||
var Vis;
|
||||
var createFilter;
|
||||
let AggConfig;
|
||||
let indexPattern;
|
||||
let Vis;
|
||||
let createFilter;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -9,10 +9,10 @@ import AggTypesBucketsCreateFilterHistogramProvider from 'ui/agg_types/buckets/c
|
|||
|
||||
describe('AggConfig Filters', function () {
|
||||
describe('histogram', function () {
|
||||
var AggConfig;
|
||||
var indexPattern;
|
||||
var Vis;
|
||||
var createFilter;
|
||||
let AggConfig;
|
||||
let indexPattern;
|
||||
let Vis;
|
||||
let createFilter;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -7,10 +7,10 @@ import AggTypesBucketsCreateFilterIpRangeProvider from 'ui/agg_types/buckets/cre
|
|||
describe('AggConfig Filters', function () {
|
||||
|
||||
describe('IP range', function () {
|
||||
var AggConfig;
|
||||
var indexPattern;
|
||||
var Vis;
|
||||
var createFilter;
|
||||
let AggConfig;
|
||||
let indexPattern;
|
||||
let Vis;
|
||||
let createFilter;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -7,10 +7,10 @@ import AggTypesBucketsCreateFilterRangeProvider from 'ui/agg_types/buckets/creat
|
|||
describe('AggConfig Filters', function () {
|
||||
|
||||
describe('range', function () {
|
||||
var AggConfig;
|
||||
var indexPattern;
|
||||
var Vis;
|
||||
var createFilter;
|
||||
let AggConfig;
|
||||
let indexPattern;
|
||||
let Vis;
|
||||
let createFilter;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -7,10 +7,10 @@ import AggTypesBucketsCreateFilterTermsProvider from 'ui/agg_types/buckets/creat
|
|||
describe('AggConfig Filters', function () {
|
||||
|
||||
describe('terms', function () {
|
||||
var AggConfig;
|
||||
var indexPattern;
|
||||
var Vis;
|
||||
var createFilter;
|
||||
let AggConfig;
|
||||
let indexPattern;
|
||||
let Vis;
|
||||
let createFilter;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -7,11 +7,11 @@ import VisProvider from 'ui/vis';
|
|||
import AggTypesBucketsIntervalOptionsProvider from 'ui/agg_types/buckets/_interval_options';
|
||||
describe('editor', function () {
|
||||
|
||||
var indexPattern;
|
||||
var vis;
|
||||
var agg;
|
||||
var render;
|
||||
var $scope;
|
||||
let indexPattern;
|
||||
let vis;
|
||||
let agg;
|
||||
let render;
|
||||
let $scope;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private, $injector, $compile) {
|
||||
|
@ -69,9 +69,9 @@ describe('editor', function () {
|
|||
}));
|
||||
|
||||
describe('random field/interval', function () {
|
||||
var params;
|
||||
var field;
|
||||
var interval;
|
||||
let params;
|
||||
let field;
|
||||
let interval;
|
||||
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
field = _.sample(indexPattern.fields);
|
||||
|
@ -97,7 +97,7 @@ describe('editor', function () {
|
|||
});
|
||||
|
||||
describe('interval "auto" and indexPattern timeField', function () {
|
||||
var params;
|
||||
let params;
|
||||
|
||||
beforeEach(function () {
|
||||
params = render({ field: indexPattern.timeFieldName, interval: 'auto' });
|
||||
|
|
|
@ -8,13 +8,13 @@ import AggTypesIndexProvider from 'ui/agg_types/index';
|
|||
import VisAggConfigProvider from 'ui/vis/agg_config';
|
||||
describe('params', function () {
|
||||
|
||||
var paramWriter;
|
||||
var writeInterval;
|
||||
let paramWriter;
|
||||
let writeInterval;
|
||||
|
||||
var aggTypes;
|
||||
var AggConfig;
|
||||
var setTimeBounds;
|
||||
var timeField;
|
||||
let aggTypes;
|
||||
let AggConfig;
|
||||
let setTimeBounds;
|
||||
let timeField;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private, $injector) {
|
||||
|
|
|
@ -7,9 +7,9 @@ import 'ui/number_list';
|
|||
describe('NumberList directive', function () {
|
||||
|
||||
|
||||
var $el;
|
||||
var $scope;
|
||||
var compile;
|
||||
let $el;
|
||||
let $scope;
|
||||
let compile;
|
||||
|
||||
function onlyValidValues() {
|
||||
return $el.find('[ng-model]').toArray().map(function (el) {
|
||||
|
|
|
@ -12,8 +12,8 @@ import AggTypesMetricsMetricAggTypeProvider from 'ui/agg_types/metrics/metric_ag
|
|||
describe('AggTypesComponent', function () {
|
||||
|
||||
describe('bucket aggs', function () {
|
||||
var bucketAggs;
|
||||
var BucketAggType;
|
||||
let bucketAggs;
|
||||
let BucketAggType;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
@ -29,8 +29,8 @@ describe('AggTypesComponent', function () {
|
|||
});
|
||||
|
||||
describe('metric aggs', function () {
|
||||
var metricAggs;
|
||||
var MetricAggType;
|
||||
let metricAggs;
|
||||
let MetricAggType;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -7,11 +7,11 @@ import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logsta
|
|||
import AggTypesParamTypesCalculateIntervalProvider from 'ui/agg_types/param_types/_calculate_interval';
|
||||
|
||||
describe('calculateInterval()', function () {
|
||||
var AggConfig;
|
||||
var indexPattern;
|
||||
var Vis;
|
||||
var createFilter;
|
||||
var calculateInterval;
|
||||
let AggConfig;
|
||||
let indexPattern;
|
||||
let Vis;
|
||||
let createFilter;
|
||||
let calculateInterval;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -5,8 +5,8 @@ import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base';
|
|||
import AggTypesParamTypesFieldProvider from 'ui/agg_types/param_types/field';
|
||||
describe('Field', function () {
|
||||
|
||||
var BaseAggParam;
|
||||
var FieldAggParam;
|
||||
let BaseAggParam;
|
||||
let FieldAggParam;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
// fetch out deps
|
||||
|
|
|
@ -5,8 +5,8 @@ import AggTypesParamTypesBaseProvider from 'ui/agg_types/param_types/base';
|
|||
import AggTypesParamTypesOptionedProvider from 'ui/agg_types/param_types/optioned';
|
||||
describe('Optioned', function () {
|
||||
|
||||
var BaseAggParam;
|
||||
var OptionedAggParam;
|
||||
let BaseAggParam;
|
||||
let OptionedAggParam;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
// fetch out deps
|
||||
|
|
|
@ -7,11 +7,11 @@ import AggTypesParamTypesRawJsonProvider from 'ui/agg_types/param_types/raw_json
|
|||
|
||||
module.exports = describe('JSON', function () {
|
||||
var paramName = 'json_test';
|
||||
var BaseAggParam;
|
||||
var JsonAggParam;
|
||||
var aggParam;
|
||||
var aggConfig;
|
||||
var output;
|
||||
let BaseAggParam;
|
||||
let JsonAggParam;
|
||||
let aggParam;
|
||||
let aggConfig;
|
||||
let output;
|
||||
|
||||
function initAggParam(config) {
|
||||
config = config || {};
|
||||
|
|
|
@ -7,10 +7,10 @@ import VisProvider from 'ui/vis';
|
|||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
describe('Regex', function () {
|
||||
|
||||
var BaseAggParam;
|
||||
var RegexAggParam;
|
||||
var Vis;
|
||||
var indexPattern;
|
||||
let BaseAggParam;
|
||||
let RegexAggParam;
|
||||
let Vis;
|
||||
let indexPattern;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
// fetch out deps
|
||||
|
@ -34,8 +34,8 @@ describe('Regex', function () {
|
|||
});
|
||||
|
||||
describe('write results', function () {
|
||||
var aggParam;
|
||||
var aggConfig;
|
||||
let aggParam;
|
||||
let aggConfig;
|
||||
var output = { params: {} };
|
||||
var paramName = 'exclude';
|
||||
|
||||
|
|
|
@ -6,11 +6,11 @@ import AggTypesParamTypesStringProvider from 'ui/agg_types/param_types/string';
|
|||
|
||||
module.exports = describe('String', function () {
|
||||
var paramName = 'json_test';
|
||||
var BaseAggParam;
|
||||
var StringAggParam;
|
||||
var aggParam;
|
||||
var aggConfig;
|
||||
var output;
|
||||
let BaseAggParam;
|
||||
let StringAggParam;
|
||||
let aggParam;
|
||||
let aggConfig;
|
||||
let output;
|
||||
|
||||
function initAggParam(config) {
|
||||
config = config || {};
|
||||
|
|
|
@ -2,7 +2,7 @@ import CidrMask from 'ui/utils/cidr_mask';
|
|||
import buildRangeFilter from 'ui/filter_manager/lib/range';
|
||||
export default function createIpRangeFilterProvider() {
|
||||
return function (aggConfig, key) {
|
||||
var range;
|
||||
let range;
|
||||
if (aggConfig.params.ipRangeType === 'mask') {
|
||||
range = new CidrMask(key).getRange();
|
||||
} else {
|
||||
|
|
|
@ -45,7 +45,7 @@ export default function DateHistogramAggType(timefilter, config, Private) {
|
|||
},
|
||||
createFilter: createFilter,
|
||||
decorateAggConfig: function () {
|
||||
var buckets;
|
||||
let buckets;
|
||||
return {
|
||||
buckets: {
|
||||
configurable: true,
|
||||
|
|
|
@ -25,7 +25,7 @@ export default function RawJSONAggParamFactory(Private) {
|
|||
* @return {undefined}
|
||||
*/
|
||||
RawJSONAggParam.prototype.write = function (aggConfig, output) {
|
||||
var paramJSON;
|
||||
let paramJSON;
|
||||
var param = aggConfig.params[this.name];
|
||||
|
||||
if (!param) {
|
||||
|
|
|
@ -3,8 +3,8 @@ import expect from 'expect.js';
|
|||
import ngMock from 'ng_mock';
|
||||
describe('$scope.$bind', function () {
|
||||
|
||||
var $rootScope;
|
||||
var $scope;
|
||||
let $rootScope;
|
||||
let $scope;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function ($injector) {
|
||||
|
|
|
@ -6,7 +6,7 @@ import Binder from 'ui/binder';
|
|||
import $ from 'jquery';
|
||||
|
||||
describe('Binder class', function () {
|
||||
var $scope;
|
||||
let $scope;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function ($rootScope) {
|
||||
|
|
|
@ -1,49 +1,34 @@
|
|||
import d3 from 'd3';
|
||||
import { callEach } from 'lodash';
|
||||
import { bindKey } from 'lodash';
|
||||
import { rest } from 'lodash';
|
||||
import $ from 'jquery';
|
||||
|
||||
function Binder($scope) {
|
||||
this.disposal = [];
|
||||
if ($scope) {
|
||||
$scope.$on('$destroy', bindKey(this, 'destroy'));
|
||||
import Binder from '../../../utils/binder';
|
||||
|
||||
export default class UiBinder extends Binder {
|
||||
constructor($scope) {
|
||||
super();
|
||||
|
||||
// support auto-binding to $scope objects
|
||||
if ($scope) {
|
||||
$scope.$on('$destroy', () => this.destroy());
|
||||
}
|
||||
}
|
||||
|
||||
jqOn(el, ...args) {
|
||||
const $el = $(el);
|
||||
$el.on(...args);
|
||||
this.disposal.push(() => $el.off(...args));
|
||||
}
|
||||
|
||||
fakeD3Bind(el, event, handler) {
|
||||
this.jqOn(el, event, (e) => {
|
||||
// mimick https://github.com/mbostock/d3/blob/3abb00113662463e5c19eb87cd33f6d0ddc23bc0/src/selection/on.js#L87-L94
|
||||
const o = d3.event; // Events can be reentrant (e.g., focus).
|
||||
d3.event = e;
|
||||
try {
|
||||
handler.apply(this, [this.__data__]);
|
||||
} finally {
|
||||
d3.event = o;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Binder.prototype._bind = function (on, off, emitter, args) {
|
||||
on.apply(emitter, args);
|
||||
this.disposal.push(function () {
|
||||
off.apply(emitter, args);
|
||||
});
|
||||
};
|
||||
|
||||
Binder.prototype.on = function (emitter/*, ...args */) {
|
||||
this._bind(emitter.on, emitter.off || emitter.removeListener, emitter, rest(arguments));
|
||||
};
|
||||
|
||||
Binder.prototype.jqOn = function (el/*, ...args */) {
|
||||
var $el = $(el);
|
||||
this._bind($el.on, $el.off, $el, rest(arguments));
|
||||
};
|
||||
|
||||
Binder.prototype.fakeD3Bind = function (el, event, handler) {
|
||||
this.jqOn(el, event, function (e) {
|
||||
// mimick https://github.com/mbostock/d3/blob/3abb00113662463e5c19eb87cd33f6d0ddc23bc0/src/selection/on.js#L87-L94
|
||||
var o = d3.event; // Events can be reentrant (e.g., focus).
|
||||
d3.event = e;
|
||||
try {
|
||||
handler.apply(this, [this.__data__]);
|
||||
} finally {
|
||||
d3.event = o;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Binder.prototype.destroy = function () {
|
||||
var destroyers = this.disposal;
|
||||
this.disposal = [];
|
||||
callEach(destroyers);
|
||||
};
|
||||
|
||||
module.exports = Binder;
|
||||
|
|
|
@ -12,7 +12,7 @@ import 'ui/chrome';
|
|||
import '../app_switcher';
|
||||
|
||||
describe('appSwitcher directive', function () {
|
||||
var env;
|
||||
let env;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ uiModules
|
|||
|
||||
// Break the recursion loop by removing the contents
|
||||
var contents = element.contents().remove();
|
||||
var compiledContents;
|
||||
let compiledContents;
|
||||
return {
|
||||
pre: (link && link.pre) ? link.pre : null,
|
||||
/**
|
||||
|
|
|
@ -2,9 +2,9 @@ import expect from 'expect.js';
|
|||
import ngMock from 'ng_mock';
|
||||
import ConfigDefaultsProvider from 'ui/config/defaults';
|
||||
describe('config component', function () {
|
||||
var $scope;
|
||||
var config;
|
||||
var defaults;
|
||||
let $scope;
|
||||
let config;
|
||||
let defaults;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function ($injector, Private) {
|
||||
|
|
|
@ -12,7 +12,7 @@ export default function DelayedUpdaterFactory(Private, $rootScope, Promise) {
|
|||
var updater = this;
|
||||
var queue = [];
|
||||
var log = {};
|
||||
var timer;
|
||||
let timer;
|
||||
|
||||
updater.fire = function () {
|
||||
clearTimeout(timer);
|
||||
|
@ -21,8 +21,8 @@ export default function DelayedUpdaterFactory(Private, $rootScope, Promise) {
|
|||
if (updater.fired) return;
|
||||
updater.fired = true;
|
||||
|
||||
var method;
|
||||
var body;
|
||||
let method;
|
||||
let body;
|
||||
var updated = [];
|
||||
var deleted = [];
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@ module.service('config', function (Private, kbnVersion, kbnIndex, $rootScope, bu
|
|||
|
||||
// active or previous instance of DelayedUpdater. This will log and then process an
|
||||
// update once it is requested by calling #set() or #clear().
|
||||
var updater;
|
||||
let updater;
|
||||
|
||||
var DocSource = Private(DocSourceProvider);
|
||||
var doc = (new DocSource())
|
||||
|
@ -82,7 +82,7 @@ module.service('config', function (Private, kbnVersion, kbnIndex, $rootScope, bu
|
|||
});
|
||||
|
||||
config.get = function (key, defaultVal) {
|
||||
var keyVal;
|
||||
let keyVal;
|
||||
|
||||
if (vals[key] == null) {
|
||||
if (defaultVal == null) {
|
||||
|
|
|
@ -6,13 +6,13 @@ import DecorateQueryProvider from 'ui/courier/data_source/_decorate_query';
|
|||
|
||||
describe('Query decorator', function () {
|
||||
|
||||
var config;
|
||||
let config;
|
||||
|
||||
var indexPattern;
|
||||
let indexPattern;
|
||||
|
||||
var getComputedFields;
|
||||
let getComputedFields;
|
||||
|
||||
var fn;
|
||||
let fn;
|
||||
beforeEach(ngMock.module(
|
||||
'kibana',
|
||||
function ($provide) {
|
||||
|
|
|
@ -5,9 +5,9 @@ import NormalizeSortRequestProvider from 'ui/courier/data_source/_normalize_sort
|
|||
import FixturesStubbedLogstashIndexPatternProvider from 'fixtures/stubbed_logstash_index_pattern';
|
||||
|
||||
describe('SearchSource#normalizeSortRequest', function () {
|
||||
var normalizeSortRequest;
|
||||
var indexPattern;
|
||||
var normalizedSort;
|
||||
let normalizeSortRequest;
|
||||
let indexPattern;
|
||||
let normalizedSort;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
beforeEach(ngMock.inject(function (Private) {
|
||||
|
|
|
@ -33,7 +33,7 @@ export default function (Promise, Private, es) {
|
|||
doc._storeVersion(resp._version);
|
||||
doc.id(resp._id);
|
||||
|
||||
var docFetchProm;
|
||||
let docFetchProm;
|
||||
if (method !== 'index') {
|
||||
docFetchProm = doc.fetch();
|
||||
} else {
|
||||
|
|
|
@ -28,7 +28,7 @@ export default function normalizeSortRequest(config) {
|
|||
var indexField = indexPattern.fields.byName[sortField];
|
||||
|
||||
if (indexField && indexField.scripted && indexField.sortable) {
|
||||
var direction;
|
||||
let direction;
|
||||
if (_.isString(sortValue)) direction = sortValue;
|
||||
if (_.isObject(sortValue) && sortValue.order) direction = sortValue.order;
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ export default function RootSearchSource(Private, $rootScope, timefilter, Notifi
|
|||
return timefilter.get(globalSource.get('index'));
|
||||
});
|
||||
|
||||
var appSource; // set in setAppSource()
|
||||
let appSource; // set in setAppSource()
|
||||
resetAppSource();
|
||||
|
||||
// when the route changes, clear the appSource
|
||||
|
|
|
@ -151,7 +151,7 @@ export default function SavedObjectFactory(es, kbnIndex, Promise, Private, Notif
|
|||
if (!self.searchSource) return;
|
||||
|
||||
// if we have a searchSource, set its state based on the searchSourceJSON field
|
||||
var state;
|
||||
let state;
|
||||
try {
|
||||
state = JSON.parse(searchSourceJson);
|
||||
} catch (e) {
|
||||
|
|
|
@ -3,9 +3,9 @@ import sinon from 'auto-release-sinon';
|
|||
import expect from 'expect.js';
|
||||
import ngMock from 'ng_mock';
|
||||
|
||||
var debounce;
|
||||
var $timeout;
|
||||
var $timeoutSpy;
|
||||
let debounce;
|
||||
let $timeout;
|
||||
let $timeoutSpy;
|
||||
|
||||
function init() {
|
||||
ngMock.module('kibana');
|
||||
|
@ -19,7 +19,7 @@ function init() {
|
|||
}
|
||||
|
||||
describe('debounce service', function () {
|
||||
var spy;
|
||||
let spy;
|
||||
beforeEach(function () {
|
||||
spy = sinon.spy(function () {});
|
||||
init();
|
||||
|
|
|
@ -7,10 +7,10 @@ var module = uiModules.get('kibana');
|
|||
|
||||
module.service('debounce', ['$timeout', function ($timeout) {
|
||||
return function (func, wait, options) {
|
||||
var timeout;
|
||||
var args;
|
||||
var self;
|
||||
var result;
|
||||
let timeout;
|
||||
let args;
|
||||
let self;
|
||||
let result;
|
||||
options = _.defaults(options || {}, {
|
||||
leading: false,
|
||||
trailing: true
|
||||
|
|
|
@ -5,8 +5,8 @@ import ngMock from 'ng_mock';
|
|||
import 'ui/directives/auto_select_if_only_one';
|
||||
|
||||
describe('Auto-select if only one directive', function () {
|
||||
var $compile;
|
||||
var $rootScope;
|
||||
let $compile;
|
||||
let $rootScope;
|
||||
var zeroOptions = [];
|
||||
var oneOption = [{label: 'foo'}];
|
||||
var multiOptions = [{label: 'foo'}, {label: 'bar'}];
|
||||
|
|
|
@ -7,11 +7,11 @@ import 'ui/directives/confirm_click';
|
|||
import 'plugins/kibana/discover/index';
|
||||
|
||||
|
||||
var $parentScope;
|
||||
let $parentScope;
|
||||
|
||||
var $scope;
|
||||
let $scope;
|
||||
|
||||
var $elem;
|
||||
let $elem;
|
||||
|
||||
var init = function (text) {
|
||||
// Load the application
|
||||
|
@ -47,7 +47,7 @@ describe('confirmClick directive', function () {
|
|||
|
||||
|
||||
describe('event handlers', function () {
|
||||
var events;
|
||||
let events;
|
||||
|
||||
beforeEach(function () {
|
||||
init();
|
||||
|
@ -71,7 +71,7 @@ describe('confirmClick directive', function () {
|
|||
|
||||
|
||||
describe('confirmed', function () {
|
||||
var confirmed;
|
||||
let confirmed;
|
||||
|
||||
beforeEach(function () {
|
||||
init();
|
||||
|
@ -98,7 +98,7 @@ describe('confirmClick directive', function () {
|
|||
});
|
||||
|
||||
describe('not confirmed', function () {
|
||||
var confirmed;
|
||||
let confirmed;
|
||||
|
||||
beforeEach(function () {
|
||||
init();
|
||||
|
|
|
@ -4,11 +4,11 @@ import ngMock from 'ng_mock';
|
|||
import $ from 'jquery';
|
||||
import 'plugins/kibana/discover/index';
|
||||
|
||||
var $parentScope;
|
||||
let $parentScope;
|
||||
|
||||
var $scope;
|
||||
let $scope;
|
||||
|
||||
var $elem;
|
||||
let $elem;
|
||||
|
||||
var init = function (expandable) {
|
||||
// Load the application
|
||||
|
|
|
@ -8,7 +8,7 @@ import Promise from 'bluebird';
|
|||
|
||||
describe('FixedScroll directive', function () {
|
||||
|
||||
var compile;
|
||||
let compile;
|
||||
var trash = [];
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
@ -112,10 +112,10 @@ describe('FixedScroll directive', function () {
|
|||
{ from: '$scroller', to: '$container' }
|
||||
].forEach(function (names) {
|
||||
describe('scroll events ' + JSON.stringify(names), function () {
|
||||
var spy;
|
||||
var els;
|
||||
var $from;
|
||||
var $to;
|
||||
let spy;
|
||||
let els;
|
||||
let $from;
|
||||
let $to;
|
||||
|
||||
beforeEach(function () {
|
||||
spy = sinon.spy($.fn, 'scrollLeft');
|
||||
|
|
|
@ -4,9 +4,9 @@ import ngMock from 'ng_mock';
|
|||
import 'ui/directives/inequality';
|
||||
|
||||
describe('greater_than model validator directive', function () {
|
||||
var $compile;
|
||||
var $rootScope;
|
||||
var html;
|
||||
let $compile;
|
||||
let $rootScope;
|
||||
let html;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
||||
|
@ -17,7 +17,7 @@ describe('greater_than model validator directive', function () {
|
|||
|
||||
// no value is the same as 0
|
||||
describe('without value', function () {
|
||||
var element;
|
||||
let element;
|
||||
beforeEach(function () {
|
||||
html = '<input type="text" ng-model="value" greater-than />';
|
||||
element = $compile(html)($rootScope);
|
||||
|
@ -44,7 +44,7 @@ describe('greater_than model validator directive', function () {
|
|||
|
||||
[0, 1, 10, 42, -12].forEach(function (num) {
|
||||
describe('with value ' + num, function () {
|
||||
var element;
|
||||
let element;
|
||||
beforeEach(function () {
|
||||
html = '<input type="text" ng-model="value" greater-than="' + num + '" />';
|
||||
element = $compile(html)($rootScope);
|
||||
|
|
|
@ -5,13 +5,13 @@ import $ from 'jquery';
|
|||
import 'ui/directives/input_focus';
|
||||
|
||||
describe('Input focus directive', function () {
|
||||
var $compile;
|
||||
var $rootScope;
|
||||
var $timeout;
|
||||
var element;
|
||||
var $el;
|
||||
var selectedEl;
|
||||
var selectedText;
|
||||
let $compile;
|
||||
let $rootScope;
|
||||
let $timeout;
|
||||
let element;
|
||||
let $el;
|
||||
let selectedEl;
|
||||
let selectedText;
|
||||
var inputValue = 'Input Text Value';
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
|
|
@ -4,8 +4,8 @@ import ngMock from 'ng_mock';
|
|||
import 'ui/directives/input_whole_number';
|
||||
|
||||
describe('Whole number input directive', function () {
|
||||
var $compile;
|
||||
var $rootScope;
|
||||
let $compile;
|
||||
let $rootScope;
|
||||
var html = '<input type="text" ng-model="value" input-whole-number />';
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
|
|
@ -5,10 +5,10 @@ import 'ui/directives/json_input';
|
|||
|
||||
|
||||
describe('JSON input validation', function () {
|
||||
var $compile;
|
||||
var $rootScope;
|
||||
let $compile;
|
||||
let $rootScope;
|
||||
var html = '<input ng-model="value" json-input require-keys=true />';
|
||||
var element;
|
||||
let element;
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
||||
|
|
183
src/ui/public/directives/__tests__/paginated_selectable_list.js
Normal file
183
src/ui/public/directives/__tests__/paginated_selectable_list.js
Normal file
|
@ -0,0 +1,183 @@
|
|||
import angular from 'angular';
|
||||
import expect from 'expect.js';
|
||||
import ngMock from 'ng_mock';
|
||||
import _ from 'lodash';
|
||||
|
||||
var objectList = [
|
||||
{ title: 'apple' },
|
||||
{ title: 'orange' },
|
||||
{ title: 'coconut' },
|
||||
{ title: 'banana' },
|
||||
{ title: 'grapes' }
|
||||
];
|
||||
|
||||
var stringList = [
|
||||
'apple',
|
||||
'orange',
|
||||
'coconut',
|
||||
'banana',
|
||||
'grapes'
|
||||
];
|
||||
|
||||
var lists = [objectList, stringList, []];
|
||||
|
||||
var $scope;
|
||||
var $element;
|
||||
var $isolatedScope;
|
||||
|
||||
lists.forEach(function (list) {
|
||||
var isArrayOfObjects = list.every((item) => {
|
||||
return _.isPlainObject(item);
|
||||
});
|
||||
|
||||
var init = function (arr, willFail) {
|
||||
// Load the application
|
||||
ngMock.module('kibana');
|
||||
|
||||
// Create the scope
|
||||
ngMock.inject(function ($rootScope, $compile) {
|
||||
$scope = $rootScope.$new();
|
||||
$scope.perPage = 5;
|
||||
$scope.list = list;
|
||||
$scope.listProperty = isArrayOfObjects ? 'title' : undefined;
|
||||
$scope.test = function (val) { return val; };
|
||||
|
||||
// Create the element
|
||||
if (willFail) {
|
||||
$element = angular.element('<paginated-selectable-list per-page="perPage" list="list"' +
|
||||
'list-property="listProperty" user-make-url="test" user-on-select="test"></paginated-selectable-list>');
|
||||
} else {
|
||||
$element = angular.element('<paginated-selectable-list per-page="perPage" list="list"' +
|
||||
'list-property="listProperty" user-make-url="test"></paginated-selectable-list>');
|
||||
}
|
||||
|
||||
// And compile it
|
||||
$compile($element)($scope);
|
||||
|
||||
// Fire a digest cycle
|
||||
$element.scope().$digest();
|
||||
|
||||
// Grab the isolate scope so we can test it
|
||||
$isolatedScope = $element.isolateScope();
|
||||
});
|
||||
};
|
||||
|
||||
describe('paginatedSelectableList', function () {
|
||||
it('should throw an error when there is no makeUrl and onSelect attribute', ngMock.inject(function ($compile, $rootScope) {
|
||||
function errorWrapper() {
|
||||
$compile(angular.element('<paginated-selectable-list></paginated-selectable-list>'))($rootScope.new());
|
||||
}
|
||||
expect(errorWrapper).to.throwError();
|
||||
}));
|
||||
|
||||
it('should throw an error with both makeUrl and onSelect attributes', function () {
|
||||
function errorWrapper() {
|
||||
init(list, true);
|
||||
}
|
||||
expect(errorWrapper).to.throwError();
|
||||
});
|
||||
|
||||
describe('$scope.hits', function () {
|
||||
beforeEach(function () {
|
||||
init(list);
|
||||
});
|
||||
|
||||
it('should initially sort an array of objects in ascending order', function () {
|
||||
var property = $isolatedScope.listProperty;
|
||||
var sortedList = property ? _.sortBy(list, property) : _.sortBy(list);
|
||||
|
||||
expect($isolatedScope.hits).to.be.an('array');
|
||||
|
||||
$isolatedScope.hits.forEach(function (hit, index) {
|
||||
if (property) {
|
||||
expect(hit[property]).to.equal(sortedList[index][property]);
|
||||
} else {
|
||||
expect(hit).to.equal(sortedList[index]);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('$scope.sortHits', function () {
|
||||
beforeEach(function () {
|
||||
init(list);
|
||||
});
|
||||
|
||||
it('should sort an array of objects in ascending order', function () {
|
||||
var property = $isolatedScope.listProperty;
|
||||
var sortedList = property ? _.sortBy(list, property) : _.sortBy(list);
|
||||
|
||||
$isolatedScope.isAscending = false;
|
||||
$isolatedScope.sortHits(list);
|
||||
|
||||
expect($isolatedScope.isAscending).to.be(true);
|
||||
|
||||
$isolatedScope.hits.forEach(function (hit, index) {
|
||||
if (property) {
|
||||
expect(hit[property]).to.equal(sortedList[index][property]);
|
||||
} else {
|
||||
expect(hit).to.equal(sortedList[index]);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
it('should sort an array of objects in descending order', function () {
|
||||
var property = $isolatedScope.listProperty;
|
||||
var reversedList = property ? _.sortBy(list, property).reverse() : _.sortBy(list).reverse();
|
||||
|
||||
$isolatedScope.isAscending = true;
|
||||
$isolatedScope.sortHits(list);
|
||||
|
||||
expect($isolatedScope.isAscending).to.be(false);
|
||||
|
||||
$isolatedScope.hits.forEach(function (hit, index) {
|
||||
if (property) {
|
||||
expect(hit[property]).to.equal(reversedList[index][property]);
|
||||
} else {
|
||||
expect(hit).to.equal(reversedList[index]);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('$scope.makeUrl', function () {
|
||||
beforeEach(function () {
|
||||
init(list);
|
||||
});
|
||||
|
||||
it('should return the result of the function its passed', function () {
|
||||
var property = $isolatedScope.listProperty;
|
||||
var sortedList = property ? _.sortBy(list, property) : _.sortBy(list);
|
||||
|
||||
$isolatedScope.hits.forEach(function (hit, index) {
|
||||
if (property) {
|
||||
expect($isolatedScope.makeUrl(hit)[property]).to.equal(sortedList[index][property]);
|
||||
} else {
|
||||
expect($isolatedScope.makeUrl(hit)).to.equal(sortedList[index]);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('$scope.onSelect', function () {
|
||||
beforeEach(function () {
|
||||
init(list);
|
||||
});
|
||||
|
||||
it('should return the result of the function its passed', function () {
|
||||
var property = $isolatedScope.listProperty;
|
||||
var sortedList = property ? _.sortBy(list, property) : _.sortBy(list);
|
||||
|
||||
$isolatedScope.userOnSelect = function (val) { return val; };
|
||||
|
||||
$isolatedScope.hits.forEach(function (hit, index) {
|
||||
if (property) {
|
||||
expect($isolatedScope.onSelect(hit)[property]).to.equal(sortedList[index][property]);
|
||||
} else {
|
||||
expect($isolatedScope.onSelect(hit)).to.equal(sortedList[index]);
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
|
@ -5,18 +5,18 @@ import ngMock from 'ng_mock';
|
|||
|
||||
// Load the kibana app dependencies.
|
||||
|
||||
var $rootScope;
|
||||
var $timeout;
|
||||
var $compile;
|
||||
var Promise;
|
||||
var Private;
|
||||
var config;
|
||||
var $elemScope;
|
||||
var $elem;
|
||||
let $rootScope;
|
||||
let $timeout;
|
||||
let $compile;
|
||||
let Promise;
|
||||
let Private;
|
||||
let config;
|
||||
let $elemScope;
|
||||
let $elem;
|
||||
|
||||
var cycleIndex = 0;
|
||||
var markup = '<input ng-model="mockModel" parse-query input-focus type="text">';
|
||||
var fromUser;
|
||||
let fromUser;
|
||||
import toUser from 'ui/parse_query/lib/to_user';
|
||||
import 'ui/parse_query';
|
||||
import ParseQueryLibFromUserProvider from 'ui/parse_query/lib/from_user';
|
||||
|
@ -102,7 +102,7 @@ describe('parse-query directive', function () {
|
|||
|
||||
describe('model presentation formatter', function () {
|
||||
it('should present undefined as empty string', function () {
|
||||
var notDefined;
|
||||
let notDefined;
|
||||
expect(toUser(notDefined)).to.be('');
|
||||
});
|
||||
|
||||
|
|
|
@ -12,13 +12,13 @@ import 'plugins/kibana/discover/index';
|
|||
|
||||
// TODO: This should not be needed, timefilter is only included here, it should move
|
||||
|
||||
var $parentScope;
|
||||
let $parentScope;
|
||||
|
||||
var $scope;
|
||||
let $scope;
|
||||
|
||||
var $elem;
|
||||
let $elem;
|
||||
var anchor = '2014-01-01T06:06:06.666Z';
|
||||
var clock;
|
||||
let clock;
|
||||
|
||||
var init = function () {
|
||||
// Load the application
|
||||
|
@ -85,7 +85,7 @@ describe('timepicker directive', function () {
|
|||
});
|
||||
|
||||
describe('refresh interval', function () {
|
||||
var $courier;
|
||||
let $courier;
|
||||
beforeEach(function () {
|
||||
init();
|
||||
ngMock.inject(function (courier, $rootScope) {
|
||||
|
@ -232,7 +232,7 @@ describe('timepicker directive', function () {
|
|||
});
|
||||
|
||||
it('disables the submit button if the form is invalid', function (done) {
|
||||
var button;
|
||||
let button;
|
||||
button = $elem.find('button[disabled]');
|
||||
expect(button.length).to.be(0);
|
||||
|
||||
|
@ -359,7 +359,7 @@ describe('timepicker directive', function () {
|
|||
|
||||
describe('absolute mode', function () {
|
||||
|
||||
var inputs;
|
||||
let inputs;
|
||||
|
||||
beforeEach(function () {
|
||||
init();
|
||||
|
|
|
@ -5,11 +5,11 @@ import $ from 'jquery';
|
|||
import 'plugins/kibana/discover/index';
|
||||
|
||||
|
||||
var $parentScope;
|
||||
let $parentScope;
|
||||
|
||||
var $scope;
|
||||
let $scope;
|
||||
|
||||
var $elem;
|
||||
let $elem;
|
||||
|
||||
var init = function (text) {
|
||||
// Load the application
|
||||
|
|
|
@ -9,12 +9,12 @@ import 'plugins/kibana/discover/index';
|
|||
|
||||
var typeaheadHistoryCount = 10;
|
||||
var typeaheadName = 'unittest';
|
||||
var $parentScope;
|
||||
var $typeaheadScope;
|
||||
var $elem;
|
||||
var $typeaheadInputScope;
|
||||
var typeaheadCtrl;
|
||||
var PersistedLog;
|
||||
let $parentScope;
|
||||
let $typeaheadScope;
|
||||
let $elem;
|
||||
let $typeaheadInputScope;
|
||||
let typeaheadCtrl;
|
||||
let PersistedLog;
|
||||
|
||||
var markup = '<div class="typeahead" kbn-typeahead="' + typeaheadName + '">' +
|
||||
'<input type="text" placeholder="Filter..." class="form-control" ng-model="query" kbn-typeahead-input>' +
|
||||
|
|
|
@ -5,8 +5,8 @@ import 'ui/directives/validate_cidr_mask';
|
|||
|
||||
|
||||
describe('Validate CIDR mask directive', function () {
|
||||
var $compile;
|
||||
var $rootScope;
|
||||
let $compile;
|
||||
let $rootScope;
|
||||
var html = '<input type="text" ng-model="value" validate-cidr-mask />';
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
|
|
@ -5,8 +5,8 @@ import 'ui/directives/validate_date_math';
|
|||
|
||||
|
||||
describe('Validate date math directive', function () {
|
||||
var $compile;
|
||||
var $rootScope;
|
||||
let $compile;
|
||||
let $rootScope;
|
||||
var html = '<input type="text" ng-model="value" validate-date-math />';
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
|
|
@ -6,8 +6,8 @@ import 'ui/directives/validate_index_name';
|
|||
// Load the kibana app dependencies.
|
||||
|
||||
describe('Validate index name directive', function () {
|
||||
var $compile;
|
||||
var $rootScope;
|
||||
let $compile;
|
||||
let $rootScope;
|
||||
var html = '<input type="text" ng-model="indexName" validate-index-name />';
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
|
|
@ -5,8 +5,8 @@ import 'ui/directives/validate_ip';
|
|||
|
||||
|
||||
describe('Validate IP directive', function () {
|
||||
var $compile;
|
||||
var $rootScope;
|
||||
let $compile;
|
||||
let $rootScope;
|
||||
var html = '<input type="text" ng-model="value" validate-ip />';
|
||||
|
||||
beforeEach(ngMock.module('kibana'));
|
||||
|
|
|
@ -5,9 +5,9 @@ import 'ui/directives/validate_json';
|
|||
|
||||
// Load the kibana app dependencies.
|
||||
|
||||
var $parentScope;
|
||||
var $elemScope;
|
||||
var $elem;
|
||||
let $parentScope;
|
||||
let $elemScope;
|
||||
let $elem;
|
||||
var mockScope = '';
|
||||
|
||||
var input = {
|
||||
|
|
|
@ -10,7 +10,7 @@ module.directive('kbnInfiniteScroll', function () {
|
|||
},
|
||||
link: function ($scope, $element, attrs) {
|
||||
var $window = $(window);
|
||||
var checkTimer;
|
||||
let checkTimer;
|
||||
|
||||
function onScroll() {
|
||||
if (!$scope.more) return;
|
||||
|
|
|
@ -106,7 +106,7 @@ uiModules.get('kibana')
|
|||
var count = perPage ? Math.ceil($scope.list.length / perPage) : 1;
|
||||
|
||||
_.times(count, function (i) {
|
||||
var page;
|
||||
let page;
|
||||
|
||||
if (perPage) {
|
||||
var start = perPage * i;
|
||||
|
@ -194,5 +194,3 @@ uiModules.get('kibana')
|
|||
template: paginateControlsTemplate
|
||||
};
|
||||
});
|
||||
|
||||
|
||||
|
|
71
src/ui/public/directives/paginated_selectable_list.js
Normal file
71
src/ui/public/directives/paginated_selectable_list.js
Normal file
|
@ -0,0 +1,71 @@
|
|||
import _ from 'lodash';
|
||||
import uiModules from 'ui/modules';
|
||||
import paginatedSelectableListTemplate from 'ui/partials/paginated_selectable_list.html';
|
||||
|
||||
const module = uiModules.get('kibana');
|
||||
|
||||
function throwError(message) {
|
||||
throw new Error(message);
|
||||
}
|
||||
|
||||
module.directive('paginatedSelectableList', function (kbnUrl) {
|
||||
|
||||
return {
|
||||
restrict: 'E',
|
||||
scope: {
|
||||
perPage: '=?',
|
||||
list: '=',
|
||||
listProperty: '=',
|
||||
userMakeUrl: '=?',
|
||||
userOnSelect: '=?'
|
||||
},
|
||||
template: paginatedSelectableListTemplate,
|
||||
controller: function ($scope, $element, $filter) {
|
||||
// Should specify either user-make-url or user-on-select
|
||||
if (!$scope.userMakeUrl && !$scope.userOnSelect) {
|
||||
throwError('paginatedSelectableList directive expects a makeUrl or onSelect function');
|
||||
}
|
||||
|
||||
// Should specify either user-make-url or user-on-select, but not both.
|
||||
if ($scope.userMakeUrl && $scope.userOnSelect) {
|
||||
throwError('paginatedSelectableList directive expects a makeUrl or onSelect attribute but not both');
|
||||
}
|
||||
|
||||
$scope.perPage = $scope.perPage || 10;
|
||||
$scope.hits = $scope.list = _.sortBy($scope.list, accessor);
|
||||
$scope.hitCount = $scope.hits.length;
|
||||
|
||||
/**
|
||||
* Boolean that keeps track of whether hits are sorted ascending (true)
|
||||
* or descending (false)
|
||||
* * @type {Boolean}
|
||||
*/
|
||||
$scope.isAscending = true;
|
||||
|
||||
/**
|
||||
* Sorts saved object finder hits either ascending or descending
|
||||
* @param {Array} hits Array of saved finder object hits
|
||||
* @return {Array} Array sorted either ascending or descending
|
||||
*/
|
||||
$scope.sortHits = function (hits) {
|
||||
const sortedList = _.sortBy(hits, accessor);
|
||||
|
||||
$scope.isAscending = !$scope.isAscending;
|
||||
$scope.hits = $scope.isAscending ? sortedList : sortedList.reverse();
|
||||
};
|
||||
|
||||
$scope.makeUrl = function (hit) {
|
||||
return $scope.userMakeUrl(hit);
|
||||
};
|
||||
|
||||
$scope.onSelect = function (hit, $event) {
|
||||
return $scope.userOnSelect(hit, $event);
|
||||
};
|
||||
|
||||
function accessor(val) {
|
||||
const prop = $scope.listProperty;
|
||||
return prop ? val[prop] : val;
|
||||
}
|
||||
}
|
||||
};
|
||||
});
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue