Skip to content

Commit

Permalink
Merge branch 'master' into security/route-validation-audit
Browse files Browse the repository at this point in the history
  • Loading branch information
elasticmachine authored Oct 29, 2019
2 parents a6486f4 + c09e1cd commit 5b362af
Show file tree
Hide file tree
Showing 192 changed files with 3,954 additions and 1,195 deletions.
5 changes: 5 additions & 0 deletions docs/maps/trouble-shooting.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,9 @@ image::maps/images/inspector.png[]
* Ensure your tile server has configured https://developer.mozilla.org/en-US/docs/Web/HTTP/CORS[Cross-Origin Resource Sharing (CORS)] so tile requests from your Kibana domain have permission to access your tile server domain.
* Ensure tiles have the required coordinate system. Vector data must use EPSG:4326 and tiles must use EPSG:3857.

[float]
==== Coordinate and region map visualizations not available in New Visualization menu

Kibana’s out-of-the-box settings no longer offers coordinate and region maps as a choice in the New Visualization menu because you can create these maps in *Elastic Maps*.
If you want to create new coordinate and region map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`.

17 changes: 10 additions & 7 deletions docs/visualize/regionmap.asciidoc
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
[[regionmap]]
== Region Maps

Region maps are thematic maps in which boundary vector shapes are colored using a gradient:
higher intensity colors indicate larger values, and lower intensity colors indicate smaller values.
These are also known as choropleth maps.
Region maps are thematic maps in which boundary vector shapes are colored using a gradient:
higher intensity colors indicate larger values, and lower intensity colors indicate smaller values.
These are also known as choropleth maps.

Kibana’s out-of-the-box settings do not show a region map in the New Visualization menu. Use <<maps>> instead, which offers more functionality and is easier to use.
If you want to create new region map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`.

image::images/regionmap.png[]

[float]
[[regionmap-configuration]]
=== Configuration

To create a region map, you configure an inner join that joins the result of an Elasticsearch terms aggregation
To create a region map, you configure an inner join that joins the result of an Elasticsearch terms aggregation
and a reference vector file based on a shared key.

[float]
Expand All @@ -23,7 +26,7 @@ and a reference vector file based on a shared key.
Select any of the supported _Metric_ or _Sibling Pipeline Aggregations_.

[float]
===== Buckets
===== Buckets

Configure a _Terms_ aggregation. The term is the _key_ that is used to join the results to the vector data on the map.

Expand All @@ -35,7 +38,7 @@ Configure a _Terms_ aggregation. The term is the _key_ that is used to join the
- *Vector map*: select from a list of vector maps. This list includes the maps that are hosted by the © https://www.elastic.co/elastic-maps-service[Elastic Maps Service],
as well as your self-hosted layers that are configured in the *config/kibana.yml* file. To learn more about how to configure Kibana
to make self-hosted layers available, see the <<regionmap-settings,regionmap settings>> documentation. You can also explore and preview vector layers available in Elastic Maps Service at https://maps.elastic.co[https://maps.elastic.co].
- *Join field*: this is the property from the selected vector map that will be used to join on the terms in your terms-aggregation.
- *Join field*: this is the property from the selected vector map that will be used to join on the terms in your terms-aggregation.
When terms cannot be joined to any of the shapes in the vector layer because there is no exact match in the vector layer, Kibana will display a warning.
To turn of these warnings, go to *Management/Kibana/Advanced Settings* and set `visualization:regionmap:showWarnings` to `false`.

