Commit eabe01a0 authored by Daniel Tian's avatar Daniel Tian

Make vulnerability list columns have consistent widths

parent fd39b75a
...@@ -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%;
}
}
}
...@@ -119,30 +119,32 @@ export default { ...@@ -119,30 +119,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',
}); });
} }
...@@ -150,8 +152,8 @@ export default { ...@@ -150,8 +152,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',
}); });
} }
...@@ -159,9 +161,16 @@ export default { ...@@ -159,9 +161,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;
}, },
}, },
...@@ -270,12 +279,13 @@ export default { ...@@ -270,12 +279,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"
...@@ -283,7 +293,7 @@ export default { ...@@ -283,7 +293,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"
...@@ -294,7 +304,7 @@ export default { ...@@ -294,7 +304,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)"
...@@ -306,7 +316,7 @@ export default { ...@@ -306,7 +316,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 }">
...@@ -381,8 +391,3 @@ export default { ...@@ -381,8 +391,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