diff --git a/x-pack/plugins/cloud_security_posture/common/types/rules/v4.ts b/x-pack/plugins/cloud_security_posture/common/types/rules/v4.ts index 375543aef4d61..78680bf111dc7 100644 --- a/x-pack/plugins/cloud_security_posture/common/types/rules/v4.ts +++ b/x-pack/plugins/cloud_security_posture/common/types/rules/v4.ts @@ -108,8 +108,8 @@ export const findCspBenchmarkRuleRequestSchema = schema.object({ /** * rule section */ - section: schema.maybe(schema.arrayOf(schema.string())), - ruleNumber: schema.maybe(schema.arrayOf(schema.string())), + section: schema.maybe(schema.string()), + ruleNumber: schema.maybe(schema.string()), }); export interface BenchmarkRuleSelectParams { diff --git a/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts b/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts index ea1879f4c073d..0dc376b19f179 100644 --- a/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts +++ b/x-pack/plugins/cloud_security_posture/common/utils/helpers.ts @@ -32,6 +32,7 @@ import type { RuleSection, } from '../types_old'; import type { BenchmarkRuleSelectParams, BenchmarksCisId } from '../types/latest'; +import type { BenchmarkRuleSelectParams as BenchmarkRuleSelectParamsV1 } from '../types/rules/v4'; /** * @example @@ -205,11 +206,11 @@ export const getBenchmarkApplicableTo = (benchmarkId: BenchmarksCisId) => { }; export const getBenchmarkFilterQuery = ( - id: BenchmarkId, - version?: string, - selectParams?: BenchmarkRuleSelectParams + benchmarkId: BenchmarkId, + benchmarkVersion?: string, + selectParams?: BenchmarkRuleSelectParamsV1 ): string => { - const baseQuery = `${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.id:${id} AND ${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.version:"v${version}"`; + const baseQuery = `${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.id:${benchmarkId} AND ${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.version:"v${benchmarkVersion}"`; const sectionQuery = selectParams?.section ? ` AND ${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.section: "${selectParams.section}"` : ''; @@ -220,11 +221,11 @@ export const getBenchmarkFilterQuery = ( }; export const getBenchmarkFilterQueryV2 = ( - id: BenchmarkId, - version?: string, + benchmarkId: BenchmarkId, + benchmarkVersion?: string, selectParams?: BenchmarkRuleSelectParams ): string => { - const baseQuery = `${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.id:${id} AND ${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.version:"v${version}"`; + const baseQuery = `${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.id:${benchmarkId} AND ${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.benchmark.version:"v${benchmarkVersion}"`; let sectionQuery = ''; let ruleNumberQuery = ''; diff --git a/x-pack/plugins/cloud_security_posture/server/routes/benchmark_rules/find/v2.ts b/x-pack/plugins/cloud_security_posture/server/routes/benchmark_rules/find/v2.ts index 324293487747b..5054fc211a529 100644 --- a/x-pack/plugins/cloud_security_posture/server/routes/benchmark_rules/find/v2.ts +++ b/x-pack/plugins/cloud_security_posture/server/routes/benchmark_rules/find/v2.ts @@ -11,9 +11,9 @@ import { CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE } from '../../../../common/constan import type { CspBenchmarkRule, + FindCspBenchmarkRuleRequest, FindCspBenchmarkRuleResponse, -} from '../../../../common/types/latest'; -import type { FindCspBenchmarkRuleRequest } from '../../../../common/types/rules/v4'; +} from '../../../../common/types/rules/v4'; import { getSortedCspBenchmarkRulesTemplates } from './utils'; export const findBenchmarkRuleHandler = async ( diff --git a/x-pack/test/cloud_security_posture_functional/page_objects/rule_page.ts b/x-pack/test/cloud_security_posture_functional/page_objects/rule_page.ts index 0ba6b032f6de4..7547bf67be8ab 100644 --- a/x-pack/test/cloud_security_posture_functional/page_objects/rule_page.ts +++ b/x-pack/test/cloud_security_posture_functional/page_objects/rule_page.ts @@ -20,8 +20,8 @@ export const RULES_CLEAR_ALL_RULES_SELECTION = 'clear-rules-selection-button'; export const RULES_ROWS_ENABLE_SWITCH_BUTTON = 'rules-row-enable-switch-button'; export const RULES_DISABLED_FILTER = 'rules-disabled-filter'; export const RULES_ENABLED_FILTER = 'rules-enabled-filter'; -export const CIS_SECTION_FILTER = 'options-filter-popover-button-section'; -export const RULE_NUMBER_FILTER = 'options-filter-popover-button-rule-number'; +export const CIS_SECTION_FILTER = 'options-filter-popover-button-cis-section-multi-select-filter'; +export const RULE_NUMBER_FILTER = 'options-filter-popover-button-rule-number-multi-select-filter'; export const RULE_NUMBER_FILTER_SEARCH_FIELD = 'rule-number-search-input'; export function RulePagePageProvider({ getService, getPageObjects }: FtrProviderContext) { diff --git a/x-pack/test/cloud_security_posture_functional/pages/rules.ts b/x-pack/test/cloud_security_posture_functional/pages/rules.ts index cbcd54dfd05f6..4841c9ad6b8b3 100644 --- a/x-pack/test/cloud_security_posture_functional/pages/rules.ts +++ b/x-pack/test/cloud_security_posture_functional/pages/rules.ts @@ -12,7 +12,6 @@ import type { FtrProviderContext } from '../ftr_provider_context'; import { RULES_BULK_ACTION_OPTION_DISABLE, RULES_BULK_ACTION_OPTION_ENABLE, - RULE_NUMBER_FILTER_SEARCH_FIELD, } from '../page_objects/rule_page'; // eslint-disable-next-line import/no-default-export @@ -160,8 +159,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) { await rule.rulePage.clickFilterPopOverOption('Control-Plane-Node-Configuration-Files'); await rule.rulePage.clickFilterPopover('section'); await rule.rulePage.clickFilterPopover('ruleNumber'); - await rule.rulePage.filterTextInput(RULE_NUMBER_FILTER_SEARCH_FIELD, '1.1.5'); - await pageObjects.header.waitUntilLoadingHasFinished(); await rule.rulePage.clickFilterPopOverOption('1.1.5'); expect((await rule.rulePage.getEnableRulesRowSwitchButton()) === 1).to.be(true); });