Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into ftr/serverless-user…
Browse files Browse the repository at this point in the history
…-manager
  • Loading branch information
dmlemeshko committed Dec 4, 2023
2 parents 84cf0a8 + 1db5570 commit 484af20
Show file tree
Hide file tree
Showing 189 changed files with 6,044 additions and 1,974 deletions.
4 changes: 2 additions & 2 deletions fleet_packages.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,12 +42,12 @@
},
{
"name": "profiler_symbolizer",
"version": "8.10.0",
"version": "8.12.0",
"forceAlignStackVersion": true
},
{
"name": "profiler_collector",
"version": "8.11.0",
"version": "8.12.0",
"forceAlignStackVersion": true
},
{
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@
"@elastic/datemath": "5.0.3",
"@elastic/elasticsearch": "npm:@elastic/elasticsearch-canary@8.9.1-canary.1",
"@elastic/ems-client": "8.5.1",
"@elastic/eui": "90.0.1",
"@elastic/eui": "90.0.1-backport.0",
"@elastic/filesaver": "1.1.2",
"@elastic/node-crypto": "1.2.1",
"@elastic/numeral": "^2.5.1",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,18 @@ describe('isRetryableEsClientError', () => {
expect(isRetryableEsClientError(error)).toEqual(true);
});

it.each([503, 401, 403, 408, 410, 429])('ResponseError with %p status code', (statusCode) => {
const error = new esErrors.ResponseError(
elasticsearchClientMock.createApiResponse({
statusCode,
body: { error: { type: 'reason' } },
})
);
it.each([503, 504, 401, 403, 408, 410, 429])(
'ResponseError with %p status code',
(statusCode) => {
const error = new esErrors.ResponseError(
elasticsearchClientMock.createApiResponse({
statusCode,
body: { error: { type: 'reason' } },
})
);

expect(isRetryableEsClientError(error)).toEqual(true);
});
expect(isRetryableEsClientError(error)).toEqual(true);
}
);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,13 @@
import { errors as EsErrors } from '@elastic/elasticsearch';

const retryResponseStatuses = [
503, // ServiceUnavailable
401, // AuthorizationException
403, // AuthenticationException
408, // RequestTimeout
410, // Gone
429, // TooManyRequests -> ES circuit breaker
503, // ServiceUnavailable
504, // GatewayTimeout
];

/**
Expand Down
2 changes: 1 addition & 1 deletion src/dev/license_checker/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ export const LICENSE_OVERRIDES = {
'jsts@1.6.2': ['Eclipse Distribution License - v 1.0'], // cf. https://github.com/bjornharrtell/jsts
'@mapbox/jsonlint-lines-primitives@2.0.2': ['MIT'], // license in readme https://github.com/tmcw/jsonlint
'@elastic/ems-client@8.5.1': ['Elastic License 2.0'],
'@elastic/eui@90.0.1': ['SSPL-1.0 OR Elastic License 2.0'],
'@elastic/eui@90.0.1-backport.0': ['SSPL-1.0 OR Elastic License 2.0'],
'language-subtag-registry@0.3.21': ['CC-BY-4.0'], // retired ODC‑By license https://github.com/mattcg/language-subtag-registry
'buffers@0.1.1': ['MIT'], // license in importing module https://www.npmjs.com/package/binary
};
Original file line number Diff line number Diff line change
Expand Up @@ -142,6 +142,7 @@ export interface FilterEditorComponentProps {
mode?: 'edit' | 'add';
suggestionsAbstraction?: SuggestionsAbstraction;
docLinks: DocLinksStart;
filtersCount?: number;
}

export type FilterEditorProps = WithEuiThemeProps & FilterEditorComponentProps;
Expand Down Expand Up @@ -355,6 +356,7 @@ class FilterEditorComponent extends Component<FilterEditorProps, State> {
onChange={this.onLocalFilterChange}
disabled={!selectedDataView}
suggestionsAbstraction={this.props.suggestionsAbstraction}
filtersCount={this.props.filtersCount}
/>
</EuiToolTip>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ export interface FilterItemProps extends WithCloseFilterEditorConfirmModalProps
filtersForSuggestions?: Filter[];
readOnly?: boolean;
suggestionsAbstraction?: SuggestionsAbstraction;
filtersCount?: number;
}

type FilterPopoverProps = HTMLAttributes<HTMLDivElement> & EuiPopoverProps;
Expand Down Expand Up @@ -398,6 +399,7 @@ function FilterItemComponent(props: FilterItemProps) {
filtersForSuggestions={props.filtersForSuggestions}
suggestionsAbstraction={props.suggestionsAbstraction}
docLinks={docLinks}
filtersCount={props.filtersCount}
/>
</div>,
]}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ const FilterItemsUI = React.memo(function FilterItemsUI(props: FilterItemsProps)
filtersForSuggestions={props.filtersForSuggestions}
readOnly={readOnly}
suggestionsAbstraction={props.suggestionsAbstraction}
filtersCount={props.filters.length}
/>
</EuiFlexItem>
));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export interface FilterGroupProps {
/** @internal used for recursive rendering **/
renderedLevel?: number;
reverseBackground?: boolean;
filtersCount?: number;
}

