Skip to content

Commit 0fcffc7

Browse files
Merge branch 'main' into data-quality-base-path-fix
2 parents 8919574 + 0e9d84d commit 0fcffc7

116 files changed

Lines changed: 498 additions & 137 deletions

File tree

Some content is hidden

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

packages/kbn-securitysolution-grouping/src/components/accordion_panel/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* Side Public License, v 1.
77
*/
88

9-
export const createGroupFilter = (selectedGroup: string, query?: string) =>
9+
export const createGroupFilter = (selectedGroup: string, query?: string | null) =>
1010
query && selectedGroup
1111
? [
1212
{

packages/kbn-securitysolution-grouping/src/components/accordion_panel/index.test.tsx

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,19 +8,21 @@
88

99
import { fireEvent, render } from '@testing-library/react';
1010
import { GroupPanel } from '.';
11-
import { createGroupFilter } from './helpers';
11+
import { createGroupFilter, getNullGroupFilter } from './helpers';
1212
import React from 'react';
1313

1414
const onToggleGroup = jest.fn();
1515
const renderChildComponent = jest.fn();
1616
const ruleName = 'Rule name';
17-
const ruleDesc = 'Rule description';
17+
const selectedGroup = 'kibana.alert.rule.name';
1818

1919
const testProps = {
2020
isLoading: false,
21+
isNullGroup: false,
2122
groupBucket: {
22-
key: [ruleName, ruleDesc],
23-
key_as_string: `${ruleName}|${ruleDesc}`,
23+
selectedGroup,
24+
key: [ruleName, ruleName],
25+
key_as_string: `${ruleName}|${ruleName}`,
2426
doc_count: 98,
2527
hostsCountAggregation: {
2628
value: 5,
@@ -54,7 +56,7 @@ const testProps = {
5456
},
5557
},
5658
renderChildComponent,
57-
selectedGroup: 'kibana.alert.rule.name',
59+
selectedGroup,
5860
onGroupClose: () => {},
5961
};
6062

@@ -69,7 +71,12 @@ describe('grouping accordion panel', () => {
6971
createGroupFilter(testProps.selectedGroup, ruleName)
7072
);
7173
});
72-
it('does not create query without a valid groupFieldValue', () => {
74+
it('creates the query for the selectedGroup attribute when the group is null', () => {
75+
const { getByTestId } = render(<GroupPanel {...testProps} isNullGroup />);
76+
expect(getByTestId('grouping-accordion')).toBeInTheDocument();
77+
expect(renderChildComponent).toHaveBeenCalledWith(getNullGroupFilter(testProps.selectedGroup));
78+
});
79+
it('does not render accordion or create query without a valid groupFieldValue', () => {
7380
const { queryByTestId } = render(
7481
<GroupPanel
7582
{...testProps}
@@ -83,6 +90,11 @@ describe('grouping accordion panel', () => {
8390
expect(queryByTestId('grouping-accordion')).not.toBeInTheDocument();
8491
expect(renderChildComponent).not.toHaveBeenCalled();
8592
});
93+
it('Does not render accordion or create query when groupBucket.selectedGroup !== selectedGroup', () => {
94+
const { queryByTestId } = render(<GroupPanel {...testProps} selectedGroup="source.ip" />);
95+
expect(queryByTestId('grouping-accordion')).not.toBeInTheDocument();
96+
expect(testProps.renderChildComponent).not.toHaveBeenCalled();
97+
});
8698
it('When onToggleGroup not defined, does nothing on toggle', () => {
8799
const { container } = render(<GroupPanel {...testProps} />);
88100
fireEvent.click(container.querySelector('[data-test-subj="grouping-accordion"] button')!);

packages/kbn-securitysolution-grouping/src/components/accordion_panel/index.tsx

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,22 @@ import { EuiAccordion, EuiFlexGroup, EuiFlexItem, EuiTitle, EuiIconTip } from '@
1010
import type { Filter } from '@kbn/es-query';
1111
import React, { useCallback, useEffect, useMemo, useRef } from 'react';
1212
import { firstNonNullValue } from '../../helpers';
13-
import type { RawBucket } from '../types';
13+
import type { GroupingBucket } from '../types';
1414
import { createGroupFilter, getNullGroupFilter } from './helpers';
1515

1616
interface GroupPanelProps<T> {
1717
customAccordionButtonClassName?: string;
1818
customAccordionClassName?: string;
1919
extraAction?: React.ReactNode;
2020
forceState?: 'open' | 'closed';
21-
groupBucket: RawBucket<T>;
21+
groupBucket: GroupingBucket<T>;
2222
groupPanelRenderer?: JSX.Element;
2323
groupingLevel?: number;
2424
isLoading: boolean;
2525
isNullGroup?: boolean;
2626
nullGroupMessage?: string;
2727
onGroupClose: () => void;
28-
onToggleGroup?: (isOpen: boolean, groupBucket: RawBucket<T>) => void;
28+
onToggleGroup?: (isOpen: boolean, groupBucket: GroupingBucket<T>) => void;
2929
renderChildComponent: (groupFilter: Filter[]) => React.ReactElement;
3030
selectedGroup: string;
3131
}
@@ -81,8 +81,10 @@ const GroupPanelComponent = <T,>({
8181
lastForceState.current = 'open';
8282
}
8383
}, [onGroupClose, forceState, selectedGroup]);
84-
85-
const groupFieldValue = useMemo(() => firstNonNullValue(groupBucket.key), [groupBucket.key]);
84+
const groupFieldValue = useMemo(
85+
() => (groupBucket.selectedGroup === selectedGroup ? firstNonNullValue(groupBucket.key) : null),
86+
[groupBucket.key, groupBucket.selectedGroup, selectedGroup]
87+
);
8688

8789
const groupFilters = useMemo(
8890
() =>

packages/kbn-securitysolution-grouping/src/components/grouping.mock.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const mockGroupingProps = {
2424
{
2525
key: [host1Name],
2626
key_as_string: `${host1Name}`,
27+
selectedGroup: 'host.name',
2728
doc_count: 1,
2829
hostsCountAggregation: {
2930
value: 1,
@@ -56,6 +57,7 @@ export const mockGroupingProps = {
5657
{
5758
key: [host2Name],
5859
key_as_string: `${host2Name}`,
60+
selectedGroup: 'host.name',
5961
doc_count: 1,
6062
hostsCountAggregation: {
6163
value: 1,
@@ -88,6 +90,7 @@ export const mockGroupingProps = {
8890
{
8991
key: ['-'],
9092
key_as_string: `-`,
93+
selectedGroup: 'host.name',
9194
isNullGroup: true,
9295
doc_count: 11,
9396
hostsCountAggregation: {

packages/kbn-securitysolution-grouping/src/components/types.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,16 @@ export const NONE_GROUP_KEY = 'none';
1616

1717
export type RawBucket<T> = GenericBuckets & T;
1818

19-
export interface GroupingBucket {
19+
export type GroupingBucket<T> = RawBucket<T> & {
20+
selectedGroup: string;
2021
isNullGroup?: boolean;
21-
}
22+
};
2223

2324
/** Defines the shape of the aggregation returned by Elasticsearch */
2425
// TODO: write developer docs for these fields
2526
export interface RootAggregation<T> {
2627
groupByFields?: {
27-
buckets?: Array<RawBucket<T> & GroupingBucket>;
28+
buckets?: Array<GroupingBucket<T>>;
2829
};
2930
groupsCount?: {
3031
value?: number | null;

packages/kbn-securitysolution-grouping/src/containers/query/index.test.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,19 @@ describe('group selector', () => {
161161
{
162162
key: ['20.80.64.28', '20.80.64.28'],
163163
key_as_string: '20.80.64.28|20.80.64.28',
164+
selectedGroup: 'source.ip',
164165
doc_count: 75,
165166
},
166167
{
167168
key: ['0.0.0.0', '0.0.0.0'],
168169
key_as_string: '0.0.0.0|0.0.0.0',
170+
selectedGroup: 'source.ip',
169171
doc_count: 75,
170172
},
171173
{
172174
key: ['0.0.0.0', '::'],
173175
key_as_string: '0.0.0.0|::',
176+
selectedGroup: 'source.ip',
174177
doc_count: 75,
175178
},
176179
],
@@ -186,23 +189,26 @@ describe('group selector', () => {
186189
},
187190
};
188191
it('parseGroupingQuery finds and flags the null group', () => {
189-
const result = parseGroupingQuery(groupingAggs);
192+
const result = parseGroupingQuery('source.ip', groupingAggs);
190193
expect(result).toEqual({
191194
groupByFields: {
192195
buckets: [
193196
{
194197
key: ['20.80.64.28'],
195198
key_as_string: '20.80.64.28',
199+
selectedGroup: 'source.ip',
196200
doc_count: 75,
197201
},
198202
{
199203
key: ['0.0.0.0'],
200204
key_as_string: '0.0.0.0',
205+
selectedGroup: 'source.ip',
201206
doc_count: 75,
202207
},
203208
{
204209
key: [getEmptyValue()],
205210
key_as_string: getEmptyValue(),
211+
selectedGroup: 'source.ip',
206212
isNullGroup: true,
207213
doc_count: 75,
208214
},
@@ -220,7 +226,7 @@ describe('group selector', () => {
220226
});
221227
});
222228
it('parseGroupingQuery adjust group count when null field group is present', () => {
223-
const result: GroupingAggregation<{}> = parseGroupingQuery({
229+
const result: GroupingAggregation<{}> = parseGroupingQuery('source.ip', {
224230
...groupingAggs,
225231
unitsCountWithoutNull: { value: 99 },
226232
});

packages/kbn-securitysolution-grouping/src/containers/query/index.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,9 +119,11 @@ export const getGroupingQuery = ({
119119
/**
120120
* Parses the grouping query response to add the isNullGroup
121121
* flag to the buckets and to format the bucket keys
122-
* @param buckets buckets returned from the grouping query
122+
* @param selectedGroup from the grouping query
123+
* @param aggs aggs returned from the grouping query
123124
*/
124125
export const parseGroupingQuery = <T>(
126+
selectedGroup: string,
125127
aggs?: GroupingAggregation<T>
126128
): GroupingAggregation<T> | {} => {
127129
if (!aggs) {
@@ -138,11 +140,13 @@ export const parseGroupingQuery = <T>(
138140
? {
139141
...group,
140142
key: [group.key[0]],
143+
selectedGroup,
141144
key_as_string: group.key[0],
142145
}
143146
: {
144147
...group,
145148
key: [emptyValue],
149+
selectedGroup,
146150
key_as_string: emptyValue,
147151
isNullGroup: true,
148152
};

src/plugins/kibana_usage_collection/server/collectors/application_usage/schema.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,7 @@ export const applicationUsageSchema = {
136136
enterpriseSearch: commonSchema,
137137
enterpriseSearchContent: commonSchema,
138138
enterpriseSearchAnalytics: commonSchema,
139+
enterpriseSearchApplications: commonSchema,
139140
elasticsearch: commonSchema,
140141
appSearch: commonSchema,
141142
workplaceSearch: commonSchema,

src/plugins/telemetry/schema/oss_plugins.json

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2229,6 +2229,137 @@
22292229
}
22302230
}
22312231
},
2232+
"enterpriseSearchApplications": {
2233+
"properties": {
2234+
"appId": {
2235+
"type": "keyword",
2236+
"_meta": {
2237+
"description": "The application being tracked"
2238+
}
2239+
},
2240+
"viewId": {
2241+
"type": "keyword",
2242+
"_meta": {
2243+
"description": "Always `main`"
2244+
}
2245+
},
2246+
"clicks_total": {
2247+
"type": "long",
2248+
"_meta": {
2249+
"description": "General number of clicks in the application since we started counting them"
2250+
}
2251+
},
2252+
"clicks_7_days": {
2253+
"type": "long",
2254+
"_meta": {
2255+
"description": "General number of clicks in the application over the last 7 days"
2256+
}
2257+
},
2258+
"clicks_30_days": {
2259+
"type": "long",
2260+
"_meta": {
2261+
"description": "General number of clicks in the application over the last 30 days"
2262+
}
2263+
},
2264+
"clicks_90_days": {
2265+
"type": "long",
2266+
"_meta": {
2267+
"description": "General number of clicks in the application over the last 90 days"
2268+
}
2269+
},
2270+
"minutes_on_screen_total": {
2271+
"type": "float",
2272+
"_meta": {
2273+
"description": "Minutes the application is active and on-screen since we started counting them."
2274+
}
2275+
},
2276+
"minutes_on_screen_7_days": {
2277+
"type": "float",
2278+
"_meta": {
2279+
"description": "Minutes the application is active and on-screen over the last 7 days"
2280+
}
2281+
},
2282+
"minutes_on_screen_30_days": {
2283+
"type": "float",
2284+
"_meta": {
2285+
"description": "Minutes the application is active and on-screen over the last 30 days"
2286+
}
2287+
},
2288+
"minutes_on_screen_90_days": {
2289+
"type": "float",
2290+
"_meta": {
2291+
"description": "Minutes the application is active and on-screen over the last 90 days"
2292+
}
2293+
},
2294+
"views": {
2295+
"type": "array",
2296+
"items": {
2297+
"properties": {
2298+
"appId": {
2299+
"type": "keyword",
2300+
"_meta": {
2301+
"description": "The application being tracked"
2302+
}
2303+
},
2304+
"viewId": {
2305+
"type": "keyword",
2306+
"_meta": {
2307+
"description": "The application view being tracked"
2308+
}
2309+
},
2310+
"clicks_total": {
2311+
"type": "long",
2312+
"_meta": {
2313+
"description": "General number of clicks in the application sub view since we started counting them"
2314+
}
2315+
},
2316+
"clicks_7_days": {
2317+
"type": "long",
2318+
"_meta": {
2319+
"description": "General number of clicks in the active application sub view over the last 7 days"
2320+
}
2321+
},
2322+
"clicks_30_days": {
2323+
"type": "long",
2324+
"_meta": {
2325+
"description": "General number of clicks in the active application sub view over the last 30 days"
2326+
}
2327+
},
2328+
"clicks_90_days": {
2329+
"type": "long",
2330+
"_meta": {
2331+
"description": "General number of clicks in the active application sub view over the last 90 days"
2332+
}
2333+
},
2334+
"minutes_on_screen_total": {
2335+
"type": "float",
2336+
"_meta": {
2337+
"description": "Minutes the application sub view is active and on-screen since we started counting them."
2338+
}
2339+
},
2340+
"minutes_on_screen_7_days": {
2341+
"type": "float",
2342+
"_meta": {
2343+
"description": "Minutes the application is active and on-screen active application sub view over the last 7 days"
2344+
}
2345+
},
2346+
"minutes_on_screen_30_days": {
2347+
"type": "float",
2348+
"_meta": {
2349+
"description": "Minutes the application is active and on-screen active application sub view over the last 30 days"
2350+
}
2351+
},
2352+
"minutes_on_screen_90_days": {
2353+
"type": "float",
2354+
"_meta": {
2355+
"description": "Minutes the application is active and on-screen active application sub view over the last 90 days"
2356+
}
2357+
}
2358+
}
2359+
}
2360+
}
2361+
}
2362+
},
22322363
"elasticsearch": {
22332364
"properties": {
22342365
"appId": {

x-pack/plugins/cases/public/components/markdown_editor/plugins/lens/processor.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ const LensMarkDownRendererComponent: React.FC<LensMarkDownRendererProps> = ({
5353
executionContext={{
5454
type: 'cases',
5555
}}
56+
syncTooltips={false}
57+
syncCursor={false}
5658
/>
5759
<LensChartTooltipFix />
5860
</Container>

0 commit comments

Comments
 (0)