Commit 41439630 authored by Savas Vedova's avatar Savas Vedova

Hide activity filter when it's the pipeline dashboard

The activity filter will not be displayed in the new
pipeline dashboard, at least for now. This MR prepares the
code for that behaviour.
parent afcb3d3f
......@@ -8,6 +8,7 @@ import {
activityFilter,
getProjectFilter,
} from '../helpers';
import { DASHBOARD_TYPES } from '../store/constants';
import ActivityFilter from './filters/activity_filter.vue';
import ScannerFilter from './filters/scanner_filter.vue';
import StandardFilter from './filters/standard_filter.vue';
......@@ -15,6 +16,7 @@ import StandardFilter from './filters/standard_filter.vue';
export default {
components: { StandardFilter, ScannerFilter, ActivityFilter },
mixins: [glFeatureFlagsMixin()],
inject: ['dashboardType'],
props: {
projects: { type: Array, required: false, default: undefined },
},
......@@ -24,6 +26,9 @@ export default {
};
},
computed: {
isPipeline() {
return this.dashboardType === DASHBOARD_TYPES.PIPELINE;
},
standardFilters() {
return this.shouldShowCustomScannerFilter
? [stateFilter, severityFilter]
......@@ -71,7 +76,11 @@ export default {
:filter="$options.scannerFilter"
@filter-changed="updateFilterQuery"
/>
<activity-filter :filter="$options.activityFilter" @filter-changed="updateFilterQuery" />
<activity-filter
v-if="!isPipeline"
:filter="$options.activityFilter"
@filter-changed="updateFilterQuery"
/>
<standard-filter
v-if="shouldShowProjectFilter"
:filter="projectFilter"
......
......@@ -4,6 +4,7 @@ import ScannerFilter from 'ee/security_dashboard/components/filters/scanner_filt
import StandardFilter from 'ee/security_dashboard/components/filters/standard_filter.vue';
import Filters from 'ee/security_dashboard/components/first_class_vulnerability_filters.vue';
import { scannerFilter, getProjectFilter } from 'ee/security_dashboard/helpers';
import { DASHBOARD_TYPES } from 'ee/security_dashboard/store/constants';
import { extendedWrapper } from 'helpers/vue_test_utils_helper';
describe('First class vulnerability filters component', () => {
......@@ -24,7 +25,10 @@ describe('First class vulnerability filters component', () => {
return extendedWrapper(
shallowMount(Filters, {
propsData: props,
provide,
provide: {
dashboardType: DASHBOARD_TYPES.PROJECT,
...provide,
},
}),
);
};
......@@ -87,4 +91,14 @@ describe('First class vulnerability filters component', () => {
]);
});
});
describe('pipeline dashboard', () => {
beforeEach(() => {
wrapper = createComponent({ provide: { dashboardType: DASHBOARD_TYPES.PIPELINE } });
});
it('does not display the activity filter', () => {
expect(findActivityFilter().exists()).toBe(false);
});
});
});
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