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
56a5a6d1
Commit
56a5a6d1
authored
Feb 09, 2021
by
Daniel Tian
Committed by
Scott Hampton
Feb 09, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use v-if instead of passing empty string for severity
parent
6ecd1edc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
20 additions
and
13 deletions
+20
-13
ee/app/assets/javascripts/environments/components/environment_alert.vue
...javascripts/environments/components/environment_alert.vue
+2
-2
ee/app/assets/javascripts/security_dashboard/components/security_dashboard_table_row.vue
...ity_dashboard/components/security_dashboard_table_row.vue
+5
-4
ee/app/assets/javascripts/vue_shared/security_reports/components/severity_badge.vue
...vue_shared/security_reports/components/severity_badge.vue
+1
-1
ee/spec/frontend/environments/environment_alert_spec.js
ee/spec/frontend/environments/environment_alert_spec.js
+7
-2
ee/spec/frontend/security_dashboard/components/security_dashboard_table_row_spec.js
...dashboard/components/security_dashboard_table_row_spec.js
+5
-4
No files found.
ee/app/assets/javascripts/environments/components/environment_alert.vue
View file @
56a5a6d1
...
...
@@ -53,7 +53,7 @@ export default {
return
this
.
alert
?.
prometheusAlert
?.
humanizedText
;
},
severity
()
{
return
this
.
alert
?.
severity
||
''
;
return
this
.
alert
?.
severity
;
},
},
classes
:
[
...
...
@@ -71,7 +71,7 @@ export default {
<div
v-if=
"alert"
:class=
"$options.classes"
data-testid=
"alert"
>
<gl-sprintf
:message=
"$options.translations.alertText"
>
<template
#severity
>
<severity-badge
:severity=
"severity"
class=
"gl-display-inline"
/>
<severity-badge
v-if=
"severity"
:severity=
"severity"
class=
"gl-display-inline"
/>
</
template
>
<
template
#startedAt
>
<span
v-gl-tooltip
:title=
"tooltipTitle(alert.startedAt)"
>
...
...
ee/app/assets/javascripts/security_dashboard/components/security_dashboard_table_row.vue
View file @
56a5a6d1
...
...
@@ -43,9 +43,6 @@ export default {
computed
:
{
...
mapState
([
'
dashboardType
'
]),
...
mapState
(
'
vulnerabilities
'
,
[
'
selectedVulnerabilities
'
]),
severity
()
{
return
this
.
vulnerability
.
severity
||
'
'
;
},
vulnerabilityIdentifier
()
{
return
getPrimaryIdentifier
(
this
.
vulnerability
.
identifiers
,
'
external_type
'
);
},
...
...
@@ -126,7 +123,11 @@ export default {
<div
class=
"table-section section-15"
>
<div
class=
"table-mobile-header"
role=
"rowheader"
>
{{
s__
(
'
Reports|Severity
'
)
}}
</div>
<div
class=
"table-mobile-content"
>
<severity-badge
:severity=
"severity"
class=
"text-right text-md-left"
/>
<severity-badge
v-if=
"vulnerability.severity"
:severity=
"vulnerability.severity"
class=
"text-right text-md-left"
/>
</div>
</div>
...
...
ee/app/assets/javascripts/vue_shared/security_reports/components/severity_badge.vue
View file @
56a5a6d1
...
...
@@ -22,7 +22,7 @@ export default {
return
Object
.
keys
(
SEVERITY_CLASS_NAME_MAP
).
includes
(
this
.
severityKey
);
},
severityKey
()
{
return
this
.
severity
.
toLowerCase
();
return
this
.
severity
?
.
toLowerCase
();
},
className
()
{
return
SEVERITY_CLASS_NAME_MAP
[
this
.
severityKey
];
...
...
ee/spec/frontend/environments/environment_alert_spec.js
View file @
56a5a6d1
...
...
@@ -23,6 +23,8 @@ describe('Environment Alert', () => {
});
};
const
findSeverityBadge
=
()
=>
wrapper
.
find
(
SeverityBadge
);
beforeEach
(()
=>
{
factory
();
});
...
...
@@ -59,14 +61,17 @@ describe('Environment Alert', () => {
expect
(
link
.
attributes
(
'
href
'
)).
toBe
(
'
/alert/details
'
);
});
it
(
'
should show a severity badge
'
,
()
=>
{
expect
(
wrapper
.
find
(
SeverityBadge
).
props
(
'
severity
'
)).
toBe
(
'
CRITICAL
'
);
it
(
'
should show a severity badge with the correct severity
'
,
()
=>
{
const
badge
=
findSeverityBadge
();
expect
(
badge
.
exists
()).
toBe
(
true
);
expect
(
badge
.
props
(
'
severity
'
)).
toBe
(
'
CRITICAL
'
);
});
});
describe
(
'
has no alert
'
,
()
=>
{
it
(
'
should display nothing
'
,
()
=>
{
expect
(
wrapper
.
find
(
'
[data-testid="alert"]
'
).
exists
()).
toBe
(
false
);
expect
(
findSeverityBadge
().
exists
()).
toBe
(
false
);
});
});
});
ee/spec/frontend/security_dashboard/components/security_dashboard_table_row_spec.js
View file @
56a5a6d1
...
...
@@ -6,6 +6,7 @@ import { VULNERABILITY_MODAL_ID } from 'ee/vue_shared/security_reports/component
import
createStore
from
'
ee/security_dashboard/store
'
;
import
{
DASHBOARD_TYPES
}
from
'
ee/security_dashboard/store/constants
'
;
import
{
trimText
}
from
'
helpers/text_helper
'
;
import
SeverityBadge
from
'
ee/vue_shared/security_reports/components/severity_badge.vue
'
;
import
{
BV_SHOW_MODAL
}
from
'
~/lib/utils/constants
'
;
import
mockDataVulnerabilities
from
'
../store/modules/vulnerabilities/data/mock_data_vulnerabilities
'
;
...
...
@@ -41,6 +42,7 @@ describe('Security Dashboard Table Row', () => {
const
findAllIssueCreated
=
()
=>
wrapper
.
findAll
(
'
[data-testid="issues-icon"]
'
);
const
hasSelectedClass
=
()
=>
wrapper
.
classes
(
'
gl-bg-blue-50
'
);
const
findCheckbox
=
()
=>
wrapper
.
find
(
GlFormCheckbox
);
const
findSeverityBadge
=
()
=>
wrapper
.
find
(
SeverityBadge
);
describe
(
'
when loading
'
,
()
=>
{
beforeEach
(()
=>
{
...
...
@@ -51,9 +53,8 @@ describe('Security Dashboard Table Row', () => {
expect
(
findLoader
().
exists
()).
toBeTruthy
();
});
it
(
'
should render a ` ` for severity
'
,
()
=>
{
expect
(
wrapper
.
vm
.
severity
).
toEqual
(
'
'
);
expect
(
findContent
(
0
).
text
()).
toEqual
(
''
);
it
(
'
should not render the severity
'
,
()
=>
{
expect
(
findSeverityBadge
().
exists
()).
toBe
(
false
);
});
it
(
'
should render a `` for the report type and scanner
'
,
()
=>
{
...
...
@@ -78,7 +79,7 @@ describe('Security Dashboard Table Row', () => {
});
it
(
'
should render the severity
'
,
()
=>
{
expect
(
find
Content
(
0
).
text
().
toLowerCase
()).
toContain
(
vulnerability
.
severity
);
expect
(
find
SeverityBadge
().
text
().
toLowerCase
()).
toBe
(
vulnerability
.
severity
);
});
it
(
'
should render the identifier cell
'
,
()
=>
{
...
...
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