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
dfa76037
Commit
dfa76037
authored
Feb 21, 2018
by
Filipa Lacerda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix broken icon + prevent page reload
parent
7038b4d6
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
19 deletions
+14
-19
app/assets/javascripts/pipelines/components/security_reports/sast_report_summary_widget.vue
...omponents/security_reports/sast_report_summary_widget.vue
+5
-9
app/assets/javascripts/pipelines/pipeline_details_bundle.js
app/assets/javascripts/pipelines/pipeline_details_bundle.js
+5
-4
spec/javascripts/pipelines/security_reports/sast_report_summary_widget_spec.js
...lines/security_reports/sast_report_summary_widget_spec.js
+4
-6
No files found.
app/assets/javascripts/pipelines/components/security_reports/sast_report_summary_widget.vue
View file @
dfa76037
...
...
@@ -13,10 +13,6 @@
required
:
false
,
default
:
()
=>
([]),
},
link
:
{
type
:
String
,
required
:
true
,
},
},
computed
:
{
sastText
()
{
...
...
@@ -36,7 +32,7 @@
return
s__
(
'
ciReport|no security vulnerabilities
'
);
},
statusIcon
()
{
if
(
this
.
unresolvedIssues
)
{
if
(
this
.
unresolvedIssues
.
length
)
{
return
{
group
:
'
warning
'
,
icon
:
'
status_warning
'
,
...
...
@@ -69,13 +65,13 @@
class=
"prepend-left-10 flex flex-align-self-center"
>
{{
sastText
}}
<
a
:href=
"link
"
class=
"prepend-left-5"
<
button
type=
"button
"
class=
"
btn-link btn-blank
prepend-left-5"
@
click=
"openTab"
>
{{
sastLink
}}
</
a
>
</
button
>
</span>
</div>
</
template
>
app/assets/javascripts/pipelines/pipeline_details_bundle.js
View file @
dfa76037
...
...
@@ -89,9 +89,11 @@ document.addEventListener('DOMContentLoaded', () => {
mediator
.
fetchSastReport
(
endpoint
,
blobPath
)
.
then
(()
=>
{
// update the badge
const
badge
=
document
.
querySelector
(
'
.js-sast-counter
'
);
badge
.
textContent
=
mediator
.
store
.
state
.
securityReports
.
sast
.
newIssues
.
length
;
badge
.
classList
.
remove
(
'
hidden
'
);
if
(
mediator
.
store
.
state
.
securityReports
.
sast
.
newIssues
.
length
)
{
const
badge
=
document
.
querySelector
(
'
.js-sast-counter
'
);
badge
.
textContent
=
mediator
.
store
.
state
.
securityReports
.
sast
.
newIssues
.
length
;
badge
.
classList
.
remove
(
'
hidden
'
);
}
})
.
catch
(()
=>
{
Flash
(
__
(
'
Something went wrong while fetching SAST.
'
));
...
...
@@ -113,7 +115,6 @@ document.addEventListener('DOMContentLoaded', () => {
return
createElement
(
'
sast-summary-widget
'
,
{
props
:
{
unresolvedIssues
:
this
.
mediator
.
store
.
state
.
securityReports
.
sast
.
newIssues
,
link
:
sastSummary
.
dataset
.
tabPath
,
},
});
},
...
...
spec/javascripts/pipelines/security_reports/sast_report_summary_widget_spec.js
View file @
dfa76037
...
...
@@ -19,26 +19,24 @@ describe('SAST report summary widget', () => {
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
{
unresolvedIssues
:
parsedSastIssuesHead
,
link
:
'
group/project/pipelines/2/security
'
,
});
});
it
(
'
renders summary text with
link for the security tab
'
,
()
=>
{
it
(
'
renders summary text with
warning icon
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
.
trim
().
replace
(
/
\s\s
+/g
,
'
'
)).
toEqual
(
'
SAST degraded on 2 security vulnerabilities
'
);
expect
(
vm
.
$el
.
querySelector
(
'
a
'
).
getAttribute
(
'
href
'
)).
toEqual
(
'
group/project/pipelines/2/security
'
);
expect
(
vm
.
$el
.
querySelector
(
'
span
'
).
classList
).
toContain
(
'
ci-status-icon-warning
'
);
});
});
describe
(
'
without vulnerabilities
'
,
()
=>
{
beforeEach
(()
=>
{
vm
=
mountComponent
(
Component
,
{
link
:
'
group/project/pipelines/2/security
'
,
});
});
it
(
'
render summary text with
link for the security tab
'
,
()
=>
{
it
(
'
render summary text with
success icon
'
,
()
=>
{
expect
(
vm
.
$el
.
textContent
.
trim
().
replace
(
/
\s\s
+/g
,
'
'
)).
toEqual
(
'
SAST detected no security vulnerabilities
'
);
expect
(
vm
.
$el
.
querySelector
(
'
a
'
).
getAttribute
(
'
href
'
)).
toEqual
(
'
group/project/pipelines/2/security
'
);
expect
(
vm
.
$el
.
querySelector
(
'
span
'
).
classList
).
toContain
(
'
ci-status-icon-success
'
);
});
});
});
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