Commit 12eb6a8f authored by Illya Klymov's avatar Illya Klymov

Merge branch 'add-scanner-name-to-row' into 'master'

Add report type & scanner name to security dashboards

See merge request gitlab-org/gitlab!31775
parents 41b4adb2 a2bdc67c
...@@ -77,6 +77,9 @@ export default { ...@@ -77,6 +77,9 @@ export default {
<div class="table-section flex-grow-1" role="rowheader"> <div class="table-section flex-grow-1" role="rowheader">
{{ s__('Reports|Vulnerability') }} {{ s__('Reports|Vulnerability') }}
</div> </div>
<div class="table-section section-15" role="rowheader">
{{ s__('Reports|Scanner') }}
</div>
<div class="table-section section-20" role="rowheader"></div> <div class="table-section section-20" role="rowheader"></div>
</div> </div>
......
...@@ -43,6 +43,10 @@ export default { ...@@ -43,6 +43,10 @@ export default {
} }
return location && (location.image || location.file || location.path); return location && (location.image || location.file || location.path);
}, },
vulnerabilityScanner() {
const { scanner } = this.vulnerability;
return scanner?.name;
},
isDismissed() { isDismissed() {
return Boolean(this.vulnerability.dismissal_feedback); return Boolean(this.vulnerability.dismissal_feedback);
}, },
...@@ -135,6 +139,13 @@ export default { ...@@ -135,6 +139,13 @@ export default {
</div> </div>
</div> </div>
<div class="table-section section-15">
<div class="table-mobile-header" role="rowheader">{{ s__('Reports|Scanner') }}</div>
<div class="table-mobile-content">
{{ vulnerabilityScanner }}
</div>
</div>
<div class="table-section section-20"> <div class="table-section section-20">
<div class="table-mobile-header" role="rowheader">{{ s__('Reports|Actions') }}</div> <div class="table-mobile-header" role="rowheader">{{ s__('Reports|Actions') }}</div>
<div class="table-mobile-content action-buttons d-flex justify-content-end"> <div class="table-mobile-content action-buttons d-flex justify-content-end">
......
...@@ -27,7 +27,7 @@ export const initFirstClassVulnerabilityFilters = projects => { ...@@ -27,7 +27,7 @@ export const initFirstClassVulnerabilityFilters = projects => {
selection: new Set([ALL]), selection: new Set([ALL]),
}, },
{ {
name: s__('SecurityReports|Report type'), name: s__('Reports|Scanner'),
id: 'reportType', id: 'reportType',
options: [BASE_FILTERS.report_type, ...parseOptions(REPORT_TYPES)], options: [BASE_FILTERS.report_type, ...parseOptions(REPORT_TYPES)],
selection: new Set([ALL]), selection: new Set([ALL]),
......
...@@ -8,7 +8,7 @@ export const BASE_FILTERS = { ...@@ -8,7 +8,7 @@ export const BASE_FILTERS = {
id: ALL, id: ALL,
}, },
report_type: { report_type: {
name: s__('ciReport|All report types'), name: s__('ciReport|All scanner types'),
id: ALL, id: ALL,
}, },
project_id: { project_id: {
......
...@@ -14,7 +14,7 @@ export default () => ({ ...@@ -14,7 +14,7 @@ export default () => ({
selection: new Set([BASE_FILTERS.severity.id]), selection: new Set([BASE_FILTERS.severity.id]),
}, },
{ {
name: s__('SecurityReports|Report type'), name: s__('SecurityReports|Scanner type'),
id: 'report_type', id: 'report_type',
options: [BASE_FILTERS.report_type, ...optionsObjectToArray(REPORT_TYPES)], options: [BASE_FILTERS.report_type, ...optionsObjectToArray(REPORT_TYPES)],
hidden: false, hidden: false,
......
...@@ -93,6 +93,11 @@ export default { ...@@ -93,6 +93,11 @@ export default {
label: __('Description'), label: __('Description'),
thClass: commonThClass, thClass: commonThClass,
}, },
{
key: 'reportType',
label: s__('Reports|Scanner'),
thClass: `${commonThClass}`,
},
]; ];
}, },
}, },
...@@ -201,6 +206,10 @@ export default { ...@@ -201,6 +206,10 @@ export default {
<remediated-badge v-if="item.resolved_on_default_branch" class="ml-2" /> <remediated-badge v-if="item.resolved_on_default_branch" class="ml-2" />
</template> </template>
<template #cell(reportType)="{ item }">
<span class="text-capitalize js-reportType">{{ item.reportType }}</span>
</template>
<template #table-busy> <template #table-busy>
<gl-skeleton-loading <gl-skeleton-loading
v-for="n in $options.VULNERABILITIES_PER_PAGE" v-for="n in $options.VULNERABILITIES_PER_PAGE"
......
...@@ -4,6 +4,7 @@ fragment Vulnerability on Vulnerability { ...@@ -4,6 +4,7 @@ fragment Vulnerability on Vulnerability {
state state
severity severity
vulnerabilityPath vulnerabilityPath
reportType
location { location {
... on VulnerabilityLocationContainerScanning { ... on VulnerabilityLocationContainerScanning {
image image
......
---
title: Add scanner name to vulnerability row
merge_request: 31775
author:
type: changed
...@@ -77,6 +77,14 @@ describe('Security Dashboard Table Row', () => { ...@@ -77,6 +77,14 @@ describe('Security Dashboard Table Row', () => {
).toContain(wrapper.props().vulnerability.severity); ).toContain(wrapper.props().vulnerability.severity);
}); });
it('should render the scanner name', () => {
expect(
findContent(2)
.text()
.toLowerCase(),
).toContain(wrapper.props().vulnerability.scanner.name.toLowerCase());
});
describe('the project name', () => { describe('the project name', () => {
it('should render the name', () => { it('should render the name', () => {
expect(findContent(1).text()).toContain(wrapper.props().vulnerability.name); expect(findContent(1).text()).toContain(wrapper.props().vulnerability.name);
......
...@@ -4,6 +4,7 @@ export const generateVulnerabilities = () => [ ...@@ -4,6 +4,7 @@ export const generateVulnerabilities = () => [
title: 'Vulnerability 1', title: 'Vulnerability 1',
severity: 'critical', severity: 'critical',
state: 'dismissed', state: 'dismissed',
reportType: 'sast',
location: { location: {
image: image:
'registry.gitlab.com/groulot/container-scanning-test/master:5f21de6956aee99ddb68ae49498662d9872f50ff', 'registry.gitlab.com/groulot/container-scanning-test/master:5f21de6956aee99ddb68ae49498662d9872f50ff',
...@@ -17,6 +18,7 @@ export const generateVulnerabilities = () => [ ...@@ -17,6 +18,7 @@ export const generateVulnerabilities = () => [
title: 'Vulnerability 2', title: 'Vulnerability 2',
severity: 'high', severity: 'high',
state: 'opened', state: 'opened',
reportType: 'sast',
location: { location: {
file: 'src/main/java/com/gitlab/security_products/tests/App.java', file: 'src/main/java/com/gitlab/security_products/tests/App.java',
}, },
......
...@@ -63,6 +63,11 @@ describe('Vulnerability list component', () => { ...@@ -63,6 +63,11 @@ describe('Vulnerability list component', () => {
expect(cell.text().toLowerCase()).toBe(newVulnerabilities[0].severity); expect(cell.text().toLowerCase()).toBe(newVulnerabilities[0].severity);
}); });
it('should correctly render the scanner type', () => {
const cell = findCell('reportType');
expect(cell.text().toLowerCase()).toBe(newVulnerabilities[0].reportType);
});
it('should correctly render the description', () => { it('should correctly render the description', () => {
const cell = findCell('description'); const cell = findCell('description');
......
...@@ -18190,6 +18190,9 @@ msgstr "" ...@@ -18190,6 +18190,9 @@ msgstr ""
msgid "Reports|Metrics reports failed loading results" msgid "Reports|Metrics reports failed loading results"
msgstr "" msgstr ""
msgid "Reports|Scanner"
msgstr ""
msgid "Reports|Severity" msgid "Reports|Severity"
msgstr "" msgstr ""
...@@ -19140,10 +19143,10 @@ msgstr "" ...@@ -19140,10 +19143,10 @@ msgstr ""
msgid "SecurityReports|Remove project from dashboard" msgid "SecurityReports|Remove project from dashboard"
msgstr "" msgstr ""
msgid "SecurityReports|Report type" msgid "SecurityReports|Return to dashboard"
msgstr "" msgstr ""
msgid "SecurityReports|Return to dashboard" msgid "SecurityReports|Scanner type"
msgstr "" msgstr ""
msgid "SecurityReports|Security Dashboard" msgid "SecurityReports|Security Dashboard"
...@@ -25704,7 +25707,7 @@ msgstr "" ...@@ -25704,7 +25707,7 @@ msgstr ""
msgid "ciReport|All projects" msgid "ciReport|All projects"
msgstr "" msgstr ""
msgid "ciReport|All report types" msgid "ciReport|All scanner types"
msgstr "" msgstr ""
msgid "ciReport|All severities" msgid "ciReport|All severities"
......
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