Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,8 @@ export const storedFilterMetaSchema = schema.object(
// This would require a more complex schema definition that can handle recursive types.
// For now, we use `schema.any()` to allow flexibility in the params field.
params: schema.maybe(schema.any()),
value: schema.maybe(schema.string()),
// Typing as any since value is undocumented subset of FilterMetaParams
value: schema.maybe(schema.any()),
},
{ unknowns: 'allow' }
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
import type { FilterStateStore } from '@kbn/es-query-constants';
import type { ExistsFilter } from './exists_filter';
import type { PhrasesFilter, PhrasesFilterMeta } from './phrases_filter';
import type { PhraseFilter, PhraseFilterMeta, PhraseFilterMetaParams } from './phrase_filter';
import type {
PhraseFilter,
PhraseFilterMeta,
PhraseFilterMetaParams,
PhraseFilterValue,
} from './phrase_filter';
import type { RangeFilter, RangeFilterMeta, RangeFilterParams } from './range_filter';
import type { MatchAllFilter, MatchAllFilterMeta } from './match_all_filter';

Expand Down Expand Up @@ -73,7 +78,7 @@ export type FilterMeta = {
type?: string;
key?: string;
params?: FilterMetaParams;
value?: string;
value?: string | RangeFilterParams | PhraseFilterValue[];
};

// eslint-disable-next-line @typescript-eslint/consistent-type-definitions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,5 @@ export function getDisplayValueFromFilter(filter: Filter, indexPatterns: DataVie
return getPhrasesDisplayValue(filter, valueFormatter);
} else if (isRangeFilter(filter) || isScriptedRangeFilter(filter)) {
return getRangeDisplayValue(filter, valueFormatter);
} else return filter.meta.value ?? '';
} else return String(filter.meta.value ?? '');
}
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ type FilterMetaRestResponse = {
type?: string;
key?: string;
params?: FilterMetaParamsRestResponse;
value?: string;
value?: string | RangeFilterParamsRestResponse | PhraseFilterValue[];
};

type FilterStateStoreRestResponse = 'appState' | 'globalState';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import type {
RulesClientContext,
} from '..';
import { getEsQueryConfig } from '../../lib/get_es_query_config';
import type { RawRuleAlertsFilter } from '../../types';

export async function addGeneratedActionValues(
actions: NormalizedAlertAction[] = [],
Expand Down Expand Up @@ -55,7 +56,7 @@ export async function addGeneratedActionValues(
dsl: generateDSL(alertsFilter.query.kql, alertsFilter.query.filters) ?? '',
}
: undefined,
},
} as RawRuleAlertsFilter,
}
: {}),
};
Expand Down