Commit 75f60a12 authored by Jiaan Louw's avatar Jiaan Louw

Merge branch '357231-update-policy-filter-ordering' into 'master'

Update policy type filtering

See merge request gitlab-org/gitlab!83989
parents 7591c8b4 1d995ddc
...@@ -52,6 +52,10 @@ export const POLICY_TYPE_COMPONENT_OPTIONS = { ...@@ -52,6 +52,10 @@ export const POLICY_TYPE_COMPONENT_OPTIONS = {
}; };
export const POLICY_TYPE_OPTIONS = { export const POLICY_TYPE_OPTIONS = {
ALL: {
value: '',
text: s__('SecurityOrchestration|All policies'),
},
POLICY_TYPE_NETWORK: { POLICY_TYPE_NETWORK: {
value: 'POLICY_TYPE_NETWORK', value: 'POLICY_TYPE_NETWORK',
text: s__('SecurityOrchestration|Network'), text: s__('SecurityOrchestration|Network'),
...@@ -64,10 +68,6 @@ export const POLICY_TYPE_OPTIONS = { ...@@ -64,10 +68,6 @@ export const POLICY_TYPE_OPTIONS = {
value: 'POLICY_TYPE_SCAN_RESULT', value: 'POLICY_TYPE_SCAN_RESULT',
text: s__('SecurityOrchestration|Scan result'), text: s__('SecurityOrchestration|Scan result'),
}, },
ALL: {
value: '',
text: s__('SecurityOrchestration|All policies'),
},
}; };
export const POLICIES_LIST_CONTAINER_CLASS = '.js-security-policies-container-wrapper'; export const POLICIES_LIST_CONTAINER_CLASS = '.js-security-policies-container-wrapper';
import { GlDropdownItem } from '@gitlab/ui';
import { POLICY_TYPE_OPTIONS } from 'ee/threat_monitoring/components/constants'; import { POLICY_TYPE_OPTIONS } from 'ee/threat_monitoring/components/constants';
import PolicyTypeFilter from 'ee/threat_monitoring/components/policy_type_filter.vue'; import PolicyTypeFilter from 'ee/threat_monitoring/components/policy_type_filter.vue';
import { mountExtended } from 'helpers/vue_test_utils_helper'; import { mountExtended } from 'helpers/vue_test_utils_helper';
...@@ -30,6 +31,14 @@ describe('PolicyTypeFilter component', () => { ...@@ -30,6 +31,14 @@ describe('PolicyTypeFilter component', () => {
expect(findToggle().text()).toBe(expectedToggleText); expect(findToggle().text()).toBe(expectedToggleText);
}); });
it('displays the "All policies" option first', () => {
createWrapper();
expect(wrapper.findAllComponents(GlDropdownItem).at(0).text()).toBe(
POLICY_TYPE_OPTIONS.ALL.text,
);
});
it('emits an event when an option is selected', () => { it('emits an event when an option is selected', () => {
createWrapper(); createWrapper();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment