Skip to content
Snippets Groups Projects
Unverified Commit aaba17d7 authored by Alexander Turinske's avatar Alexander Turinske :gay_pride_flag:
Browse files

Hide cluster filter behind a feature flag

- there are some backend issues with the cluster filter on the
  operational vulnerabilities report
- hide it behind a feature flag instead of reverting it
- update tests

Changelog: added

EE: true
parent 0897e267
No related branches found
No related tags found
1 merge request!90845Add operational_vulnerabilities_filters feature flag
---
name: operational_vulnerabilities_filters
introduced_by_url: https://gitlab.com/gitlab-org/gitlab/-/merge_requests/90845
rollout_issue_url: https://gitlab.com/gitlab-org/gitlab/-/issues/365986
milestone: '15.2'
type: development
group: group::container security
default_enabled: false
<script>
import { GlTabs, GlCard } from '@gitlab/ui';
import { s__ } from '~/locale';
import glFeatureFlagMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import SurveyRequestBanner from '../survey_request_banner.vue';
import VulnerabilityReportHeader from './vulnerability_report_header.vue';
import VulnerabilityReportTab from './vulnerability_report_tab.vue';
import { FIELD_PRESETS, FILTER_PRESETS, REPORT_TYPE_PRESETS } from './constants';
import { FIELD_PRESETS, FILTER_PRESETS, FILTERS, REPORT_TYPE_PRESETS } from './constants';
export const TAB_NAMES = {
OPERATIONAL: 'OPERATIONAL',
......@@ -27,6 +28,7 @@ export default {
VulnerabilityReportHeader,
VulnerabilityReportTab,
},
mixins: [glFeatureFlagMixin()],
inject: ['dashboardType'],
data() {
return {
......@@ -41,7 +43,13 @@ export default {
return this.isProjectReport ? FILTER_PRESETS.DEVELOPMENT_PROJECT : FILTER_PRESETS.DEVELOPMENT;
},
filterDropdownsOperational() {
return this.isProjectReport ? FILTER_PRESETS.OPERATIONAL_PROJECT : FILTER_PRESETS.OPERATIONAL;
if (this.isProjectReport) {
return this.glFeatures.operationalVulnerabilitiesFilters
? FILTER_PRESETS.OPERATIONAL_PROJECT
: FILTER_PRESETS.OPERATIONAL_PROJECT.filter((f) => f.id !== FILTERS.CLUSTER.id);
}
return FILTER_PRESETS.OPERATIONAL;
},
},
watch: {
......
......@@ -8,6 +8,7 @@ class VulnerabilityReportController < Projects::ApplicationController
before_action do
push_frontend_feature_flag(:vulnerability_management_survey, type: :ops)
push_frontend_feature_flag(:operational_vulnerabilities_filters, @project)
end
feature_category :vulnerability_management
......
......@@ -10,6 +10,7 @@ import SurveyRequestBanner from 'ee/security_dashboard/components/shared/survey_
import {
FIELD_PRESETS,
FILTER_PRESETS,
FILTERS,
} from 'ee/security_dashboard/components/shared/vulnerability_report/constants';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
......@@ -19,11 +20,18 @@ const router = new VueRouter();
describe('Vulnerability report tabs component', () => {
let wrapper;
const createWrapper = ({ dashboardType = DASHBOARD_TYPES.PROJECT, slots } = {}) => {
const createWrapper = ({
dashboardType = DASHBOARD_TYPES.PROJECT,
operationalVulnerabilitiesFilters = false,
slots,
} = {}) => {
wrapper = shallowMount(VulnerabilityReportTabs, {
router,
provide: {
dashboardType,
glFeatures: {
operationalVulnerabilitiesFilters,
},
},
stubs: {
VulnerabilityReportTab,
......@@ -91,7 +99,7 @@ describe('Vulnerability report tabs component', () => {
it.each`
dashboardType | expectedDevelopmentDropdowns | expectedOperationalDropdowns
${DASHBOARD_TYPES.PROJECT} | ${FILTER_PRESETS.DEVELOPMENT_PROJECT} | ${FILTER_PRESETS.OPERATIONAL_PROJECT}
${DASHBOARD_TYPES.PROJECT} | ${FILTER_PRESETS.DEVELOPMENT_PROJECT} | ${FILTER_PRESETS.OPERATIONAL_PROJECT.filter((f) => f.id !== FILTERS.CLUSTER.id)}
${DASHBOARD_TYPES.GROUP} | ${FILTER_PRESETS.DEVELOPMENT} | ${FILTER_PRESETS.OPERATIONAL}
${DASHBOARD_TYPES.INSTANCE} | ${FILTER_PRESETS.DEVELOPMENT} | ${FILTER_PRESETS.OPERATIONAL}
`(
......@@ -130,5 +138,21 @@ describe('Vulnerability report tabs component', () => {
expect(findOperationalTab().text()).toContain(wrapper.vm.$options.i18n.operationalTabMessage);
});
describe('operational_vulnerabilities_filters feature flag', () => {
it('gets the expected props', () => {
createWrapper({
dashboardType: DASHBOARD_TYPES.PROJECT,
operationalVulnerabilitiesFilters: true,
});
expect(findOperationalTab().props()).toMatchObject({
title: wrapper.vm.$options.i18n.operationalTab,
fields: FIELD_PRESETS.OPERATIONAL,
filterDropdowns: FILTER_PRESETS.OPERATIONAL_PROJECT,
filterFn: wrapper.vm.transformFiltersOperational,
});
});
});
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment