Commit ef972198 authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '8481-add-dependency-scanning-to-gsd' into 'master'

Show Dependency Scanning results in the Group Security Dashboard

See merge request gitlab-org/gitlab-ee!9034
parents 1491f03e e47fbb4d
......@@ -48,7 +48,7 @@ export default {
<div class="dashboard-filter">
<strong class="js-name">{{ filter.name }}</strong>
<report-type-popover
v-if="filterId === 'type'"
v-if="filterId === 'report_type'"
:dashboard-documentation="dashboardDocumentation"
/>
<gl-dropdown :text="selectedOptionText" class="d-block mt-1">
......
......@@ -23,7 +23,11 @@ export default {
target="reports-info"
placement="right"
triggers="click"
:title="s__('Security Reports|At this time, the security dashboard only supports SAST.')"
:title="
s__(
'Security Reports|At this time, the security dashboard only supports SAST and dependency scanning.',
)
"
>
<a
v-if="dashboardDocumentation"
......
......@@ -13,4 +13,5 @@ export const SEVERITIES = {
export const REPORT_TYPES = {
sast: s__('ciReport|SAST'),
dependency_scanning: s__('ciReport|Dependency Scanning'),
};
......@@ -19,13 +19,17 @@ export default () => ({
},
{
name: 'Report type',
id: 'type',
id: 'report_type',
options: [
{
name: REPORT_TYPES.sast,
id: 'sast',
name: 'All',
id: 'all',
selected: true,
},
...Object.entries(REPORT_TYPES).map(type => {
const [id, name] = type;
return { id, name };
}),
],
},
],
......
......@@ -77,6 +77,7 @@ export default {
vulnerability.location && vulnerability.location.class,
);
Vue.set(state.modal.data.severity, 'value', vulnerability.severity);
Vue.set(state.modal.data.reportType, 'value', vulnerability.report_type);
Vue.set(state.modal.data.confidence, 'value', vulnerability.confidence);
Vue.set(state.modal.data.solution, 'value', vulnerability.solution);
Vue.set(state.modal, 'vulnerability', vulnerability);
......
......@@ -25,6 +25,7 @@ export default () => ({
file: { text: s__('Vulnerability|File') },
identifiers: { text: s__('Vulnerability|Identifiers') },
severity: { text: s__('Vulnerability|Severity') },
reportType: { text: s__('Vulnerability|Report Type') },
confidence: { text: s__('Vulnerability|Confidence') },
className: { text: s__('Vulnerability|Class') },
solution: { text: s__('Vulnerability|Solution') },
......
---
title: Adds dependency scanning to the report type filters on GSD
merge_request: 9034
author:
type: other
......@@ -36,9 +36,9 @@ describe('Filter component', () => {
});
});
describe('type', () => {
describe('Report type', () => {
beforeEach(() => {
props = { filterId: 'type', dashboardDocumentation: '' };
props = { filterId: 'report_type', dashboardDocumentation: '' };
vm = mountComponentWithStore(Component, { store, props });
});
......
......@@ -21,29 +21,38 @@ describe('filters module getters', () => {
describe('getFilter', () => {
it('should return the type filter information', () => {
const state = createState();
const typeFilter = getters.getFilter(state)('type');
const typeFilter = getters.getFilter(state)('report_type');
expect(typeFilter.name).toEqual('Report type');
});
});
describe('getSelectedOptions', () => {
it('should return "SAST" as the selcted option', () => {
it('should return "All" as the selcted option', () => {
const state = createState();
const selectedOptions = getters.getSelectedOptions(state, mockedGetters(state))('type');
const selectedOptions = getters.getSelectedOptions(state, mockedGetters(state))(
'report_type',
);
expect(selectedOptions).toHaveLength(1);
expect(selectedOptions[0].name).toEqual('SAST');
expect(selectedOptions[0].name).toEqual('All');
});
});
describe('getSelectedOptionIds', () => {
it('should return "sast" as the selcted option ID', () => {
it('should return "one" as the selcted project ID', () => {
const state = createState();
const selectedOptionIds = getters.getSelectedOptionIds(state, mockedGetters(state))('type');
const projectFilter = {
id: 'project',
options: [{ id: 'one', selected: true }, { id: 'anotherone', selected: false }],
};
state.filters.push(projectFilter);
const selectedOptionIds = getters.getSelectedOptionIds(state, mockedGetters(state))(
'project',
);
expect(selectedOptionIds).toHaveLength(1);
expect(selectedOptionIds[0]).toEqual('sast');
expect(selectedOptionIds[0]).toEqual('one');
});
});
......@@ -55,14 +64,6 @@ describe('filters module getters', () => {
expect(activeFilters.severity).toHaveLength(0);
});
it('should return the SAST type filter', () => {
const state = createState();
const activeFilters = getters.activeFilters(state, mockedGetters(state));
expect(activeFilters.type).toHaveLength(1);
expect(activeFilters.type[0]).toEqual('sast');
});
it('should return multiple project filters"', () => {
const state = createState();
const projectFilter = {
......
......@@ -7681,7 +7681,7 @@ msgstr ""
msgid "Security Dashboard|Issue Created"
msgstr ""
msgid "Security Reports|At this time, the security dashboard only supports SAST."
msgid "Security Reports|At this time, the security dashboard only supports SAST and dependency scanning."
msgstr ""
msgid "Security Reports|Create issue"
......@@ -9703,6 +9703,9 @@ msgstr ""
msgid "Vulnerability|Project"
msgstr ""
msgid "Vulnerability|Report Type"
msgstr ""
msgid "Vulnerability|Severity"
msgstr ""
......@@ -10221,6 +10224,9 @@ msgstr ""
msgid "ciReport|DAST"
msgstr ""
msgid "ciReport|Dependency Scanning"
msgstr ""
msgid "ciReport|Dependency Scanning detects known vulnerabilities in your source code's dependencies."
msgstr ""
......
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