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