Commit 78341adb authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'djadmin-refix-pipeline-summary' into 'master'

Pipeline Security Summary - Add option to download scanned resources

See merge request gitlab-org/gitlab!54255
parents ed8b8224 47c5d9cc
......@@ -6,6 +6,7 @@ import {
GlCollapseToggleDirective,
GlSprintf,
GlModalDirective,
GlLink,
} from '@gitlab/ui';
import Modal from 'ee/vue_shared/security_reports/components/dast_modal.vue';
import AccessorUtilities from '~/lib/utils/accessor';
......@@ -21,6 +22,7 @@ export default {
GlCollapse,
GlSprintf,
Modal,
GlLink,
},
directives: {
collapseToggle: GlCollapseToggleDirective,
......@@ -132,6 +134,16 @@ export default {
:download-link="downloadLink(scanSummary)"
/>
</template>
<template v-else-if="scanSummary.scannedResourcesCsvPath">
<gl-link
download
:href="downloadLink(scanSummary)"
class="gl-ml-1"
data-testid="download-link"
>
({{ s__('SecurityReports|Download scanned resources') }})
</gl-link>
</template>
</div>
</div>
</gl-collapse>
......
......@@ -4,14 +4,16 @@ query($fullPath: ID!, $pipelineIid: ID!) {
securityReportSummary {
dast {
vulnerabilitiesCount
scannedResourcesCount
scannedResourcesCsvPath
scannedResources {
nodes {
requestMethod
url
}
}
# The following fields will be added in
# https://gitlab.com/gitlab-org/gitlab/-/issues/321586
# scannedResourcesCount
# scannedResources {
# nodes {
# requestMethod
# url
# }
# }
}
sast {
vulnerabilitiesCount
......
......@@ -28,6 +28,7 @@ describe('Security reports summary component', () => {
const findToggleButton = () => wrapper.find('[data-testid="collapse-button"]');
const findModalButton = () => wrapper.find('[data-testid="modal-button"]');
const findDownloadLink = () => wrapper.find('[data-testid="download-link"]');
beforeEach(() => {
jest.spyOn(AccessorUtilities, 'isLocalStorageAccessSafe').mockReturnValue(true);
......@@ -208,4 +209,23 @@ describe('Security reports summary component', () => {
expect(glModalDirective).toHaveBeenCalledWith({ dastUrl: true });
});
});
describe('with scanned resources download path', () => {
const dastProps = {
vulnerabilitiesCount: 10,
scannedResourcesCsvPath: '/download/path',
};
beforeEach(() => {
createWrapper({
propsData: {
summary: { dast: dastProps },
},
});
});
it('should contain a download link', () => {
expect(findDownloadLink().attributes('href')).toBe('/download/path');
});
});
});
......@@ -26207,6 +26207,9 @@ msgstr ""
msgid "SecurityReports|Download results"
msgstr ""
msgid "SecurityReports|Download scanned resources"
msgstr ""
msgid "SecurityReports|Either you don't have permission to view this dashboard or the dashboard has not been setup. Please check your permission settings with your administrator or check your dashboard configurations to proceed."
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