Commit bf15c795 authored by Phil Hughes's avatar Phil Hughes

Merge branch '227281-create-consistent-widths-for-vulnerability-list-columns' into 'master'

Make vulnerability list columns have consistent widths

See merge request gitlab-org/gitlab!40561
parents 48a15e58 eabe01a0
...@@ -180,3 +180,33 @@ table { ...@@ -180,3 +180,33 @@ table {
border-top: 0; border-top: 0;
} }
} }
.vulnerability-list {
@media (min-width: $breakpoint-sm) {
.checkbox {
padding-left: $gl-spacing-scale-4;
padding-right: 0;
+ td,
+ th {
padding-left: $gl-spacing-scale-4;
}
}
.status {
width: 8%;
}
.severity {
width: 9%;
}
.identifier {
width: 12%;
}
.scanner {
width: 15%;
}
}
}
...@@ -122,30 +122,32 @@ export default { ...@@ -122,30 +122,32 @@ export default {
return this.shouldShowSelectionSummary ? 'below-selection-summary' : ''; return this.shouldShowSelectionSummary ? 'below-selection-summary' : '';
}, },
fields() { fields() {
const commonThClass = ['table-th-transparent', 'original-gl-th', 'gl-bg-white!'].join(' ');
const baseFields = [ const baseFields = [
{ {
key: 'state', key: 'state',
label: s__('Vulnerability|Status'), label: s__('Vulnerability|Status'),
thClass: `vulnerability-td ${commonThClass}`, thClass: 'status',
tdClass: 'status',
}, },
{ {
key: 'severity', key: 'severity',
label: s__('Vulnerability|Severity'), label: s__('Vulnerability|Severity'),
thClass: `vulnerability-td ${commonThClass}`, thClass: 'severity',
tdClass: 'severity',
}, },
{ {
key: 'title', key: 'title',
label: __('Description'), label: __('Description'),
thClass: commonThClass, thClass: 'description',
tdClass: 'gl-word-break-all', tdClass: 'description gl-word-break-all',
}, },
]; ];
if (this.shouldShowSelection) { if (this.shouldShowSelection) {
baseFields.unshift({ baseFields.unshift({
key: 'checkbox', key: 'checkbox',
thClass: `gl-w-9 ${commonThClass}`, thClass: 'checkbox',
tdClass: 'checkbox',
}); });
} }
...@@ -153,8 +155,8 @@ export default { ...@@ -153,8 +155,8 @@ export default {
baseFields.push({ baseFields.push({
key: 'identifier', key: 'identifier',
label: s__('Vulnerability|Identifier'), label: s__('Vulnerability|Identifier'),
thClass: commonThClass, thClass: 'identifier',
tdClass: 'gl-word-break-all', tdClass: 'identifier gl-word-break-all',
}); });
} }
...@@ -162,9 +164,16 @@ export default { ...@@ -162,9 +164,16 @@ export default {
baseFields.push({ baseFields.push({
key: 'reportType', key: 'reportType',
label: s__('Reports|Scanner'), label: s__('Reports|Scanner'),
thClass: commonThClass, thClass: 'scanner',
tdClass: 'scanner',
}); });
} }
// Apply gl-bg-white! to every header.
baseFields.forEach(field => {
field.thClass = [field.thClass, 'gl-bg-white!']; // eslint-disable-line no-param-reassign
});
return baseFields; return baseFields;
}, },
}, },
...@@ -273,12 +282,13 @@ export default { ...@@ -273,12 +282,13 @@ export default {
:items="vulnerabilities" :items="vulnerabilities"
:thead-class="theadClass" :thead-class="theadClass"
stacked="sm" stacked="sm"
class="vulnerability-list"
show-empty show-empty
responsive responsive
> >
<template #head(checkbox)> <template #head(checkbox)>
<gl-form-checkbox <gl-form-checkbox
class="mr-0 mb-0" class="gl-m-0"
data-testid="vulnerability-checkbox-all" data-testid="vulnerability-checkbox-all"
:checked="hasSelectedAllVulnerabilities" :checked="hasSelectedAllVulnerabilities"
@change="toggleAllVulnerabilities" @change="toggleAllVulnerabilities"
...@@ -286,7 +296,7 @@ export default { ...@@ -286,7 +296,7 @@ export default {
</template> </template>
<template v-if="shouldShowScannersAlert" #top-row> <template v-if="shouldShowScannersAlert" #top-row>
<td :colspan="fields.length"> <td :colspan="fields.length" class="gl-px-0!">
<security-scanner-alert <security-scanner-alert
:not-enabled-scanners="notEnabledSecurityScanners" :not-enabled-scanners="notEnabledSecurityScanners"
:no-pipeline-run-scanners="noPipelineRunSecurityScanners" :no-pipeline-run-scanners="noPipelineRunSecurityScanners"
...@@ -297,7 +307,7 @@ export default { ...@@ -297,7 +307,7 @@ export default {
<template #cell(checkbox)="{ item }"> <template #cell(checkbox)="{ item }">
<gl-form-checkbox <gl-form-checkbox
class="d-inline-block mr-0 mb-0" class="gl-display-inline-block! gl-m-0"
data-testid="vulnerability-checkbox" data-testid="vulnerability-checkbox"
:checked="isSelected(item)" :checked="isSelected(item)"
@change="toggleVulnerability(item)" @change="toggleVulnerability(item)"
...@@ -309,7 +319,7 @@ export default { ...@@ -309,7 +319,7 @@ export default {
</template> </template>
<template #cell(severity)="{ item }"> <template #cell(severity)="{ item }">
<severity-badge class="js-severity" :severity="item.severity" /> <severity-badge class="js-severity gl-white-space-normal!" :severity="item.severity" />
</template> </template>
<template #cell(title)="{ item }"> <template #cell(title)="{ item }">
...@@ -388,8 +398,3 @@ export default { ...@@ -388,8 +398,3 @@ export default {
</gl-table> </gl-table>
</div> </div>
</template> </template>
<style>
.vulnerability-td {
width: 8rem;
}
</style>
---
title: Make vulnerability list columns have consistent widths
merge_request: 40561
author:
type: fixed
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