-
Notifications
You must be signed in to change notification settings - Fork 8.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Cloud Security] Rules Combo Box filters Custom component (#175175)
## Summary This PR is for updating the current find rule API to allow multi select and search on section and rule numbers it also add a custom component for the section and rule number filter also some small UI fixes <img width="1486" alt="Screenshot 2024-01-24 at 4 22 35 AM" src="https://github.com/elastic/kibana/assets/8703149/c78987a0-b4a8-4dcc-b1fb-71ade0853340">
- Loading branch information
Showing
20 changed files
with
633 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,5 +5,5 @@ | |
* 2.0. | ||
*/ | ||
|
||
export * from './rules/v4'; | ||
export * from './rules/v5'; | ||
export * from './benchmarks/v2'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
x-pack/plugins/cloud_security_posture/common/types/rules/v5.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
/* | ||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one | ||
* or more contributor license agreements. Licensed under the Elastic License | ||
* 2.0; you may not use this file except in compliance with the Elastic License | ||
* 2.0. | ||
*/ | ||
import { schema, TypeOf } from '@kbn/config-schema'; | ||
import { DEFAULT_BENCHMARK_RULES_PER_PAGE } from './v3'; | ||
|
||
export type { | ||
cspBenchmarkRuleMetadataSchema, | ||
CspBenchmarkRuleMetadata, | ||
cspBenchmarkRuleSchema, | ||
CspBenchmarkRule, | ||
FindCspBenchmarkRuleResponse, | ||
} from './v3'; | ||
export type { | ||
PageUrlParams, | ||
rulesToUpdate, | ||
CspBenchmarkRulesBulkActionRequestSchema, | ||
CspBenchmarkRulesBulkActionResponse, | ||
RuleStateAttributes, | ||
CspBenchmarkRulesStates, | ||
cspSettingsSchema, | ||
CspSettings, | ||
BulkActionBenchmarkRulesResponse, | ||
} from './v4'; | ||
|
||
export type FindCspBenchmarkRuleRequest = TypeOf<typeof findCspBenchmarkRuleRequestSchema>; | ||
|
||
export const findCspBenchmarkRuleRequestSchema = schema.object({ | ||
/** | ||
* An Elasticsearch simple_query_string | ||
*/ | ||
search: schema.maybe(schema.string()), | ||
|
||
/** | ||
* The page of objects to return | ||
*/ | ||
page: schema.number({ defaultValue: 1, min: 1 }), | ||
|
||
/** | ||
* The number of objects to include in each page | ||
*/ | ||
perPage: schema.number({ defaultValue: DEFAULT_BENCHMARK_RULES_PER_PAGE, min: 0 }), | ||
|
||
/** | ||
* Fields to retrieve from CspBenchmarkRule saved object | ||
*/ | ||
fields: schema.maybe(schema.arrayOf(schema.string())), | ||
|
||
/** | ||
* The fields to perform the parsed query against. | ||
* Valid fields are fields which mapped to 'text' in cspBenchmarkRuleSavedObjectMapping | ||
*/ | ||
searchFields: schema.arrayOf( | ||
schema.oneOf([schema.literal('metadata.name.text'), schema.literal('metadata.section.text')]), | ||
{ defaultValue: ['metadata.name.text'] } | ||
), | ||
|
||
/** | ||
* Sort Field | ||
*/ | ||
sortField: schema.oneOf( | ||
[ | ||
schema.literal('metadata.name'), | ||
schema.literal('metadata.section'), | ||
schema.literal('metadata.id'), | ||
schema.literal('metadata.version'), | ||
schema.literal('metadata.benchmark.id'), | ||
schema.literal('metadata.benchmark.name'), | ||
schema.literal('metadata.benchmark.posture_type'), | ||
schema.literal('metadata.benchmark.version'), | ||
schema.literal('metadata.benchmark.rule_number'), | ||
], | ||
{ | ||
defaultValue: 'metadata.benchmark.rule_number', | ||
} | ||
), | ||
|
||
/** | ||
* The order to sort by | ||
*/ | ||
sortOrder: schema.oneOf([schema.literal('asc'), schema.literal('desc')], { | ||
defaultValue: 'asc', | ||
}), | ||
|
||
/** | ||
* benchmark id | ||
*/ | ||
benchmarkId: schema.maybe( | ||
schema.oneOf([ | ||
schema.literal('cis_k8s'), | ||
schema.literal('cis_eks'), | ||
schema.literal('cis_aws'), | ||
schema.literal('cis_azure'), | ||
schema.literal('cis_gcp'), | ||
]) | ||
), | ||
|
||
/** | ||
* benchmark version | ||
*/ | ||
benchmarkVersion: schema.maybe(schema.string()), | ||
|
||
/** | ||
* rule section | ||
*/ | ||
section: schema.maybe( | ||
schema.oneOf([schema.string(), schema.arrayOf(schema.string(), { minSize: 1 })]) | ||
), | ||
ruleNumber: schema.maybe( | ||
schema.oneOf([schema.string(), schema.arrayOf(schema.string(), { minSize: 1 })]) | ||
), | ||
}); | ||
|
||
export interface BenchmarkRuleSelectParams { | ||
section?: string[]; | ||
ruleNumber?: string[]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.