Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
76db91a6
Commit
76db91a6
authored
Jul 29, 2020
by
Dheeraj Joshi
Committed by
Kushal Pandya
Jul 29, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix number mismatch for DAST Urls
Use graphql endpoint to populate the count on the MR Widget's DAST section
parent
81fb0963
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
38 additions
and
28 deletions
+38
-28
ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue
..._shared/security_reports/grouped_security_reports_app.vue
+4
-5
ee/changelogs/unreleased/djadmin-dast-refactor.yml
ee/changelogs/unreleased/djadmin-dast-refactor.yml
+5
-0
ee/spec/frontend/vue_shared/security_reports/grouped_security_reports_app_spec.js
...red/security_reports/grouped_security_reports_app_spec.js
+29
-23
No files found.
ee/app/assets/javascripts/vue_shared/security_reports/grouped_security_reports_app.vue
View file @
76db91a6
...
...
@@ -237,8 +237,8 @@ export default {
isMRBranchOutdated
()
{
return
this
.
divergedCommitsCount
>
0
;
},
dastScan
s
()
{
return
this
.
dast
.
scans
.
filter
(
scan
=>
scan
.
scanned_resources_count
>
0
)
;
hasDastScannedResource
s
()
{
return
this
.
dast
Summary
?.
scannedResourcesCount
>
0
;
},
handleToggleEvent
()
{
return
once
(()
=>
{
...
...
@@ -491,15 +491,14 @@ export default {
<security-summary
:message=
"groupedDastText"
/>
</
template
>
<
template
v-if=
"
dastScans.length
"
>
<
template
v-if=
"
hasDastScannedResources
"
>
<div
class=
"text-nowrap"
>
{{
n__
(
'
%d URL scanned
'
,
'
%d URLs scanned
'
,
dastS
cans
[
0
].
scanned_resources_c
ount
)
}}
{{
n__
(
'
%d URL scanned
'
,
'
%d URLs scanned
'
,
dastS
ummary
.
scannedResourcesC
ount
)
}}
</div>
<gl-link
v-gl-modal
.
dastUrl
class=
"ml-2"
data-qa-selector=
"dast-ci-job-link"
>
{{
__
(
'
View details
'
)
}}
</gl-link>
<dast-modal
v-if=
"dastSummary"
:scanned-urls=
"dastSummary.scannedResources.nodes"
:scanned-resources-count=
"dastSummary.scannedResourcesCount"
:download-link=
"dastDownloadLink"
...
...
ee/changelogs/unreleased/djadmin-dast-refactor.yml
0 → 100644
View file @
76db91a6
---
title
:
Fix number mismatch issue for MR Widget
merge_request
:
38021
author
:
type
:
fixed
ee/spec/frontend/vue_shared/security_reports/grouped_security_reports_app_spec.js
View file @
76db91a6
...
...
@@ -11,7 +11,6 @@ import { waitForMutation } from 'helpers/vue_test_utils_helper';
import
{
trimText
}
from
'
helpers/text_helper
'
;
import
axios
from
'
~/lib/utils/axios_utils
'
;
import
{
mrStates
}
from
'
~/mr_popover/constants
'
;
import
{
TEST_HOST
}
from
'
helpers/test_constants
'
;
import
{
mockTracking
,
unmockTracking
}
from
'
helpers/tracking_helper
'
;
import
{
trackMrSecurityReportDetails
}
from
'
ee/vue_shared/security_reports/store/constants
'
;
import
ReportSection
from
'
~/reports/components/report_section.vue
'
;
...
...
@@ -55,17 +54,23 @@ describe('Grouped security reports app', () => {
projectFullPath
:
'
path
'
,
};
const
defaultDastSummary
=
{
scannedResourcesCount
:
211
,
scannedResources
:
{
nodes
:
[]
},
scannedResourcesCsvPath
:
''
,
};
const
glModalDirective
=
jest
.
fn
();
const
createWrapper
=
(
propsData
,
provide
=
{}
)
=>
{
const
createWrapper
=
(
propsData
,
options
)
=>
{
wrapper
=
mount
(
GroupedSecurityReportsApp
,
{
propsData
,
data
()
{
return
{
dastSummary
:
null
,
dastSummary
:
defaultDastSummary
,
...
options
?.
data
,
};
},
provide
,
directives
:
{
glModal
:
{
bind
(
el
,
{
value
})
{
...
...
@@ -427,8 +432,6 @@ describe('Grouped security reports app', () => {
});
describe
(
'
dast reports
'
,
()
=>
{
const
scanUrl
=
`
${
TEST_HOST
}
/group/project/-/jobs/123546789`
;
beforeEach
(()
=>
{
gl
.
mrWidgetData
=
gl
.
mrWidgetData
||
{};
gl
.
mrWidgetData
.
dast_comparison_path
=
DAST_DIFF_ENDPOINT
;
...
...
@@ -436,12 +439,6 @@ describe('Grouped security reports app', () => {
mock
.
onGet
(
DAST_DIFF_ENDPOINT
).
reply
(
200
,
{
...
dastDiffSuccessMock
,
base_report_out_of_date
:
true
,
scans
:
[
{
scanned_resources_count
:
211
,
job_path
:
scanUrl
,
},
],
});
createWrapper
({
...
...
@@ -481,19 +478,28 @@ describe('Grouped security reports app', () => {
mock
.
onGet
(
DAST_DIFF_ENDPOINT
).
reply
(
200
,
{
...
dastDiffSuccessMock
,
base_report_out_of_date
:
true
,
scans
:
[
{
scanned_resources_count
:
0
,
job_path
:
scanUrl
,
},
],
});
createWrapper
({
...
props
,
enabledReports
:
{
dast
:
true
,
// set scanned urls count to 0
const
summaryWithoutUrls
=
{
...
defaultDastSummary
,
scannedResourcesCount
:
0
,
};
createWrapper
(
{
...
props
,
enabledReports
:
{
dast
:
true
,
},
},
});
{
data
:
{
dastSummary
:
summaryWithoutUrls
,
},
},
);
return
waitForMutation
(
wrapper
.
vm
.
$store
,
types
.
RECEIVE_DAST_DIFF_SUCCESS
).
then
(()
=>
{
expect
(
wrapper
.
text
()).
not
.
toContain
(
'
0 URLs scanned
'
);
expect
(
wrapper
.
contains
(
'
[data-qa-selector="dast-ci-job-link"]
'
)).
toBe
(
false
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment