mirror of
https://github.com/elastic/kibana.git
synced 2025-04-23 09:19:04 -04:00
Co-authored-by: Kibana Machine <42973632+kibanamachine@users.noreply.github.com> Co-authored-by: Michael Olorunnisola <michael.olorunnisola@elastic.co>
This commit is contained in:
parent
370bee29d0
commit
57febcecfa
3 changed files with 11 additions and 21 deletions
|
@ -89,7 +89,7 @@ interface OwnProps {
|
|||
data: TimelineItem[];
|
||||
defaultCellActions?: TGridCellAction[];
|
||||
filters?: Filter[];
|
||||
filterQuery: string;
|
||||
filterQuery?: string;
|
||||
filterStatus?: AlertStatus;
|
||||
id: string;
|
||||
indexNames: string[];
|
||||
|
|
|
@ -9,7 +9,6 @@ import type { Filter, EsQueryConfig, Query } from '@kbn/es-query';
|
|||
import { FilterStateStore } from '@kbn/es-query';
|
||||
import { isEmpty, get } from 'lodash/fp';
|
||||
import memoizeOne from 'memoize-one';
|
||||
import { ALERT_WORKFLOW_STATUS } from '@kbn/rule-data-utils';
|
||||
import {
|
||||
elementOrChildrenHasFocus,
|
||||
getFocusedAriaColindexCell,
|
||||
|
@ -190,10 +189,9 @@ export const combineQueries = ({
|
|||
|
||||
export const buildCombinedQuery = (combineQueriesParams: CombineQueries) => {
|
||||
const combinedQuery = combineQueries(combineQueriesParams);
|
||||
return combinedQuery
|
||||
return combinedQuery?.filterQuery
|
||||
? {
|
||||
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
||||
filterQuery: replaceStatusField(combinedQuery!.filterQuery),
|
||||
filterQuery: combinedQuery.filterQuery,
|
||||
}
|
||||
: null;
|
||||
};
|
||||
|
@ -229,22 +227,14 @@ export const getCombinedFilterQuery = ({
|
|||
to,
|
||||
filters,
|
||||
...combineQueriesParams
|
||||
}: CombineQueries & { from: string; to: string }): string =>
|
||||
replaceStatusField(
|
||||
combineQueries({
|
||||
...combineQueriesParams,
|
||||
filters: [...filters, buildTimeRangeFilter(from, to)],
|
||||
})?.filterQuery
|
||||
);
|
||||
}: CombineQueries & { from: string; to: string }): string | undefined => {
|
||||
const combinedQueries = combineQueries({
|
||||
...combineQueriesParams,
|
||||
filters: [...filters, buildTimeRangeFilter(from, to)],
|
||||
});
|
||||
|
||||
/**
|
||||
* This function is a temporary patch to prevent queries using old `signal.status` field.
|
||||
* @todo The `signal.status` field should not be queried anymore and
|
||||
* must be replaced by `ALERT_WORKFLOW_STATUS` field name constant
|
||||
* @deprecated
|
||||
*/
|
||||
const replaceStatusField = (filterQuery?: string): string =>
|
||||
filterQuery?.replaceAll('signal.status', ALERT_WORKFLOW_STATUS) ?? '';
|
||||
return combinedQueries ? combinedQueries.filterQuery : undefined;
|
||||
};
|
||||
|
||||
/**
|
||||
* The CSS class name of a "stateful event", which appears in both
|
||||
|
|
|
@ -23,7 +23,7 @@ interface OwnProps {
|
|||
id: string;
|
||||
totalItems: number;
|
||||
filterStatus?: AlertStatus;
|
||||
query: string;
|
||||
query?: string;
|
||||
indexName: string;
|
||||
onActionSuccess?: OnUpdateAlertStatusSuccess;
|
||||
onActionFailure?: OnUpdateAlertStatusError;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue