Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into migrate-docview
Browse files Browse the repository at this point in the history
  • Loading branch information
flash1293 committed Mar 10, 2020
2 parents 997a15c + 35bcb36 commit bfb186e
Show file tree
Hide file tree
Showing 100 changed files with 2,732 additions and 648 deletions.
10 changes: 10 additions & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,16 @@ module.exports = {
},
},

/**
* Harden specific rules
*/
{
files: ['test/harden/*.js'],
rules: {
'mocha/handle-done-callback': 'off', // TODO: Find a way to disable all mocha rules
},
},

/**
* APM overrides
*/
Expand Down
19 changes: 17 additions & 2 deletions docs/maps/maps-aggregations.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,25 @@
[[maps-aggregations]]
== Plot big data without plotting too much data

Use {ref}/search-aggregations.html[aggregations] to plot large data sets without overwhemling your network or your browser.
Use {ref}/search-aggregations.html[aggregations] to plot large data sets without overwhelming your network or your browser.
When using aggregations, the documents stay in Elasticsearch and only the calculated values for each group are returned to your computer.

Aggregations group your documents into buckets and calculate metrics for each bucket.
Your documents stay in Elasticsearch and only the metrics for each group are returned to your computer.
Use metric aggregations for <<maps-vector-style-data-driven, data driven styling>>. For example, use the count aggregation to shade world countries by web log traffic.

You can add the following metric aggregations:

* *Average.* The mean of the values.

* *Count.* The number of documents.

* *Max.* The highest value.

* *Min.* The lowest value.

* *Sum.* The total value.

* *Unique count.* The number of distinct values.

Use aggregated layers with document layers to show aggregated views when the map shows larger
amounts of the globe and individual documents when the map shows smaller regions.
Expand Down
12 changes: 9 additions & 3 deletions docs/maps/vector-style.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,17 @@ image::maps/images/vector_style_dynamic.png[]

Quantitative data driven styling symbolizes features from a range of numeric property values.

To ensure symbols are consistent as you pan, zoom, and filter the map, quantitative data driven styling uses {ref}/search-aggregations-metrics-extendedstats-aggregation.html[extended_stats aggregation] to retrieve statistical metadata.
Property values are fit from the domain range to the style range on a linear scale.
For example, let's symbolize <<add-sample-data, Kibana sample web log>> documents by size.
The sample web logs `bytes` field ranges from 0 to 18,000. This is the domain range.
The smallest feature has a symbol radius of 1, and the largest feature has a symbol radius of 24. This is the style range.
The `bytes` property value for each feature will fit on a linear scale from the range of 0 to 18,000 to the style range of 1 to 24.

Click the gear icon image:maps/images/gear_icon.png[] to configure extended_stats. Set *Sigma* to a smaller value to minimize outliers by moving the range minimum and maximum closer to the average. Clear the *Calculate range from indices* checkbox to turn off the extended_stats aggregation request.
To ensure symbols are consistent as you pan, zoom, and filter the map, quantitative data driven styling uses {ref}/search-aggregations-metrics-extendedstats-aggregation.html[extended_stats aggregation] to retrieve statistical metadata. Extended_stats is not available for numeric property values from the <<maps-aggregations, metric aggregations>> count, sum, and unique count.

NOTE: When the *Calculate range from indices* checkbox is cleared, symbols might be inconsistent as users pan, zoom, and filter the map. Without extended_stats, the range is calulated with data from the local layer. The range is recalulcated when layer data changes.
To configure extended_stats,click the gear icon image:maps/images/gear_icon.png[] to configure extended_stats. Set *Sigma* to a smaller value to minimize outliers by moving the range minimum and maximum closer to the average. Clear the *Calculate range from indices* checkbox to turn off the extended_stats aggregation request. The gear icon is not available for numeric property values from the <<maps-aggregations, metric aggregations>> count, sum, and unique count.

NOTE: When extended_stats is not used, symbols might be inconsistent as users pan, zoom, and filter the map. Without extended_stats, the range is calculated with data from the local layer. The range is re-calculated when layer data changes.

