[8.17] [SLOs] Added $state into filters schema !! (#202887) (#203056)

# Backport

This will backport the following commits from `main` to `8.17`:
- [[SLOs] Added $state into filters schema !!
(#202887)](https://github.com/elastic/kibana/pull/202887)

<!--- Backport version: 9.4.3 -->

### Questions ?
Please refer to the [Backport tool
documentation](https://github.com/sqren/backport)

<!--BACKPORT
[{"author":{"name":"Shahzad","email":"shahzad31comp@gmail.com"},"sourceCommit":{"committedDate":"2024-12-05T09:12:48Z","message":"[SLOs]
Added $state into filters schema !! (#202887)\n\n## Summary\r\n\r\nfixes
https://github.com/elastic/kibana/issues/202999\r\n\r\nAdded $state into
filters schema
!!","sha":"51e63eeaccd9998d473ef62d11d530697a836e7f","branchLabelMapping":{"^v9.0.0$":"main","^v8.18.0$":"8.x","^v(\\d+).(\\d+).\\d+$":"$1.$2"}},"sourcePullRequest":{"labels":["release_note:skip","v9.0.0","backport:prev-major"],"title":"[SLOs]
Added $state into filters schema
!!","number":202887,"url":"https://github.com/elastic/kibana/pull/202887","mergeCommit":{"message":"[SLOs]
Added $state into filters schema !! (#202887)\n\n## Summary\r\n\r\nfixes
https://github.com/elastic/kibana/issues/202999\r\n\r\nAdded $state into
filters schema
!!","sha":"51e63eeaccd9998d473ef62d11d530697a836e7f"}},"sourceBranch":"main","suggestedTargetBranches":[],"targetPullRequestStates":[{"branch":"main","label":"v9.0.0","branchLabelMappingKey":"^v9.0.0$","isSourceBranch":true,"state":"MERGED","url":"https://github.com/elastic/kibana/pull/202887","number":202887,"mergeCommit":{"message":"[SLOs]
Added $state into filters schema !! (#202887)\n\n## Summary\r\n\r\nfixes
https://github.com/elastic/kibana/issues/202999\r\n\r\nAdded $state into
filters schema !!","sha":"51e63eeaccd9998d473ef62d11d530697a836e7f"}}]}]
BACKPORT-->

Co-authored-by: Shahzad <shahzad31comp@gmail.com>
This commit is contained in:
Kibana Machine 2024-12-05 22:12:25 +11:00 committed by GitHub
parent 901201ee80
commit 5c78fb5e4e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -11,26 +11,31 @@ import { allOrAnyString } from './common';
const kqlQuerySchema = t.string;
const filtersSchema = t.array(
t.type({
meta: t.partial({
alias: t.union([t.string, t.null]),
disabled: t.boolean,
negate: t.boolean,
// controlledBy is there to identify who owns the filter
controlledBy: t.string,
// allows grouping of filters
group: t.string,
// index and type are optional only because when you create a new filter, there are no defaults
index: t.string,
isMultiIndex: t.boolean,
type: t.string,
key: t.string,
field: t.string,
params: t.any,
value: t.string,
t.intersection([
t.type({
meta: t.partial({
alias: t.union([t.string, t.null]),
disabled: t.boolean,
negate: t.boolean,
// controlledBy is there to identify who owns the filter
controlledBy: t.string,
// allows grouping of filters
group: t.string,
// index and type are optional only because when you create a new filter, there are no defaults
index: t.string,
isMultiIndex: t.boolean,
type: t.string,
key: t.string,
field: t.string,
params: t.any,
value: t.string,
}),
query: t.record(t.string, t.any),
}),
query: t.record(t.string, t.any),
})
t.partial({
$state: t.any,
}),
])
);
const kqlWithFiltersSchema = t.type({