Expand All @@ -46,4 +49,4 @@ To turn of these warnings, go to *Management/Kibana/Advanced Settings* and set `
[float]
===== Basic Settings
- *Legend Position*: the location on the screen where the legend should be rendered.
- *Show Tooltip*: indicates whether a tooltip should be displayed when hovering over a shape..
- *Show Tooltip*: indicates whether a tooltip should be displayed when hovering over a shape..
5 changes: 4 additions & 1 deletion docs/visualize/tilemap.asciidoc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,10 @@

A coordinate map displays a geographic area overlaid with circles keyed to the data determined by the buckets you specify.

NOTE: By default, Kibana uses the https://www.elastic.co/elastic-maps-service[Elastic Maps Service]
Kibana’s out-of-the-box settings do not show a coordinate map in the New Visualization menu. Use <<maps>> instead, which offers more functionality and is easier to use.
If you want to create new coordinate map visualizations, set `xpack.maps.showMapVisualizationTypes` to `true`.

Kibana uses the https://www.elastic.co/elastic-maps-service[Elastic Maps Service]
to display map tiles. To use other tile service providers, configure the <<tilemap-settings,tilemap settings>>
in `kibana.yml`.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import {
createAction,
IncompatibleActionError,
} from '../../../../../../plugins/ui_actions/public';
import { changeTimeFilter, extractTimeFilter, FilterManager } from '../filter_manager';
import { TimefilterContract } from '../../timefilter';
import { FilterManager } from '../../../../../../plugins/data/public';
import { TimefilterContract, changeTimeFilter, extractTimeFilter } from '../../timefilter';
import { applyFiltersPopover } from '../apply_filters/apply_filters_popover';
import { IndexPatternsStart } from '../../index_patterns';
export const GLOBAL_APPLY_FILTER_ACTION = 'GLOBAL_APPLY_FILTER_ACTION';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { FormattedMessage } from '@kbn/i18n/react';
import React, { Component } from 'react';
import { IndexPattern } from '../../index_patterns';
import { getFilterDisplayText } from '../filter_bar/filter_editor/lib/get_filter_display_text';
import { mapAndFlattenFilters } from '../filter_manager/lib/map_and_flatten_filters';
import { mapAndFlattenFilters } from '../../../../../../plugins/data/public';
import { getDisplayValueFromFilter } from '../filter_bar/filter_editor/lib/get_display_value';

interface Props {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { FilterStateManager } from './filter_state_manager';

import { StubState } from './test_helpers/stub_state';
import { getFilter } from './test_helpers/get_stub_filter';
import { FilterManager } from './filter_manager';
import { FilterManager } from '../../../../../../plugins/data/public';

import { coreMock } from '../../../../../../core/public/mocks';
const setupMock = coreMock.createSetup();
Expand Down Expand Up @@ -101,25 +101,29 @@ describe('filter_state_manager', () => {
});

test('should update filter manager global filters', done => {
const f1 = getFilter(FilterStateStore.GLOBAL_STATE, false, false, 'age', 34);
globalStateStub.filters.push(f1);

setTimeout(() => {
const updateSubscription = filterManager.getUpdates$().subscribe(() => {
expect(filterManager.getGlobalFilters()).toHaveLength(1);
if (updateSubscription) {
updateSubscription.unsubscribe();
}
done();
}, 100);
});

const f1 = getFilter(FilterStateStore.GLOBAL_STATE, true, true, 'age', 34);
globalStateStub.filters.push(f1);
});

test('should update filter manager app filters', done => {
expect(filterManager.getAppFilters()).toHaveLength(0);
test('should update filter manager app filter', done => {
const updateSubscription = filterManager.getUpdates$().subscribe(() => {
expect(filterManager.getAppFilters()).toHaveLength(1);
if (updateSubscription) {
updateSubscription.unsubscribe();
}
done();
});

const f1 = getFilter(FilterStateStore.APP_STATE, false, false, 'age', 34);
appStateStub.filters.push(f1);

setTimeout(() => {
expect(filterManager.getAppFilters()).toHaveLength(1);
done();
}, 100);
});

test('should update URL when filter manager filters are set', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import { FilterStateStore } from '@kbn/es-query';

import _ from 'lodash';
import { State } from 'ui/state_management/state';
import { FilterManager } from './filter_manager';
import { FilterManager } from '../../../../../../plugins/data/public';

type GetAppStateFunc = () => State | undefined | null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,4 @@
* under the License.
*/

export { FilterManager } from './filter_manager';
export { FilterStateManager } from './filter_state_manager';

export { uniqFilters } from './lib/uniq_filters';
export { extractTimeFilter } from './lib/extract_time_filter';
export { changeTimeFilter } from './lib/change_time_filter';
export { onlyDisabledFiltersChanged } from './lib/only_disabled';
2 changes: 0 additions & 2 deletions src/legacy/core_plugins/data/public/filter/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@
* under the License.
*/

export * from './filter_service';

export { FilterBar } from './filter_bar';

export { ApplyFiltersPopover } from './apply_filters';
18 changes: 9 additions & 9 deletions src/legacy/core_plugins/data/public/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,7 @@ export { SearchBar, SearchBarProps, SavedQueryAttributes, SavedQuery } from './s

/** @public static code */
export * from '../common';
export {
FilterManager,
FilterStateManager,
uniqFilters,
extractTimeFilter,
changeTimeFilter,
onlyDisabledFiltersChanged,
} from './filter/filter_manager';
export { FilterStateManager } from './filter/filter_manager';
export {
CONTAINS_SPACES,
getFromSavedObject,
Expand All @@ -69,4 +62,11 @@ export {
mockIndexPattern,
} from './index_patterns';

export { TimeHistoryContract, TimefilterContract, getTime, InputTimeRange } from './timefilter';
export {
TimeHistoryContract,
TimefilterContract,
getTime,
InputTimeRange,
extractTimeFilter,
changeTimeFilter,
} from './timefilter';
2 changes: 0 additions & 2 deletions src/legacy/core_plugins/data/public/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,12 @@
* under the License.
*/

import { filterServiceMock } from './filter/filter_service.mock';
import { indexPatternsServiceMock } from './index_patterns/index_patterns_service.mock';
import { queryServiceMock } from './query/query_service.mock';
import { timefilterServiceMock } from './timefilter/timefilter_service.mock';

function createDataSetupMock() {
return {
filter: filterServiceMock.createSetupContract(),
indexPatterns: indexPatternsServiceMock.createSetupContract(),
query: queryServiceMock.createSetupContract(),
timefilter: timefilterServiceMock.createSetupContract(),
Expand Down
13 changes: 1 addition & 12 deletions src/legacy/core_plugins/data/public/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
import { CoreSetup, CoreStart, Plugin } from 'kibana/public';
import { SearchService, SearchStart, createSearchBar, StatetfulSearchBarProps } from './search';
import { QueryService, QuerySetup } from './query';
import { FilterService, FilterSetup, FilterStart } from './filter';
import { TimefilterService, TimefilterSetup } from './timefilter';
import { IndexPatternsService, IndexPatternsSetup, IndexPatternsStart } from './index_patterns';
import {
Expand Down Expand Up @@ -60,7 +59,6 @@ export interface DataSetup {
query: QuerySetup;
timefilter: TimefilterSetup;
indexPatterns: IndexPatternsSetup;
filter: FilterSetup;
}

/**
Expand All @@ -72,7 +70,6 @@ export interface DataStart {
query: QuerySetup;
timefilter: TimefilterSetup;
indexPatterns: IndexPatternsStart;
filter: FilterStart;
search: SearchStart;
ui: {
SearchBar: React.ComponentType<StatetfulSearchBarProps>;
Expand All @@ -93,8 +90,6 @@ export interface DataStart {
export class DataPlugin
implements
Plugin<DataSetup, DataStart, DataPluginSetupDependencies, DataPluginStartDependencies> {
// Exposed services, sorted alphabetically
private readonly filter: FilterService = new FilterService();
private readonly indexPatterns: IndexPatternsService = new IndexPatternsService();
private readonly query: QueryService = new QueryService();
private readonly search: SearchService = new SearchService();
Expand All @@ -109,14 +104,10 @@ export class DataPlugin
uiSettings,
store: __LEGACY.storage,
});
const filterService = this.filter.setup({
uiSettings,
});
this.setupApi = {
indexPatterns: this.indexPatterns.setup(),
query: this.query.setup(),
timefilter: timefilterService,
filter: filterService,
};

return this.setupApi;
Expand All @@ -142,12 +133,11 @@ export class DataPlugin
data,
store: __LEGACY.storage,
timefilter: this.setupApi.timefilter,
filterManager: this.setupApi.filter.filterManager,
});

uiActions.registerAction(
createFilterAction(
this.setupApi.filter.filterManager,
data.query.filterManager,
this.setupApi.timefilter.timefilter,
indexPatternsService
)
Expand All @@ -167,7 +157,6 @@ export class DataPlugin

public stop() {
this.indexPatterns.stop();
this.filter.stop();
this.query.stop();
this.search.stop();
this.timefilter.stop();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,23 @@ import { DataPublicPluginStart } from 'src/plugins/data/public';
import { Storage } from '../../../types';
import { KibanaContextProvider } from '../../../../../../../../src/plugins/kibana_react/public';
import { TimefilterSetup } from '../../../timefilter';
import { FilterManager, SearchBar } from '../../../';
import { SearchBar } from '../../../';
import { SearchBarOwnProps } from '.';

interface StatefulSearchBarDeps {
core: CoreStart;
data: DataPublicPluginStart;
store: Storage;
timefilter: TimefilterSetup;
filterManager: FilterManager;
}

export type StatetfulSearchBarProps = SearchBarOwnProps & {
appName: string;
};

const defaultFiltersUpdated = (filterManager: FilterManager) => {
const defaultFiltersUpdated = (data: DataPublicPluginStart) => {
return (filters: Filter[]) => {
filterManager.setFilters(filters);
data.query.filterManager.setFilters(filters);
};
};

Expand All @@ -55,16 +54,11 @@ const defaultOnRefreshChange = (timefilter: TimefilterSetup) => {
};
};

export function createSearchBar({
core,
store,
timefilter,
filterManager,
data,
}: StatefulSearchBarDeps) {
export function createSearchBar({ core, store, timefilter, data }: StatefulSearchBarDeps) {
// App name should come from the core application service.
// Until it's available, we'll ask the user to provide it for the pre-wired component.
return (props: StatetfulSearchBarProps) => {
const { filterManager } = data.query;
const tfRefreshInterval = timefilter.timefilter.getRefreshInterval();
const fmFilters = filterManager.getFilters();
const [refreshInterval, setRefreshInterval] = useState(tfRefreshInterval.value);
Expand Down Expand Up @@ -124,7 +118,7 @@ export function createSearchBar({
refreshInterval={refreshInterval}
isRefreshPaused={refreshPaused}
filters={filters}
onFiltersUpdated={defaultFiltersUpdated(filterManager)}
onFiltersUpdated={defaultFiltersUpdated(data)}
onRefreshChange={defaultOnRefreshChange(timefilter)}
{...props}
/>
Expand Down
3 changes: 0 additions & 3 deletions src/legacy/core_plugins/data/public/shim/legacy_module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,6 @@ import { wrapInI18nContext } from 'ui/i18n';
import { uiModules } from 'ui/modules';
import { npStart } from 'ui/new_platform';
import { FilterBar, ApplyFiltersPopover } from '../filter';

// @ts-ignore
import { mapAndFlattenFilters } from '../filter/filter_manager/lib/map_and_flatten_filters';
import { IndexPatterns } from '../index_patterns/index_patterns';

/** @internal */
Expand Down
2 changes: 2 additions & 0 deletions src/legacy/core_plugins/data/public/timefilter/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,5 @@ export * from './types';
export { Timefilter, TimefilterContract } from './timefilter';
export { TimeHistory, TimeHistoryContract } from './time_history';
export { getTime } from './get_time';
export { changeTimeFilter } from './lib/change_time_filter';
export { extractTimeFilter } from './lib/extract_time_filter';
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import { RangeFilter } from '@kbn/es-query';
import { changeTimeFilter } from './change_time_filter';
import { TimeRange } from 'src/plugins/data/public';
import { timefilterServiceMock } from '../../../timefilter/timefilter_service.mock';
import { timefilterServiceMock } from '../timefilter_service.mock';

const timefilterMock = timefilterServiceMock.createSetupContract();
const timefilter = timefilterMock.timefilter;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import moment from 'moment';
import { keys } from 'lodash';
import { RangeFilter } from '@kbn/es-query';
import { TimefilterContract } from '../../../timefilter';
import { TimefilterContract } from '../timefilter';

export function convertRangeFilterToTimeRange(filter: RangeFilter) {
const key = keys(filter.range)[0];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
import { PhraseFilterManager } from './filter_manager/phrase_filter_manager';
import { createSearchSource } from './create_search_source';
import { i18n } from '@kbn/i18n';
import { npStart } from 'ui/new_platform';
import chrome from 'ui/chrome';
import { start as data } from '../../../../core_plugins/data/public/legacy';

Expand Down Expand Up @@ -187,9 +188,10 @@ export async function listControlFactory(controlParams, useTimeFilter, SearchSou
// ignore not found error and return control so it can be displayed in disabled state.
}

const { filterManager } = npStart.plugins.data.query;
return new ListControl(
controlParams,
new PhraseFilterManager(controlParams.id, controlParams.fieldName, indexPattern, data.filter.filterManager),
new PhraseFilterManager(controlParams.id, controlParams.fieldName, indexPattern, filterManager),
useTimeFilter,
SearchSource,
);
Expand Down
Loading

0 comments on commit 5b362af

Please sign in to comment.