Skip to content

Commit 28fa96d

Browse files
committed
pr comments and ftr fix
1 parent 5aaeffe commit 28fa96d

5 files changed

Lines changed: 14 additions & 16 deletions

File tree

x-pack/plugins/cloud_security_posture/common/types/rules/v4.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,8 +108,8 @@ export const findCspBenchmarkRuleRequestSchema = schema.object({
108108
/**
109109
* rule section
110110
*/
111-
section: schema.maybe(schema.arrayOf(schema.string())),
112-
ruleNumber: schema.maybe(schema.arrayOf(schema.string())),
111+
section: schema.maybe(schema.string()),
112+
ruleNumber: schema.maybe(schema.string()),
113113
});
114114

115115
export interface BenchmarkRuleSelectParams {

x-pack/plugins/cloud_security_posture/common/utils/helpers.ts

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ import type {
3232
RuleSection,
3333
} from '../types_old';
3434
import type { BenchmarkRuleSelectParams, BenchmarksCisId } from '../types/latest';
35+
import type { BenchmarkRuleSelectParams as BenchmarkRuleSelectParamsV1 } from '../types/rules/v4';
3536

3637
/**
3738
* @example
@@ -205,11 +206,11 @@ export const getBenchmarkApplicableTo = (benchmarkId: BenchmarksCisId) => {
205206
};
206207

207208
export const getBenchmarkFilterQuery = (
208-
id: BenchmarkId,
209-
version?: string,
210-
selectParams?: BenchmarkRuleSelectParams
209+
benchmarkId: BenchmarkId,
210+
benchmarkVersion?: string,
211+
selectParams?: BenchmarkRuleSelectParamsV1
211212
): string => {
212-
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}"`;
213+
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}"`;
213214
const sectionQuery = selectParams?.section
214215
? ` AND ${CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE}.attributes.metadata.section: "${selectParams.section}"`
215216
: '';
@@ -220,11 +221,11 @@ export const getBenchmarkFilterQuery = (
220221
};
221222

222223
export const getBenchmarkFilterQueryV2 = (
223-
id: BenchmarkId,
224-
version?: string,
224+
benchmarkId: BenchmarkId,
225+
benchmarkVersion?: string,
225226
selectParams?: BenchmarkRuleSelectParams
226227
): string => {
227-
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}"`;
228+
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}"`;
228229

229230
let sectionQuery = '';
230231
let ruleNumberQuery = '';

x-pack/plugins/cloud_security_posture/server/routes/benchmark_rules/find/v2.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ import { CSP_BENCHMARK_RULE_SAVED_OBJECT_TYPE } from '../../../../common/constan
1111

1212
import type {
1313
CspBenchmarkRule,
14+
FindCspBenchmarkRuleRequest,
1415
FindCspBenchmarkRuleResponse,
15-
} from '../../../../common/types/latest';
16-
import type { FindCspBenchmarkRuleRequest } from '../../../../common/types/rules/v4';
16+
} from '../../../../common/types/rules/v4';
1717
import { getSortedCspBenchmarkRulesTemplates } from './utils';
1818

1919
export const findBenchmarkRuleHandler = async (

x-pack/test/cloud_security_posture_functional/page_objects/rule_page.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ export const RULES_CLEAR_ALL_RULES_SELECTION = 'clear-rules-selection-button';
2020
export const RULES_ROWS_ENABLE_SWITCH_BUTTON = 'rules-row-enable-switch-button';
2121
export const RULES_DISABLED_FILTER = 'rules-disabled-filter';
2222
export const RULES_ENABLED_FILTER = 'rules-enabled-filter';
23-
export const CIS_SECTION_FILTER = 'options-filter-popover-button-section';
24-
export const RULE_NUMBER_FILTER = 'options-filter-popover-button-rule-number';
23+
export const CIS_SECTION_FILTER = 'options-filter-popover-button-cis-section-multi-select-filter';
24+
export const RULE_NUMBER_FILTER = 'options-filter-popover-button-rule-number-multi-select-filter';
2525
export const RULE_NUMBER_FILTER_SEARCH_FIELD = 'rule-number-search-input';
2626

2727
export function RulePagePageProvider({ getService, getPageObjects }: FtrProviderContext) {

x-pack/test/cloud_security_posture_functional/pages/rules.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ import type { FtrProviderContext } from '../ftr_provider_context';
1212
import {
1313
RULES_BULK_ACTION_OPTION_DISABLE,
1414
RULES_BULK_ACTION_OPTION_ENABLE,
15-
RULE_NUMBER_FILTER_SEARCH_FIELD,
1615
} from '../page_objects/rule_page';
1716

1817
// eslint-disable-next-line import/no-default-export
@@ -160,8 +159,6 @@ export default function ({ getPageObjects, getService }: FtrProviderContext) {
160159
await rule.rulePage.clickFilterPopOverOption('Control-Plane-Node-Configuration-Files');
161160
await rule.rulePage.clickFilterPopover('section');
162161
await rule.rulePage.clickFilterPopover('ruleNumber');
163-
await rule.rulePage.filterTextInput(RULE_NUMBER_FILTER_SEARCH_FIELD, '1.1.5');
164-
await pageObjects.header.waitUntilLoadingHasFinished();
165162
await rule.rulePage.clickFilterPopOverOption('1.1.5');
166163
expect((await rule.rulePage.getEnableRulesRowSwitchButton()) === 1).to.be(true);
167164
});

0 commit comments

Comments
 (0)