Commit 2f2aedaf authored by Savas Vedova's avatar Savas Vedova

Merge branch '349749-fix-cluster-image-scanning-dropdown-item' into 'master'

Remove cluster image scanning dropdown item from scanner filter

See merge request gitlab-org/gitlab!77738
parents 02312b6e 343443b4
...@@ -3,6 +3,7 @@ import { GlDropdownDivider, GlDropdownItem, GlTruncate } from '@gitlab/ui'; ...@@ -3,6 +3,7 @@ import { GlDropdownDivider, GlDropdownItem, GlTruncate } from '@gitlab/ui';
import { union, without, get, set, keyBy } from 'lodash'; import { union, without, get, set, keyBy } from 'lodash';
import { DEFAULT_SCANNER, SCANNER_ID_PREFIX } from 'ee/security_dashboard/constants'; import { DEFAULT_SCANNER, SCANNER_ID_PREFIX } from 'ee/security_dashboard/constants';
import { createScannerOption } from 'ee/security_dashboard/helpers'; import { createScannerOption } from 'ee/security_dashboard/helpers';
import { REPORT_TYPE_CLUSTER_IMAGE_SCANNING } from '~/vue_shared/security_reports/constants';
import FilterBody from './filter_body.vue'; import FilterBody from './filter_body.vue';
import FilterItem from './filter_item.vue'; import FilterItem from './filter_item.vue';
import SimpleFilter from './simple_filter.vue'; import SimpleFilter from './simple_filter.vue';
...@@ -53,7 +54,11 @@ export default { ...@@ -53,7 +54,11 @@ export default {
const options = keyBy(this.filter.options, 'reportType'); const options = keyBy(this.filter.options, 'reportType');
const groups = { GitLab: options }; const groups = { GitLab: options };
this.scanners.forEach((scanner) => { const scanners = this.scanners.filter(
(x) => x.report_type.toLowerCase() !== REPORT_TYPE_CLUSTER_IMAGE_SCANNING,
);
scanners.forEach((scanner) => {
const vendor = scanner.vendor || DEFAULT_SCANNER; // Default to GitLab if there's no vendor. const vendor = scanner.vendor || DEFAULT_SCANNER; // Default to GitLab if there's no vendor.
const reportType = scanner.report_type; const reportType = scanner.report_type;
const id = `${vendor}.${reportType}`; const id = `${vendor}.${reportType}`;
......
...@@ -5,7 +5,7 @@ import VueRouter from 'vue-router'; ...@@ -5,7 +5,7 @@ import VueRouter from 'vue-router';
import FilterItem from 'ee/security_dashboard/components/shared/filters/filter_item.vue'; import FilterItem from 'ee/security_dashboard/components/shared/filters/filter_item.vue';
import ScannerFilter from 'ee/security_dashboard/components/shared/filters/scanner_filter.vue'; import ScannerFilter from 'ee/security_dashboard/components/shared/filters/scanner_filter.vue';
import { DEFAULT_SCANNER, SCANNER_ID_PREFIX } from 'ee/security_dashboard/constants'; import { DEFAULT_SCANNER, SCANNER_ID_PREFIX } from 'ee/security_dashboard/constants';
import { vendorScannerFilter } from 'ee/security_dashboard/helpers'; import { vendorScannerFilterNoClusterImage } from 'ee/security_dashboard/helpers';
const localVue = createLocalVue(); const localVue = createLocalVue();
localVue.use(VueRouter); localVue.use(VueRouter);
...@@ -41,7 +41,7 @@ describe('Scanner Filter component', () => { ...@@ -41,7 +41,7 @@ describe('Scanner Filter component', () => {
let filter; let filter;
const createWrapper = ({ scanners = customScanners } = {}) => { const createWrapper = ({ scanners = customScanners } = {}) => {
filter = cloneDeep(vendorScannerFilter); filter = cloneDeep(vendorScannerFilterNoClusterImage);
wrapper = shallowMount(ScannerFilter, { wrapper = shallowMount(ScannerFilter, {
localVue, localVue,
...@@ -125,7 +125,7 @@ describe('Scanner Filter component', () => { ...@@ -125,7 +125,7 @@ describe('Scanner Filter component', () => {
it('emits filter-changed event with expected data for selected options', async () => { it('emits filter-changed event with expected data for selected options', async () => {
const ids = ['GitLab.SAST', 'Custom.SAST', 'GitLab.API_FUZZING', 'GitLab.COVERAGE_FUZZING']; const ids = ['GitLab.SAST', 'Custom.SAST', 'GitLab.API_FUZZING', 'GitLab.COVERAGE_FUZZING'];
router.replace({ query: { [vendorScannerFilter.id]: ids } }); router.replace({ query: { [vendorScannerFilterNoClusterImage.id]: ids } });
const selectedScanners = customScanners.filter((x) => const selectedScanners = customScanners.filter((x) =>
ids.includes(`${x.vendor}.${x.report_type}`), ids.includes(`${x.vendor}.${x.report_type}`),
); );
......
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