Commit b4ea7144 authored by Filipa Lacerda's avatar Filipa Lacerda

Changes after review

parent 468a2ed6
<script> <script>
import { sprintf, n__, __ } from '~/locale'; import { sprintf, s__ } from '~/locale';
import ciIcon from '~/vue_shared/components/ci_icon.vue'; import ciIcon from '~/vue_shared/components/ci_icon.vue';
export default { export default {
...@@ -20,21 +20,22 @@ ...@@ -20,21 +20,22 @@
}, },
computed: { computed: {
summarySastText() { summarySastText() {
const text = s__('ciReport|SAST detected %{link}');
let link;
if (this.unresolvedIssues.length) { if (this.unresolvedIssues.length) {
return n__( link = this.unresolvedIssues.length > 1 ?
sprintf('SAST detected %{link}', { this.getLink(sprintf(
link: `<a href=${this.link} class="prepend-left-5">%d security vulnerability</a>`, s__('ciReport|%{d} security vulnerabilities'),
}, false), { d: this.unresolvedIssues.length },
sprintf('SAST detected %{link}', { true,
link: `<a href=${this.link} class="prepend-left-5">%d security vulnerabilities</a>`, )) :
}, false), this.getLink(s__('ciReport|1 security vulnerability'));
this.unresolvedIssues.length, } else {
); link = this.getLink(s__('ciReport|no security vulnerabilities'));
} }
return sprintf(__('SAST detected %{link} '), { return sprintf(text, { link }, false);
link: `<a href=${this.link} class="prepend-left-5">no security vulnerabilities</a>`,
}, false);
}, },
statusIcon() { statusIcon() {
if (this.unresolvedIssues) { if (this.unresolvedIssues) {
...@@ -49,6 +50,11 @@ ...@@ -49,6 +50,11 @@
}; };
}, },
}, },
methods: {
getLink(text) {
return `<a href="${this.link}" class="prepend-left-5">${text}</a>`;
},
},
}; };
</script> </script>
<template> <template>
......
...@@ -60,7 +60,7 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -60,7 +60,7 @@ document.addEventListener('DOMContentLoaded', () => {
postAction(action) { postAction(action) {
this.mediator.service.postAction(action.path) this.mediator.service.postAction(action.path)
.then(() => this.mediator.refreshPipeline()) .then(() => this.mediator.refreshPipeline())
.catch(() => Flash('An error occurred while making the request.')); .catch(() => Flash(__('An error occurred while making the request.')));
}, },
}, },
render(createElement) { render(createElement) {
...@@ -89,7 +89,9 @@ document.addEventListener('DOMContentLoaded', () => { ...@@ -89,7 +89,9 @@ document.addEventListener('DOMContentLoaded', () => {
mediator.fetchSastReport(endpoint, blobPath) mediator.fetchSastReport(endpoint, blobPath)
.then(() => { .then(() => {
// update the badge // update the badge
document.querySelector('.js-sast-counter').textContent = mediator.store.state.sast.securityReports.newIssues.length; const badge = document.querySelector('.js-sast-counter');
badge.textContent = mediator.store.state.sast.securityReports.newIssues.length;
badge.classList.remove('hidden');
}) })
.catch(() => { .catch(() => {
Flash(__('Something when wrong while fetching SAST.')); Flash(__('Something when wrong while fetching SAST.'));
......
...@@ -37,5 +37,4 @@ ...@@ -37,5 +37,4 @@
= clipboard_button(text: @pipeline.sha, title: "Copy commit SHA to clipboard") = clipboard_button(text: @pipeline.sha, title: "Copy commit SHA to clipboard")
- if sast_artifact - if sast_artifact
.js-sast-summary{ data: { tab_path: sast_tab_path }} .js-sast-summary{ data: { tab_path: sast_tab_path } }
\ No newline at end of file
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
%li.js-security-tab-link %li.js-security-tab-link
= link_to security_project_pipeline_path(@project, @pipeline), data: { target: '#js-tab-security', action: 'security', toggle: 'tab' }, class: 'security-tab' do = link_to security_project_pipeline_path(@project, @pipeline), data: { target: '#js-tab-security', action: 'security', toggle: 'tab' }, class: 'security-tab' do
= _("Security report") = _("Security report")
%span.badge.js-sast-counter %span.badge.js-sast-counter.hidden
.tab-content .tab-content
#js-tab-pipeline.tab-pane #js-tab-pipeline.tab-pane
......
.report-block { .report-block-container {
.report-block-container {
border-top: 1px solid $gray-darker; border-top: 1px solid $gray-darker;
padding: $gl-padding-top; padding: $gl-padding-top;
background-color: $gray-light; background-color: $gray-light;
margin: $gl-padding #{-$gl-padding} #{-$gl-padding}; margin: $gl-padding #{-$gl-padding} #{-$gl-padding};
} }
.report-block-dast-code { .report-block-dast-code {
margin-left: 26px; margin-left: 26px;
} }
.report-block-list { .report-block-list {
list-style: none; list-style: none;
padding: 0 1px; padding: 0 1px;
margin: 0; margin: 0;
...@@ -45,7 +44,6 @@ ...@@ -45,7 +44,6 @@
margin: -5px 4px 0 0; margin: -5px 4px 0 0;
fill: currentColor; fill: currentColor;
} }
}
} }
.pipeline-tab-content { .pipeline-tab-content {
......
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