[role="screenshot"]
image::maps/images/extended_stats_config.png[]
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -246,6 +246,7 @@
"regenerator-runtime": "^0.13.3",
"regression": "2.0.1",
"request": "^2.88.0",
"require-in-the-middle": "^5.0.2",
"reselect": "^4.0.0",
"resize-observer-polyfill": "^1.5.0",
"rison-node": "1.0.2",
Expand Down Expand Up @@ -480,6 +481,7 @@
"strip-ansi": "^3.0.1",
"supertest": "^3.1.0",
"supertest-as-promised": "^4.0.2",
"tape": "^4.13.0",
"tree-kill": "^1.2.2",
"typescript": "3.7.2",
"typings-tester": "^0.3.2",
Expand Down
41 changes: 41 additions & 0 deletions scripts/test_hardening.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Licensed to Elasticsearch B.V. under one or more contributor
* license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright
* ownership. Elasticsearch B.V. licenses this file to you under
* the Apache License, Version 2.0 (the "License"); you may
* not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/

var execFileSync = require('child_process').execFileSync;
var path = require('path');
var syncGlob = require('glob').sync;
var program = require('commander');

program
.name('node scripts/test_hardening.js')
.arguments('[file...]')
.description(
'Run the tests in test/harden directory. If no files are provided, all files within the directory will be run.'
)
.action(function(globs) {
if (globs.length === 0) globs.push(path.join('test', 'harden', '*'));
globs.forEach(function(glob) {
syncGlob(glob).forEach(function(filename) {
if (path.basename(filename)[0] === '_') return;
console.log(process.argv[0], filename);
execFileSync(process.argv[0], [filename], { stdio: 'inherit' });
});
});
})
.parse(process.argv);
7 changes: 6 additions & 1 deletion src/core/public/http/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,12 @@ export interface HttpRequestInit {

/** @public */
export interface HttpFetchQuery {
[key: string]: string | number | boolean | undefined;
[key: string]:
| string
| number
| boolean
| undefined
| Array<string | number | boolean | undefined>;
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/core/public/public.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -610,7 +610,7 @@ export interface HttpFetchOptionsWithPath extends HttpFetchOptions {
// @public (undocumented)
export interface HttpFetchQuery {
// (undocumented)
[key: string]: string | number | boolean | undefined;
[key: string]: string | number | boolean | undefined | Array<string | number | boolean | undefined>;
}

// @public
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,9 @@
// They can stay even after NP cutover
import angular from 'angular';
import { EuiIcon } from '@elastic/eui';
// @ts-ignore
import { StateProvider } from 'ui/state_management/state';
import { i18nDirective, i18nFilter, I18nProvider } from '@kbn/i18n/angular';
import { CoreStart, LegacyCoreStart, IUiSettingsClient } from 'kibana/public';
// @ts-ignore
import { AppStateProvider } from 'ui/state_management/app_state';
// @ts-ignore
import { GlobalStateProvider } from 'ui/state_management/global_state';
// @ts-ignore
import { StateManagementConfigProvider } from 'ui/state_management/config_provider';
// @ts-ignore
import { KbnUrlProvider, RedirectWhenMissingProvider } from 'ui/url';
Expand Down Expand Up @@ -117,8 +111,6 @@ export function initializeInnerAngularModule(
createLocalConfigModule(core.uiSettings);
createLocalKbnUrlModule();
createLocalTopNavModule(navigation);
createLocalGlobalStateModule();
createLocalAppStateModule();
createLocalStorageModule();
createElasticSearchModule(data);
createPagerFactoryModule();
Expand All @@ -136,6 +128,7 @@ export function initializeInnerAngularModule(
'discoverPrivate',
'discoverDocTable',
'discoverPagerFactory',
'discoverPromise',
])
.config(watchMultiDecorator)
.directive('icon', reactDirective => reactDirective(EuiIcon))
Expand All @@ -153,9 +146,8 @@ export function initializeInnerAngularModule(
'discoverConfig',
'discoverI18n',
'discoverPrivate',
'discoverPromise',
'discoverTopNav',
'discoverGlobalState',
'discoverAppState',
'discoverLocalStorageProvider',
'discoverEs',
'discoverDocTable',
Expand All @@ -178,19 +170,6 @@ export function initializeInnerAngularModule(
.service('debounce', ['$timeout', DebounceProviderTimeout]);
}

export function createLocalGlobalStateModule() {
angular
.module('discoverGlobalState', [
'discoverPrivate',
'discoverConfig',
'discoverKbnUrl',
'discoverPromise',
])
.service('globalState', function(Private: IPrivate) {
return Private(GlobalStateProvider);
});
}

function createLocalKbnUrlModule() {
angular
.module('discoverKbnUrl', ['discoverPrivate', 'ngRoute'])
Expand Down Expand Up @@ -236,26 +215,6 @@ function createLocalI18nModule() {
.directive('i18nId', i18nDirective);
}

function createLocalAppStateModule() {
angular
.module('discoverAppState', [
'discoverGlobalState',
'discoverPrivate',
'discoverConfig',
'discoverKbnUrl',
'discoverPromise',
])
.service('AppState', function(Private: IPrivate) {
return Private(AppStateProvider);
})
.service('getAppState', function(Private: any) {
return Private(AppStateProvider).getAppState;
})
.service('State', function(Private: any) {
return Private(StateProvider);
});
}

function createLocalStorageModule() {
angular
.module('discoverLocalStorageProvider', ['discoverPrivate'])
Expand Down Expand Up @@ -287,7 +246,6 @@ function createDocTableModule() {
.module('discoverDocTable', [
'discoverKbnUrl',
'discoverConfig',
'discoverAppState',
'discoverPagerFactory',
'react',
])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,14 +53,12 @@ export { wrapInI18nContext } from 'ui/i18n';
export { getRequestInspectorStats, getResponseInspectorStats } from '../../../data/public';
// @ts-ignore
export { intervalOptions } from 'ui/agg_types';
export { stateMonitorFactory } from 'ui/state_management/state_monitor_factory';
export { subscribeWithScope } from 'ui/utils/subscribe_with_scope';
// @ts-ignore
export { timezoneProvider } from 'ui/vis/lib/timezone';
export { tabifyAggResponse } from '../../../data/public';
export { unhashUrl } from '../../../../../plugins/kibana_utils/public';
export {
migrateLegacyQuery,
ensureDefaultIndexPattern,
} from '../../../../../plugins/kibana_legacy/public';

Expand All @@ -77,8 +75,6 @@ export {
EsQuerySortValue,
SortDirection,
} from '../../../../../plugins/data/public';
export { ElasticSearchHit } from '../../../../../plugins/discover/public/doc_views/doc_views_types';
export { registerTimefilterWithGlobalStateFactory } from 'ui/timefilter/setup_router';
export { getFormat } from 'ui/visualize/loader/pipeline_helpers/utilities';
// @ts-ignore
export { buildPointSeriesData } from 'ui/agg_response/point_series/point_series';
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,15 @@ <h1 class="euiScreenReaderOnly">{{screenTitle}}</h1>
<kbn-top-nav
app-name="'discover'"
config="topNavMenu"
screen-title="screenTitle"
show-search-bar="true"
show-date-picker="enableTimeRangeSelector"
index-patterns="[indexPattern]"

query="state.query"
on-query-submit="updateQuery"

show-save-query="showSaveQuery"
saved-query-id="state.savedQuery"
on-saved-query-id-change="updateSavedQueryId"

query="state.query"
saved-query-id="state.savedQuery"
screen-title="screenTitle"
show-date-picker="enableTimeRangeSelector"
show-save-query="showSaveQuery"
show-search-bar="true"
use-default-behaviors="true"
>
</kbn-top-nav>
Expand Down Expand Up @@ -186,7 +183,6 @@ <h1 class="euiScreenReaderOnly">{{screenTitle}}</h1>
columns="state.columns"
infinite-scroll="true"
filter="filterQuery"
filters="state.filters"
data-shared-item
data-title="{{opts.savedSearch.lastSavedTitle}}"
data-description="{{opts.savedSearch.description}}"
Expand Down
Loading

0 comments on commit bfb186e

Please sign in to comment.