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
2a8609ea
Commit
2a8609ea
authored
Oct 15, 2020
by
Savas Vedova
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Truncate long file paths
parent
9138d41b
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
56 additions
and
29 deletions
+56
-29
app/assets/stylesheets/framework/tables.scss
app/assets/stylesheets/framework/tables.scss
+10
-1
ee/app/assets/javascripts/security_dashboard/components/vulnerability_list.vue
...ipts/security_dashboard/components/vulnerability_list.vue
+7
-4
ee/spec/frontend/security_dashboard/components/vulnerability_list_spec.js
.../security_dashboard/components/vulnerability_list_spec.js
+39
-24
No files found.
app/assets/stylesheets/framework/tables.scss
View file @
2a8609ea
...
@@ -186,6 +186,7 @@ table {
...
@@ -186,6 +186,7 @@ table {
.checkbox
{
.checkbox
{
padding-left
:
$gl-spacing-scale-4
;
padding-left
:
$gl-spacing-scale-4
;
padding-right
:
0
;
padding-right
:
0
;
width
:
1px
;
+
td
,
+
td
,
+
th
{
+
th
{
...
@@ -205,12 +206,20 @@ table {
...
@@ -205,12 +206,20 @@ table {
width
:
10%
;
width
:
10%
;
}
}
.description
{
max-width
:
0
;
}
.identifier
{
.identifier
{
width
:
16%
;
width
:
16%
;
}
}
.scanner
{
.scanner
{
width
:
15%
;
width
:
10%
;
}
.activity
{
width
:
5%
;
}
}
}
}
}
}
ee/app/assets/javascripts/security_dashboard/components/vulnerability_list.vue
View file @
2a8609ea
...
@@ -4,9 +4,10 @@ import {
...
@@ -4,9 +4,10 @@ import {
GlFormCheckbox
,
GlFormCheckbox
,
GlLink
,
GlLink
,
GlSprintf
,
GlSprintf
,
GlT
abl
e
,
GlT
runcat
e
,
GlSkeletonLoading
,
GlSkeletonLoading
,
GlTooltipDirective
,
GlTooltipDirective
,
GlTable
,
}
from
'
@gitlab/ui
'
;
}
from
'
@gitlab/ui
'
;
import
RemediatedBadge
from
'
ee/vulnerabilities/components/remediated_badge.vue
'
;
import
RemediatedBadge
from
'
ee/vulnerabilities/components/remediated_badge.vue
'
;
import
FiltersProducedNoResults
from
'
ee/security_dashboard/components/empty_states/filters_produced_no_results.vue
'
;
import
FiltersProducedNoResults
from
'
ee/security_dashboard/components/empty_states/filters_produced_no_results.vue
'
;
...
@@ -35,6 +36,7 @@ export default {
...
@@ -35,6 +36,7 @@ export default {
GlSkeletonLoading
,
GlSkeletonLoading
,
GlSprintf
,
GlSprintf
,
GlTable
,
GlTable
,
GlTruncate
,
IssuesBadge
,
IssuesBadge
,
LocalStorageSync
,
LocalStorageSync
,
RemediatedBadge
,
RemediatedBadge
,
...
@@ -181,7 +183,8 @@ export default {
...
@@ -181,7 +183,8 @@ export default {
{
{
key
:
'
activity
'
,
key
:
'
activity
'
,
label
:
s__
(
'
Vulnerability|Activity
'
),
label
:
s__
(
'
Vulnerability|Activity
'
),
thClass
:
'
gl-text-right
'
,
thClass
:
'
gl-text-right activity
'
,
tdClass
:
'
activity
'
,
},
},
];
];
...
@@ -373,7 +376,7 @@ export default {
...
@@ -373,7 +376,7 @@ export default {
</
template
>
</
template
>
<
template
#cell(severity)=
"{ item }"
>
<
template
#cell(severity)=
"{ item }"
>
<severity-badge
class=
"js-severity
gl-white-space-normal!
"
:severity=
"item.severity"
/>
<severity-badge
class=
"js-severity"
:severity=
"item.severity"
/>
</
template
>
</
template
>
<
template
#cell(title)=
"{ item }"
>
<
template
#cell(title)=
"{ item }"
>
...
@@ -399,7 +402,7 @@ export default {
...
@@ -399,7 +402,7 @@ export default {
{{
item
.
project
.
nameWithNamespace
}}
{{
item
.
project
.
nameWithNamespace
}}
</div>
</div>
<div
v-if=
"shouldShowVulnerabilityPath(item)"
class=
"monospace"
>
<div
v-if=
"shouldShowVulnerabilityPath(item)"
class=
"monospace"
>
{{
createLocationString
(
item
.
location
)
}}
<gl-truncate
:text=
"createLocationString(item.location)"
position=
"middle"
/>
</div>
</div>
</div>
</div>
</
template
>
</
template
>
...
...
ee/spec/frontend/security_dashboard/components/vulnerability_list_spec.js
View file @
2a8609ea
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
mount
}
from
'
@vue/test-utils
'
;
import
{
GlDeprecatedSkeletonLoading
as
GlSkeletonLoading
,
GlTable
}
from
'
@gitlab/ui
'
;
import
{
GlDeprecatedSkeletonLoading
as
GlSkeletonLoading
,
GlTable
,
GlTruncate
}
from
'
@gitlab/ui
'
;
import
{
useLocalStorageSpy
}
from
'
helpers/local_storage_helper
'
;
import
{
useLocalStorageSpy
}
from
'
helpers/local_storage_helper
'
;
import
RemediatedBadge
from
'
ee/vulnerabilities/components/remediated_badge.vue
'
;
import
RemediatedBadge
from
'
ee/vulnerabilities/components/remediated_badge.vue
'
;
import
IssuesBadge
from
'
ee/security_dashboard/components/issues_badge.vue
'
;
import
IssuesBadge
from
'
ee/security_dashboard/components/issues_badge.vue
'
;
...
@@ -54,7 +54,7 @@ describe('Vulnerability list component', () => {
...
@@ -54,7 +54,7 @@ describe('Vulnerability list component', () => {
const
findRowVulnerabilityCommentIcon
=
row
=>
findRow
(
row
).
find
(
VulnerabilityCommentIcon
);
const
findRowVulnerabilityCommentIcon
=
row
=>
findRow
(
row
).
find
(
VulnerabilityCommentIcon
);
const
findDataCell
=
label
=>
wrapper
.
find
(
`[data-testid="
${
label
}
"]`
);
const
findDataCell
=
label
=>
wrapper
.
find
(
`[data-testid="
${
label
}
"]`
);
const
findDataCells
=
label
=>
wrapper
.
findAll
(
`[data-testid="
${
label
}
"]`
);
const
findDataCells
=
label
=>
wrapper
.
findAll
(
`[data-testid="
${
label
}
"]`
);
const
find
CellText
=
label
=>
findDataCell
(
label
).
text
(
);
const
find
LocationTextWrapper
=
cell
=>
cell
.
find
(
GlTruncate
);
const
findFiltersProducedNoResults
=
()
=>
wrapper
.
find
(
FiltersProducedNoResults
);
const
findFiltersProducedNoResults
=
()
=>
wrapper
.
find
(
FiltersProducedNoResults
);
const
findDashboardHasNoVulnerabilities
=
()
=>
wrapper
.
find
(
DashboardHasNoVulnerabilities
);
const
findDashboardHasNoVulnerabilities
=
()
=>
wrapper
.
find
(
DashboardHasNoVulnerabilities
);
const
findVendorNames
=
()
=>
wrapper
.
find
(
`[data-testid="vulnerability-vendor"]`
);
const
findVendorNames
=
()
=>
wrapper
.
find
(
`[data-testid="vulnerability-vendor"]`
);
...
@@ -199,31 +199,37 @@ describe('Vulnerability list component', () => {
...
@@ -199,31 +199,37 @@ describe('Vulnerability list component', () => {
it
(
'
should display the vulnerability locations for images
'
,
()
=>
{
it
(
'
should display the vulnerability locations for images
'
,
()
=>
{
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
0
];
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
0
];
const
cellText
=
findCellText
(
`location-
${
id
}
`
);
const
cell
=
findDataCell
(
`location-
${
id
}
`
);
expect
(
cellText
).
toContain
(
project
.
nameWithNamespace
);
expect
(
cell
.
text
()).
toContain
(
project
.
nameWithNamespace
);
expect
(
cellText
).
toContain
(
location
.
image
);
expect
(
findLocationTextWrapper
(
cell
).
props
()).
toEqual
({
expect
(
cellText
).
not
.
toContain
(
'
(line:
'
);
text
:
location
.
image
,
position
:
'
middle
'
,
});
});
});
it
(
'
should display the vulnerability locations for code
'
,
()
=>
{
it
(
'
should display the vulnerability locations for code
'
,
()
=>
{
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
1
];
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
1
];
const
cellText
=
findCellText
(
`location-
${
id
}
`
);
const
cell
=
findDataCell
(
`location-
${
id
}
`
);
expect
(
cellText
).
toContain
(
project
.
nameWithNamespace
);
expect
(
cell
.
text
()).
toContain
(
project
.
nameWithNamespace
);
expect
(
cellText
).
toContain
(
location
.
file
);
expect
(
findLocationTextWrapper
(
cell
).
props
()).
toEqual
({
expect
(
cellText
).
toContain
(
`(line:
${
location
.
startLine
}
)`
);
text
:
`
${
location
.
file
}
(line:
${
location
.
startLine
}
)`
,
position
:
'
middle
'
,
});
});
});
it
(
'
should display the vulnerability locations for code with no line data
'
,
()
=>
{
it
(
'
should display the vulnerability locations for code with no line data
'
,
()
=>
{
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
2
];
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
2
];
const
cellText
=
findCellText
(
`location-
${
id
}
`
);
const
cell
=
findDataCell
(
`location-
${
id
}
`
);
expect
(
cellText
).
toContain
(
project
.
nameWithNamespace
);
expect
(
cell
.
text
()).
toContain
(
project
.
nameWithNamespace
);
expect
(
cellText
).
toContain
(
location
.
file
);
expect
(
findLocationTextWrapper
(
cell
).
props
()).
toEqual
({
expect
(
cellText
).
not
.
toContain
(
'
(line:
'
);
text
:
location
.
file
,
position
:
'
middle
'
,
});
});
});
it
(
'
should not display the vulnerability locations for vulnerabilities without a location
'
,
()
=>
{
it
(
'
should not display the vulnerability locations for vulnerabilities without a location
'
,
()
=>
{
const
{
id
,
project
}
=
newVulnerabilities
[
4
];
const
{
id
,
project
}
=
newVulnerabilities
[
4
];
const
cellText
=
find
CellText
(
`location-
${
id
}
`
);
const
cellText
=
find
DataCell
(
`location-
${
id
}
`
).
text
(
);
expect
(
cellText
).
toEqual
(
project
.
nameWithNamespace
);
expect
(
cellText
).
toEqual
(
project
.
nameWithNamespace
);
expect
(
cellText
).
not
.
toContain
(
'
(line:
'
);
expect
(
cellText
).
not
.
toContain
(
'
(line:
'
);
});
});
...
@@ -244,9 +250,12 @@ describe('Vulnerability list component', () => {
...
@@ -244,9 +250,12 @@ describe('Vulnerability list component', () => {
it
(
'
should not display the vulnerability group/project locations for images
'
,
()
=>
{
it
(
'
should not display the vulnerability group/project locations for images
'
,
()
=>
{
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
0
];
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
0
];
const
cellText
=
findCellText
(
`location-
${
id
}
`
);
const
cell
=
findDataCell
(
`location-
${
id
}
`
);
expect
(
cellText
).
not
.
toContain
(
project
.
nameWithNamespace
);
expect
(
cell
.
text
()).
not
.
toContain
(
project
.
nameWithNamespace
);
expect
(
cellText
).
toEqual
(
location
.
image
);
expect
(
findLocationTextWrapper
(
cell
).
props
()).
toEqual
({
text
:
location
.
image
,
position
:
'
middle
'
,
});
});
});
it
(
'
should display the detected time
'
,
()
=>
{
it
(
'
should display the detected time
'
,
()
=>
{
...
@@ -258,16 +267,22 @@ describe('Vulnerability list component', () => {
...
@@ -258,16 +267,22 @@ describe('Vulnerability list component', () => {
it
(
'
should display the vulnerability locations for code
'
,
()
=>
{
it
(
'
should display the vulnerability locations for code
'
,
()
=>
{
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
1
];
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
1
];
const
cellText
=
findCellText
(
`location-
${
id
}
`
);
const
cell
=
findDataCell
(
`location-
${
id
}
`
);
expect
(
cellText
).
not
.
toContain
(
project
.
nameWithNamespace
);
expect
(
cell
.
text
()).
not
.
toContain
(
project
.
nameWithNamespace
);
expect
(
cellText
).
toEqual
(
`
${
location
.
file
}
(line:
${
location
.
startLine
}
)`
);
expect
(
findLocationTextWrapper
(
cell
).
props
()).
toEqual
({
text
:
`
${
location
.
file
}
(line:
${
location
.
startLine
}
)`
,
position
:
'
middle
'
,
});
});
});
it
(
'
should not display the vulnerability group/project locations for code with no line data
'
,
()
=>
{
it
(
'
should not display the vulnerability group/project locations for code with no line data
'
,
()
=>
{
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
2
];
const
{
id
,
project
,
location
}
=
newVulnerabilities
[
2
];
const
cellText
=
findCellText
(
`location-
${
id
}
`
);
const
cell
=
findDataCell
(
`location-
${
id
}
`
);
expect
(
cellText
).
not
.
toContain
(
project
.
nameWithNamespace
);
expect
(
cell
.
text
()).
not
.
toContain
(
project
.
nameWithNamespace
);
expect
(
cellText
).
toEqual
(
location
.
file
);
expect
(
findLocationTextWrapper
(
cell
).
props
()).
toEqual
({
text
:
location
.
file
,
position
:
'
middle
'
,
});
});
});
});
});
...
...
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