/** @internal **/
Expand Down Expand Up @@ -75,6 +76,7 @@ export const FilterGroup = ({
path,
reverseBackground = false,
renderedLevel = 0,
filtersCount,
}: FilterGroupProps) => {
const {
globalParams: { maxDepth, hideOr },
Expand Down Expand Up @@ -128,6 +130,7 @@ export const FilterGroup = ({
color={color}
index={index}
renderedLevel={renderedLevel}
filtersCount={filtersCount}
/>
</EuiFlexItem>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import { buildEmptyFilter, getFilterParams, BooleanRelation } from '@kbn/es-quer
import { DataViewField } from '@kbn/data-views-plugin/common';
import { cx } from '@emotion/css';

import { css } from '@emotion/react';
import { FieldInput } from './field_input';
import { OperatorInput } from './operator_input';
import { ParamsEditor } from './params_editor';
Expand Down Expand Up @@ -71,6 +72,7 @@ export interface FilterItemProps {
/** @internal used for recursive rendering **/
renderedLevel: number;
reverseBackground: boolean;
filtersCount?: number;
}

const isMaxFilterNesting = (path: string) => {
Expand All @@ -89,6 +91,7 @@ export function FilterItem({
index,
renderedLevel,
draggable = true,
filtersCount = 1,
}: FilterItemProps) {
const {
dispatch,
Expand Down Expand Up @@ -253,6 +256,15 @@ export function FilterItem({
className={cx({
[cursorOrCss]: dropTarget === path && !hideOr,
})}
css={
// With a single filter there's a disabled cursor set at dragging level
// so we need to revert such css directive for the rest of the editor row
filtersCount === 1
? css`
cursor: auto;
`
: undefined
}
>
<EuiFlexItem
role="button"
Expand Down Expand Up @@ -301,7 +313,18 @@ export function FilterItem({
</EuiFlexItem>
<EuiFlexItem className={fieldAndParamCss(euiTheme)}>
<EuiFormRow>
<div data-test-subj="filterParams">
<div
data-test-subj="filterParams"
css={
// The disabled cursor downstream is unset
// so force the correct cursor here based on the operator
operator
? undefined
: css`
cursor: not-allowed;
`
}
>
<ParamsEditor
dataView={dataView}
field={field}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ export interface FiltersBuilderProps {
hideOr?: boolean;
disabled?: boolean;
suggestionsAbstraction?: SuggestionsAbstraction;
filtersCount?: number;
}

const rootLevelConditionType = BooleanRelation.AND;
Expand All @@ -43,6 +44,7 @@ function FiltersBuilder({
hideOr = false,
disabled = false,
suggestionsAbstraction,
filtersCount,
}: FiltersBuilderProps) {
const filtersRef = useRef(filters);
const [state, dispatch] = useReducer(FiltersBuilderReducer, { filters });
Expand Down Expand Up @@ -135,7 +137,12 @@ function FiltersBuilder({
}}
>
<EuiDragDropContext onDragEnd={onDragEnd} onDragUpdate={onDragActive}>
<FilterGroup filters={state.filters} booleanRelation={rootLevelConditionType} path={''} />
<FilterGroup
filters={state.filters}
booleanRelation={rootLevelConditionType}
path={''}
filtersCount={filtersCount}
/>
</EuiDragDropContext>
</FiltersBuilderContextType.Provider>
</div>
Expand Down
1 change: 1 addition & 0 deletions x-pack/plugins/cases/common/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,7 @@ export const LOCAL_STORAGE_KEYS = {
casesQueryParams: 'cases.list.queryParams',
casesFilterOptions: 'cases.list.filterOptions',
casesTableColumns: 'cases.list.tableColumns',
casesTableFiltersConfig: 'cases.list.tableFiltersConfig',
};

/**
Expand Down
1 change: 0 additions & 1 deletion x-pack/plugins/cases/common/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ export {
export type { AttachmentAttributes } from './types/domain';
export { ConnectorTypes, AttachmentType, ExternalReferenceStorageType } from './types/domain';
export { getCasesFromAlertsUrl, getCaseFindUserActionsUrl, throwErrors } from './api';
export { StatusAll } from './ui/types';
export { createUICapabilities, type CasesUiCapabilities } from './utils/capabilities';
export { getApiTags, type CasesApiTags } from './utils/api_tags';
export { CaseMetricsFeature } from './types/api';
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/cases/common/types/api/case/v1.ts
Original file line number Diff line number Diff line change
Expand Up @@ -189,11 +189,11 @@ export const CasesFindRequestRt = rt.intersection([
/**
* The status of the case (open, closed, in-progress)
*/
status: CaseStatusRt,
status: rt.union([CaseStatusRt, rt.array(CaseStatusRt)]),
/**
* The severity of the case
*/
severity: CaseSeverityRt,
severity: rt.union([CaseSeverityRt, rt.array(CaseSeverityRt)]),
/**
* The uids of the user profiles to filter by
*/
Expand Down
25 changes: 14 additions & 11 deletions x-pack/plugins/cases/common/ui/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import type {
ExternalReferenceAttachment,
PersistableStateAttachment,
Configuration,
CustomFieldTypes,
} from '../types/domain';
import type {
CasePatchRequest,
Expand Down Expand Up @@ -69,14 +70,6 @@ export interface CasesUiConfigType {
};
}

export const StatusAll = 'all' as const;
export type StatusAllType = typeof StatusAll;

export type CaseStatusWithAllStatus = CaseStatuses | StatusAllType;

export const SeverityAll = 'all' as const;
export type CaseSeverityWithAll = CaseSeverity | typeof SeverityAll;

export const UserActionTypeAll = 'all' as const;
export type CaseUserActionTypeWithAll = UserActionFindRequestTypes | typeof UserActionTypeAll;

Expand Down Expand Up @@ -157,17 +150,27 @@ export interface ParsedUrlQueryParams extends Partial<UrlQueryParams> {

export type LocalStorageQueryParams = Partial<Omit<QueryParams, 'page'>>;

export interface FilterOptions {
export interface SystemFilterOptions {
search: string;
searchFields: string[];
severity: CaseSeverityWithAll;
status: CaseStatusWithAllStatus;
severity: CaseSeverity[];
status: CaseStatuses[];
tags: string[];
assignees: Array<string | null> | null;
reporters: User[];
owner: string[];
category: string[];
}

export interface FilterOptions extends SystemFilterOptions {
customFields: {
[key: string]: {
type: CustomFieldTypes;
options: string[];
};
};
}

export type PartialFilterOptions = Partial<FilterOptions>;

export type SingleCaseMetrics = SingleCaseMetricsResponse;
Expand Down
4 changes: 2 additions & 2 deletions x-pack/plugins/cases/public/common/mock/test_providers.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ export interface AppMockRenderer {
render: UiRender;
coreStart: StartServices;
queryClient: QueryClient;
AppWrapper: React.FC<{ children: React.ReactElement }>;
AppWrapper: React.FC<{ children: React.ReactNode }>;
getFilesClient: () => ScopedFilesClient;
}

Expand Down Expand Up @@ -176,7 +176,7 @@ export const createAppMockRenderer = ({

const getFilesClient = mockGetFilesClient();

const AppWrapper: React.FC<{ children: React.ReactElement }> = ({ children }) => (
const AppWrapper: React.FC<{ children: React.ReactNode }> = ({ children }) => (
<I18nProvider>
<KibanaContextProvider services={services}>
<ThemeProvider theme={() => ({ eui: euiDarkVars, darkMode: true })}>
Expand Down
Loading

0 comments on commit 484af20

Please sign in to comment.