Skip to content

Commit 165fe55

Browse files
authored
Merge branch 'main' into feature/142958
2 parents f65125d + dba19ee commit 165fe55

341 files changed

Lines changed: 18911 additions & 6364 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.

.buildkite/ftr_configs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,7 @@ enabled:
176176
- x-pack/test/functional/apps/lens/group1/config.ts
177177
- x-pack/test/functional/apps/lens/group2/config.ts
178178
- x-pack/test/functional/apps/lens/group3/config.ts
179+
- x-pack/test/functional/apps/lens/open_in_lens/config.ts
179180
- x-pack/test/functional/apps/license_management/config.ts
180181
- x-pack/test/functional/apps/logstash/config.ts
181182
- x-pack/test/functional/apps/management/config.ts

.buildkite/pipeline-utils/ci-stats/pick_test_group_run_order.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -59,11 +59,15 @@ function getRunGroups(bk: BuildkiteClient, allTypes: RunGroup[], typeName: strin
5959
if (tooLongs.length > 0) {
6060
bk.setAnnotation(
6161
`test-group-too-long:${typeName}`,
62-
'error',
62+
'warning',
6363
[
6464
tooLongs.length === 1
65-
? `The following "${typeName}" config has a duration that exceeds the maximum amount of time desired for a single CI job. Please split it up.`
66-
: `The following "${typeName}" configs have durations that exceed the maximum amount of time desired for a single CI job. Please split them up.`,
65+
? `The following "${typeName}" config has a duration that exceeds the maximum amount of time desired for a single CI job. ` +
66+
`This is not an error, and if you don't own this config then you can ignore this warning. ` +
67+
`If you own this config please split it up ASAP and ask Operations if you have questions about how to do that.`
68+
: `The following "${typeName}" configs have durations that exceed the maximum amount of time desired for a single CI job. ` +
69+
`This is not an error, and if you don't own any of these configs then you can ignore this warning.` +
70+
`If you own any of these configs please split them up ASAP and ask Operations if you have questions about how to do that.`,
6771
'',
6872
...tooLongs.map(({ config, durationMin }) => ` - ${config}: ${durationMin} minutes`),
6973
].join('\n')

docs/settings/reporting-settings.asciidoc

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,9 @@ security is enabled, <<xpack-security-encryptionKey, `xpack.security.encryptionK
8383
Specifies the {time-units}[time] that the reporting poller waits between polling the index for any pending Reporting jobs. Can be specified as number of milliseconds. Defaults to `3s`.
8484

8585
[[xpack-reporting-q-timeout]] `xpack.reporting.queue.timeout` {ess-icon}::
86-
{time-units}[How long] each worker has to produce a report. If your machine is slow or under heavy load, you might need to increase this timeout. If a Reporting job execution goes over this time limit, the job is marked as a failure and no download will be available. Can be specified as number of milliseconds. Defaults to `2m`.
86+
{time-units}[How long] each worker has to produce a report. If your machine is slow or under heavy load, you
87+
might need to increase this timeout. If a Reporting job execution goes over this time limit, the job is marked
88+
as a failure and no download will be available. Can be specified as number of milliseconds. Defaults to `4m`.
8789

8890
[float]
8991
[[reporting-capture-settings]]
@@ -92,13 +94,19 @@ Specifies the {time-units}[time] that the reporting poller waits between polling
9294
Reporting uses an internal "screenshotting" plugin to capture screenshots from {kib}. The following settings control the capturing process.
9395

9496
`xpack.screenshotting.capture.timeouts.openUrl` {ess-icon}::
95-
Specify the {time-units}[time] to allow the Reporting browser to wait for the "Loading..." screen to dismiss and find the initial data for the page. If the time is exceeded, a screenshot is captured showing the current page, and the download link shows a warning message. Can be specified as number of milliseconds. Defaults to `1m`.
97+
Specify the {time-units}[time] to allow the Reporting browser to wait for the "Loading..." screen to dismiss
98+
and find the initial data for the page. If the time is exceeded, a screenshot is captured showing the current
99+
page, and the download link shows a warning message. Can be specified as number of milliseconds. Defaults to `1m`.
96100

97101
`xpack.screenshotting.capture.timeouts.waitForElements` {ess-icon}::
98-
Specify the {time-units}[time] to allow the Reporting browser to wait for all visualization panels to load on the page. If the time is exceeded, a screenshot is captured showing the current page, and the download link shows a warning message. Can be specified as number of milliseconds. Defaults to `30s`.
102+
Specify the {time-units}[time] to allow the Reporting browser to wait for all visualization panels to load on
103+
the page. If the time is exceeded, a screenshot is captured showing the current page, and the download link
104+
shows a warning message. Can be specified as number of milliseconds. Defaults to `1m`.
99105

100106
`xpack.screenshotting.capture.timeouts.renderComplete` {ess-icon}::
101-
Specify the {time-units}[time] to allow the Reporting browser to wait for all visualizations to fetch and render the data. If the time is exceeded, a screenshot is captured showing the current page, and the download link shows a warning message. Can be specified as number of milliseconds. Defaults to `30s`.
107+
Specify the {time-units}[time] to allow the Reporting browser to wait for all visualizations to fetch and
108+
render the data. If the time is exceeded, a screenshot is captured showing the current page, and the download
109+
link shows a warning message. Can be specified as number of milliseconds. Defaults to `2m`.
102110

103111
NOTE: If any timeouts from `xpack.screenshotting.capture.timeouts.*` settings occur when
104112
running a report job, Reporting will log the error and try to continue

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@
577577
"prop-types": "^15.8.1",
578578
"proxy-from-env": "1.0.0",
579579
"puid": "1.0.7",
580-
"puppeteer": "^10.2.0",
580+
"puppeteer": "18.1.0",
581581
"query-string": "^6.13.2",
582582
"rbush": "^3.0.1",
583583
"re-resizable": "^6.1.1",

packages/kbn-securitysolution-autocomplete/src/field/__tests__/index.test.tsx

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,4 +114,30 @@ describe('FieldComponent', () => {
114114
expect(wrapper.getByTestId('fieldAutocompleteComboBox')).toHaveTextContent('_source')
115115
);
116116
});
117+
118+
it('it allows custom user input if "acceptsCustomOptions" is "true"', async () => {
119+
const mockOnChange = jest.fn();
120+
const wrapper = render(
121+
<FieldComponent
122+
indexPattern={{
123+
fields,
124+
id: '1234',
125+
title: 'logstash-*',
126+
}}
127+
isClearable={false}
128+
isDisabled={false}
129+
isLoading={false}
130+
onChange={mockOnChange}
131+
placeholder="Placeholder text"
132+
selectedField={undefined}
133+
acceptsCustomOptions
134+
/>
135+
);
136+
137+
const fieldAutocompleteComboBox = wrapper.getByTestId('comboBoxSearchInput');
138+
fireEvent.change(fieldAutocompleteComboBox, { target: { value: 'custom' } });
139+
await waitFor(() =>
140+
expect(wrapper.getByTestId('fieldAutocompleteComboBox')).toHaveTextContent('custom')
141+
);
142+
});
117143
});

packages/kbn-securitysolution-autocomplete/src/field/__tests__/use_field.test.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,6 +346,18 @@ describe('useField', () => {
346346
]);
347347
});
348348
});
349+
it('should invoke onChange with custom option if one is sent', () => {
350+
const { result } = renderHook(() => useField({ indexPattern, onChange: onChangeMock }));
351+
act(() => {
352+
result.current.handleCreateCustomOption('madeUpField');
353+
expect(onChangeMock).toHaveBeenCalledWith([
354+
{
355+
name: 'madeUpField',
356+
type: 'text',
357+
},
358+
]);
359+
});
360+
});
349361
});
350362

351363
describe('fieldWidth', () => {

packages/kbn-securitysolution-autocomplete/src/field/index.tsx

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ export const FieldComponent: React.FC<FieldProps> = ({
2525
onChange,
2626
placeholder,
2727
selectedField,
28+
acceptsCustomOptions = false,
2829
}): JSX.Element => {
2930
const {
3031
isInvalid,
@@ -35,6 +36,7 @@ export const FieldComponent: React.FC<FieldProps> = ({
3536
renderFields,
3637
handleTouch,
3738
handleValuesChange,
39+
handleCreateCustomOption,
3840
} = useField({
3941
indexPattern,
4042
fieldTypeFilter,
@@ -43,6 +45,29 @@ export const FieldComponent: React.FC<FieldProps> = ({
4345
fieldInputWidth,
4446
onChange,
4547
});
48+
49+
if (acceptsCustomOptions) {
50+
return (
51+
<EuiComboBox
52+
placeholder={placeholder}
53+
options={comboOptions}
54+
selectedOptions={selectedComboOptions}
55+
onChange={handleValuesChange}
56+
isLoading={isLoading}
57+
isDisabled={isDisabled}
58+
isClearable={isClearable}
59+
isInvalid={isInvalid}
60+
onFocus={handleTouch}
61+
singleSelection={AS_PLAIN_TEXT}
62+
data-test-subj="fieldAutocompleteComboBox"
63+
style={fieldWidth}
64+
onCreateOption={handleCreateCustomOption}
65+
customOptionText="Add {searchValue} as your occupation"
66+
fullWidth
67+
/>
68+
);
69+
}
70+
4671
return (
4772
<EuiComboBox
4873
placeholder={placeholder}

packages/kbn-securitysolution-autocomplete/src/field/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ export interface FieldProps extends FieldBaseProps {
1414
isDisabled: boolean;
1515
isLoading: boolean;
1616
placeholder: string;
17+
acceptsCustomOptions?: boolean;
1718
}
1819
export interface FieldBaseProps {
1920
indexPattern: DataViewBase | undefined;

packages/kbn-securitysolution-autocomplete/src/field/use_field.tsx

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,15 @@ export const useField = ({
9797
}: FieldBaseProps) => {
9898
const [touched, setIsTouched] = useState(false);
9999

100-
const { availableFields, selectedFields } = useMemo(
101-
() => getComboBoxFields(indexPattern, selectedField, fieldTypeFilter),
102-
[indexPattern, fieldTypeFilter, selectedField]
103-
);
100+
const [customOption, setCustomOption] = useState<DataViewFieldBase | null>(null);
101+
102+
const { availableFields, selectedFields } = useMemo(() => {
103+
const indexPatternsToUse =
104+
customOption != null && indexPattern != null
105+
? { ...indexPattern, fields: [...indexPattern?.fields, customOption] }
106+
: indexPattern;
107+
return getComboBoxFields(indexPatternsToUse, selectedField, fieldTypeFilter);
108+
}, [indexPattern, fieldTypeFilter, selectedField, customOption]);
104109

105110
const { comboOptions, labels, selectedComboOptions, disabledLabelTooltipTexts } = useMemo(
106111
() => getComboBoxProps({ availableFields, selectedFields }),
@@ -117,6 +122,19 @@ export const useField = ({
117122
[availableFields, labels, onChange]
118123
);
119124

125+
const handleCreateCustomOption = useCallback(
126+
(val: string) => {
127+
const normalizedSearchValue = val.trim().toLowerCase();
128+
129+
if (!normalizedSearchValue) {
130+
return;
131+
}
132+
setCustomOption({ name: val, type: 'text' });
133+
onChange([{ name: val, type: 'text' }]);
134+
},
135+
[onChange]
136+
);
137+
120138
const handleTouch = useCallback((): void => {
121139
setIsTouched(true);
122140
}, [setIsTouched]);
@@ -161,5 +179,6 @@ export const useField = ({
161179
renderFields,
162180
handleTouch,
163181
handleValuesChange,
182+
handleCreateCustomOption,
164183
};
165184
};

packages/kbn-securitysolution-exception-list-components/README.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# @kbn/securitysolution-exception-list-components
22

3-
This is where the building UI components of the Exception-List live
4-
Most of the components here are imported from `x-pack/plugins/security_solutions/public/detection_engine`
3+
Common exceptions' components
54

65
# Aim
76

8-
TODO
7+
- To have most of the Exceptions' components in one place, to be shared accross multiple pages and used for different logic.
8+
- This `package` holds the presetational part of the components only as the API or the logic part should reside under the consumer page
99

1010
# Pattern used
1111

@@ -14,9 +14,19 @@ component
1414
index.tsx
1515
index.styles.ts <-- to hold styles if the component has many custom styles
1616
use_component.ts <-- for logic if the Presentational Component has logic
17-
index.test.tsx
17+
component.test.tsx
1818
use_component.test.tsx
19+
1920
```
21+
# Testing
22+
23+
In order to unify our testing tools, we configured only two libraries, the `React-Testing-Library` to test the component UI part and the `Reat-Testing-Hooks` to test the component's UI interactions
24+
25+
# Styling
26+
27+
In order to follow the `KBN-Packages's` recommendations, to define a custom CSS we can only use the `@emotion/react` or `@emotion/css` libraries
28+
29+
2030

2131
# Next
2232

0 commit comments

Comments
 (0)