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
bfb365f8
Commit
bfb365f8
authored
Oct 08, 2020
by
Savas Vedova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Prepare a pipeline status badge
- The badge will be used in a later iteration. - Write tests
parent
b6afb1c5
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
66 additions
and
0 deletions
+66
-0
ee/app/assets/javascripts/security_dashboard/components/pipeline_status_badge.vue
...s/security_dashboard/components/pipeline_status_badge.vue
+20
-0
ee/app/assets/javascripts/security_dashboard/first_class_init.js
...assets/javascripts/security_dashboard/first_class_init.js
+2
-0
ee/spec/frontend/security_dashboard/components/pipeline_status_badge_spec.js
...curity_dashboard/components/pipeline_status_badge_spec.js
+39
-0
locale/gitlab.pot
locale/gitlab.pot
+5
-0
No files found.
ee/app/assets/javascripts/security_dashboard/components/pipeline_status_badge.vue
0 → 100644
View file @
bfb365f8
<
script
>
import
{
GlBadge
,
GlIcon
}
from
'
@gitlab/ui
'
;
export
default
{
components
:
{
GlBadge
,
GlIcon
},
inject
:
{
pipelineSecurityBuildsFailedCount
:
{
type
:
Number
,
required
:
false
,
default
:
0
},
pipelineSecurityBuildsFailedPath
:
{
type
:
String
,
required
:
false
,
default
:
''
},
},
};
</
script
>
<
template
>
<gl-badge
variant=
"danger"
:href=
"pipelineSecurityBuildsFailedPath"
>
<gl-icon
name=
"status_failed"
class=
"gl-mr-2"
/>
{{
n__
(
'
%d failed security job
'
,
'
%d failed security jobs
'
,
pipelineSecurityBuildsFailedCount
)
}}
</gl-badge>
</
template
>
ee/app/assets/javascripts/security_dashboard/first_class_init.js
View file @
bfb365f8
...
@@ -43,6 +43,8 @@ export default (el, dashboardType) => {
...
@@ -43,6 +43,8 @@ export default (el, dashboardType) => {
component
=
FirstClassProjectSecurityDashboard
;
component
=
FirstClassProjectSecurityDashboard
;
props
.
projectFullPath
=
el
.
dataset
.
projectFullPath
;
props
.
projectFullPath
=
el
.
dataset
.
projectFullPath
;
provide
.
autoFixDocumentation
=
el
.
dataset
.
autoFixDocumentation
;
provide
.
autoFixDocumentation
=
el
.
dataset
.
autoFixDocumentation
;
provide
.
pipelineSecurityBuildsFailedCount
=
el
.
dataset
.
pipelineSecurityBuildsFailedCount
;
provide
.
pipelineSecurityBuildsFailedPath
=
el
.
dataset
.
pipelineSecurityBuildsFailedPath
;
}
else
if
(
dashboardType
===
DASHBOARD_TYPES
.
GROUP
)
{
}
else
if
(
dashboardType
===
DASHBOARD_TYPES
.
GROUP
)
{
component
=
FirstClassGroupSecurityDashboard
;
component
=
FirstClassGroupSecurityDashboard
;
props
.
groupFullPath
=
el
.
dataset
.
groupFullPath
;
props
.
groupFullPath
=
el
.
dataset
.
groupFullPath
;
...
...
ee/spec/frontend/security_dashboard/components/pipeline_status_badge_spec.js
0 → 100644
View file @
bfb365f8
import
{
GlBadge
}
from
'
@gitlab/ui
'
;
import
{
shallowMount
}
from
'
@vue/test-utils
'
;
import
PipelineStatusBadge
from
'
ee/security_dashboard/components/pipeline_status_badge.vue
'
;
describe
(
'
Pipeline status badge
'
,
()
=>
{
const
pipelineSecurityBuildsFailedPath
=
'
/some/path/to/failed/jobs
'
;
let
wrapper
;
const
createWrapper
=
({
pipelineSecurityBuildsFailedCount
})
=>
{
wrapper
=
shallowMount
(
PipelineStatusBadge
,
{
provide
:
{
pipelineSecurityBuildsFailedCount
,
pipelineSecurityBuildsFailedPath
,
},
stubs
:
{
GlBadge
},
});
};
afterEach
(()
=>
{
wrapper
.
destroy
();
wrapper
=
null
;
});
it
(
'
displays correct message for 5 failed jobs
'
,
()
=>
{
createWrapper
({
pipelineSecurityBuildsFailedCount
:
5
});
expect
(
wrapper
.
text
()).
toBe
(
'
5 failed security jobs
'
);
});
it
(
'
displays correct message for 1 failed job
'
,
()
=>
{
createWrapper
({
pipelineSecurityBuildsFailedCount
:
1
});
expect
(
wrapper
.
text
()).
toBe
(
'
1 failed security job
'
);
});
it
(
'
links to the correct path
'
,
()
=>
{
createWrapper
({
pipelineSecurityBuildsFailedCount
:
5
});
expect
(
wrapper
.
find
(
GlBadge
).
attributes
(
'
href
'
)).
toBe
(
pipelineSecurityBuildsFailedPath
);
});
});
locale/gitlab.pot
View file @
bfb365f8
...
@@ -185,6 +185,11 @@ msgid_plural "%d failed"
...
@@ -185,6 +185,11 @@ msgid_plural "%d failed"
msgstr[0] ""
msgstr[0] ""
msgstr[1] ""
msgstr[1] ""
msgid "%d failed security job"
msgid_plural "%d failed security jobs"
msgstr[0] ""
msgstr[1] ""
msgid "%d fixed test result"
msgid "%d fixed test result"
msgid_plural "%d fixed test results"
msgid_plural "%d fixed test results"
msgstr[0] ""
msgstr[0] ""
...
...
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