Skip to content

Commit a3ac877

Browse files
committed
Merge branch 'master' of github.com:elastic/kibana into join_visibility
2 parents 61b8e3c + 8acfd46 commit a3ac877

File tree

105 files changed

+3888
-2101
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+3888
-2101
lines changed

docs/siem/index.asciidoc

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ Kibana provides step-by-step instructions to help you add data. The
2424
detailed information and instructions.
2525

2626
[float]
27-
=== {Beats}
27+
=== {Beats}
2828

2929
https://www.elastic.co/products/beats/auditbeat[{auditbeat}],
3030
https://www.elastic.co/products/beats/filebeat[{filebeat}],
@@ -33,9 +33,14 @@ https://www.elastic.co/products/beats/packetbeat[{packetbeat}]
3333
send security events and other data to Elasticsearch.
3434

3535
The default index patterns for SIEM events are `auditbeat-*`, `winlogbeat-*`,
36-
`filebeat-*`, and `packetbeat-*``. You can change the default index patterns in
36+
`filebeat-*`, `endgame-*`, and `packetbeat-*``. You can change the default index patterns in
3737
*Kibana > Management > Advanced Settings > siem:defaultIndex*.
3838

39+
[float]
40+
=== Elastic Endpoint Sensor Management Platform
41+
42+
The Elastic Endpoint Sensor Management Platform (SMP) ships host and network events directly to the SIEM application, and is fully ECS compliant.
43+
3944
[float]
4045
=== Elastic Common Schema (ECS) for normalizing data
4146

x-pack/legacy/plugins/maps/common/constants.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
* or more contributor license agreements. Licensed under the Elastic License;
44
* you may not use this file except in compliance with the Elastic License.
55
*/
6+
import { i18n } from '@kbn/i18n';
67

78
export const EMS_CATALOGUE_PATH = 'ems/catalogue';
89

@@ -114,3 +115,15 @@ export const METRIC_TYPE = {
114115
SUM: 'sum',
115116
UNIQUE_COUNT: 'cardinality',
116117
};
118+
119+
export const COUNT_AGG_TYPE = METRIC_TYPE.COUNT;
120+
export const COUNT_PROP_LABEL = i18n.translate('xpack.maps.aggs.defaultCountLabel', {
121+
defaultMessage: 'count'
122+
});
123+
124+
export const COUNT_PROP_NAME = 'doc_count';
125+
126+
export const STYLE_TYPE = {
127+
'STATIC': 'STATIC',
128+
'DYNAMIC': 'DYNAMIC'
129+
};

x-pack/legacy/plugins/maps/public/actions/map_actions.js

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -735,9 +735,7 @@ export function clearMissingStyleProperties(layerId) {
735735
return;
736736
}
737737

738-
const dateFields = await targetLayer.getDateFields();
739-
const numberFields = await targetLayer.getNumberFields();
740-
const ordinalFields = [...dateFields, ...numberFields];
738+
const ordinalFields = await targetLayer.getOrdinalFields();
741739
const { hasChanges, nextStyleDescriptor } = style.getDescriptorWithMissingStylePropsRemoved(ordinalFields);
742740
if (hasChanges) {
743741
dispatch(updateLayerStyle(layerId, nextStyleDescriptor));

x-pack/legacy/plugins/maps/public/components/__snapshots__/tooltip_selector.test.js.snap

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

x-pack/legacy/plugins/maps/public/components/tooltip_selector.js

Lines changed: 93 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -30,35 +30,109 @@ const reorder = (list, startIndex, endIndex) => {
3030
return result;
3131
};
3232

33+
const getProps = async field => {
34+
return new Promise(async (resolve, reject) => {
35+
try {
36+
const label = await field.getLabel();
37+
const type = await field.getDataType();
38+
resolve({
39+
label: label,
40+
type: type,
41+
name: field.getName()
42+
});
43+
} catch(e) {
44+
reject(e);
45+
}
46+
});
47+
};
48+
3349
export class TooltipSelector extends Component {
3450

51+
state = {
52+
fieldProps: [],
53+
selectedFieldProps: []
54+
};
55+
56+
constructor() {
57+
super();
58+
this._isMounted = false;
59+
this._previousFields = null;
60+
this._previousSelectedTooltips = null;
61+
}
62+
63+
componentDidMount() {
64+
this._isMounted = true;
65+
this._loadFieldProps();
66+
this._loadTooltipFieldProps();
67+
}
68+
69+
componentWillUnmount() {
70+
this._isMounted = false;
71+
}
72+
73+
componentDidUpdate() {
74+
this._loadTooltipFieldProps();
75+
this._loadFieldProps();
76+
}
77+
78+
async _loadTooltipFieldProps() {
79+
80+
if (!this.props.tooltipFields || this.props.tooltipFields === this._previousSelectedTooltips) {
81+
return;
82+
}
83+
84+
this._previousSelectedTooltips = this.props.tooltipFields;
85+
const selectedProps = this.props.tooltipFields.map(getProps);
86+
const selectedFieldProps = await Promise.all(selectedProps);
87+
if (this._isMounted) {
88+
this.setState({ selectedFieldProps });
89+
}
90+
91+
}
92+
93+
async _loadFieldProps() {
94+
95+
if (!this.props.fields || this.props.fields === this._previousFields) {
96+
return;
97+
}
98+
99+
this._previousFields = this.props.fields;
100+
const props = this.props.fields.map(getProps);
101+
const fieldProps = await Promise.all(props);
102+
if (this._isMounted) {
103+
this.setState({ fieldProps });
104+
}
105+
106+
}
107+
35108
_getPropertyLabel = (propertyName) => {
36-
if (!this.props.fields) {
109+
if (!this.state.fieldProps.length) {
37110
return propertyName;
38111
}
39-
40-
const field = this.props.fields.find(field => {
112+
const prop = this.state.fieldProps.find((field) => {
41113
return field.name === propertyName;
42114
});
115+
return prop.label ? prop.label : propertyName;
116+
}
43117

44-
return field && field.label
45-
? field.label
46-
: propertyName;
118+
_getTooltipProperties() {
119+
return this.props.tooltipFields.map(field => field.getName());
47120
}
48121

49122
_onAdd = (properties) => {
50-
if (!this.props.tooltipProperties) {
123+
if (!this.props.tooltipFields) {
51124
this.props.onChange([...properties]);
52125
} else {
53-
this.props.onChange([...this.props.tooltipProperties, ...properties]);
126+
const existingProperties = this._getTooltipProperties();
127+
this.props.onChange([...existingProperties, ...properties]);
54128
}
55129
}
56130

57131
_removeProperty = (index) => {
58-
if (!this.props.tooltipProperties) {
132+
if (!this.props.tooltipFields) {
59133
this.props.onChange([]);
60134
} else {
61-
const tooltipProperties = [...this.props.tooltipProperties];
135+
const tooltipProperties = this._getTooltipProperties();
62136
tooltipProperties.splice(index, 1);
63137
this.props.onChange(tooltipProperties);
64138
}
@@ -70,24 +144,24 @@ export class TooltipSelector extends Component {
70144
return;
71145
}
72146

73-
this.props.onChange(reorder(this.props.tooltipProperties, source.index, destination.index));
147+
this.props.onChange(reorder(this._getTooltipProperties(), source.index, destination.index));
74148
};
75149

76150
_renderProperties() {
77-
if (!this.props.tooltipProperties) {
151+
if (!this.state.selectedFieldProps.length) {
78152
return null;
79153
}
80154

81155
return (
82156
<EuiDragDropContext onDragEnd={this._onDragEnd}>
83157
<EuiDroppable droppableId="mapLayerTOC" spacing="none">
84158
{(provided, snapshot) => (
85-
this.props.tooltipProperties.map((propertyName, idx) => (
159+
this.state.selectedFieldProps.map((field, idx) => (
86160
<EuiDraggable
87161
spacing="none"
88-
key={propertyName}
162+
key={field.name}
89163
index={idx}
90-
draggableId={propertyName}
164+
draggableId={field.name}
91165
customDragHandle={true}
92166
disableInteractiveElementBlocking // Allows button to be drag handle
93167
>
@@ -99,7 +173,7 @@ export class TooltipSelector extends Component {
99173
})}
100174
>
101175
<EuiText className="mapTooltipSelector__propertyContent" size="s">
102-
{this._getPropertyLabel(propertyName)}
176+
{this._getPropertyLabel(field.name)}
103177
</EuiText>
104178
<div className="mapTooltipSelector__propertyIcons">
105179
<EuiButtonIcon
@@ -137,13 +211,6 @@ export class TooltipSelector extends Component {
137211
}
138212

139213
render() {
140-
141-
const selectedFields = this.props.tooltipProperties
142-
? this.props.tooltipProperties.map(propertyName => {
143-
return { name: propertyName };
144-
})
145-
: [];
146-
147214
return (
148215
<div>
149216
<EuiTitle size="xxs">
@@ -160,11 +227,12 @@ export class TooltipSelector extends Component {
160227
<EuiTextAlign textAlign="center">
161228
<AddTooltipFieldPopover
162229
onAdd={this._onAdd}
163-
fields={this.props.fields}
164-
selectedFields={selectedFields}
230+
fields={this.state.fieldProps}
231+
selectedFields={this.state.selectedFieldProps}
165232
/>
166233
</EuiTextAlign>
167234
</div>
168235
);
169236
}
170237
}
238+

x-pack/legacy/plugins/maps/public/components/tooltip_selector.test.js

Lines changed: 33 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,33 +9,59 @@ import { shallow } from 'enzyme';
99

1010
import { TooltipSelector } from './tooltip_selector';
1111

12+
13+
class MockField {
14+
constructor({ name, label, type }) {
15+
this._name = name;
16+
this._label = label;
17+
this._type = type;
18+
}
19+
20+
getName() {
21+
return this._name;
22+
}
23+
24+
async getLabel() {
25+
return this._label || 'foobar_label';
26+
}
27+
28+
async getDataType() {
29+
return this._type || 'foobar_type';
30+
}
31+
}
32+
1233
const defaultProps = {
13-
tooltipProperties: ['iso2'],
34+
tooltipFields: [new MockField({ name: 'iso2' })],
1435
onChange: (()=>{}),
1536
fields: [
16-
{
37+
new MockField({
1738
name: 'iso2',
1839
label: 'ISO 3166-1 alpha-2 code',
1940
type: 'string'
20-
},
21-
{
41+
}),
42+
new MockField({
2243
name: 'iso3',
2344
type: 'string'
24-
},
45+
})
2546
]
2647
};
2748

2849
describe('TooltipSelector', () => {
2950

3051
test('should render component', async () => {
52+
3153
const component = shallow(
3254
<TooltipSelector
3355
{...defaultProps}
3456
/>
3557
);
3658

37-
expect(component)
38-
.toMatchSnapshot();
59+
// Ensure all promises resolve
60+
await new Promise(resolve => process.nextTick(resolve));
61+
// Ensure the state changes are reflected
62+
component.update();
63+
expect(component).toMatchSnapshot();
64+
3965
});
4066

4167
});

x-pack/legacy/plugins/maps/public/connected_components/layer_panel/join_editor/resources/join.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,14 @@ export class Join extends Component {
111111
async _loadLeftFields() {
112112
let leftFields;
113113
try {
114-
leftFields = await this.props.layer.getLeftJoinFields();
114+
const leftFieldsInstances = await this.props.layer.getLeftJoinFields();
115+
const leftFieldPromises = leftFieldsInstances.map(async (field) => {
116+
return {
117+
name: field.getName(),
118+
label: await field.getLabel()
119+
};
120+
});
121+
leftFields = await Promise.all(leftFieldPromises);
115122
} catch (error) {
116123
leftFields = [];
117124
}

x-pack/legacy/plugins/maps/public/connected_components/map/features_tooltip/feature_properties.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ export class FeatureProperties extends React.Component {
155155
}
156156

157157
const rows = this.state.properties.map(tooltipProperty => {
158+
158159
const label = tooltipProperty.getPropertyName();
159160
return (
160161
<tr key={label}>

x-pack/legacy/plugins/maps/public/connected_components/widget_overlay/layer_control/layer_toc/toc_entry/__snapshots__/view.test.js.snap

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)