Commit da9bbde4 authored by Nicolò Maria Mezzopera's avatar Nicolò Maria Mezzopera

Merge branch '215355-pin-header' into 'master'

Pin vulnerability list header to the page top

See merge request gitlab-org/gitlab!33875
parents 82b29b28 af062cdf
...@@ -23,7 +23,7 @@ export default { ...@@ -23,7 +23,7 @@ export default {
<section <section
v-if="hasStickySlot" v-if="hasStickySlot"
data-testid="sticky-section" data-testid="sticky-section"
class="position-sticky gl-z-index-2 security_dashboard_filters" class="position-sticky gl-z-index-2 security-dashboard-filters"
> >
<slot name="sticky"></slot> <slot name="sticky"></slot>
</section> </section>
......
...@@ -70,10 +70,13 @@ export default { ...@@ -70,10 +70,13 @@ export default {
return this.shouldShowSelection && Boolean(this.numOfSelectedVulnerabilities); return this.shouldShowSelection && Boolean(this.numOfSelectedVulnerabilities);
}, },
checkboxClass() { checkboxClass() {
return this.shouldShowSelection ? '' : 'd-none'; return this.shouldShowSelection ? '' : 'gl-display-none';
},
theadClass() {
return this.shouldShowSelectionSummary ? 'below-selection-summary' : '';
}, },
fields() { fields() {
const commonThClass = ['table-th-transparent', 'original-gl-th'].join(' '); const commonThClass = ['table-th-transparent', 'original-gl-th', 'gl-bg-white!'].join(' ');
return [ return [
{ {
key: 'checkbox', key: 'checkbox',
...@@ -154,7 +157,7 @@ export default { ...@@ -154,7 +157,7 @@ export default {
</script> </script>
<template> <template>
<div> <div class="vulnerability-list">
<selection-summary <selection-summary
v-if="shouldShowSelectionSummary" v-if="shouldShowSelectionSummary"
:selected-vulnerabilities="Object.values(selectedVulnerabilities)" :selected-vulnerabilities="Object.values(selectedVulnerabilities)"
...@@ -165,6 +168,7 @@ export default { ...@@ -165,6 +168,7 @@ export default {
:busy="isLoading" :busy="isLoading"
:fields="fields" :fields="fields"
:items="vulnerabilities" :items="vulnerabilities"
:thead-class="theadClass"
stacked="sm" stacked="sm"
show-empty show-empty
responsive responsive
......
$security-filter-height: 90px;
$selection-summary-height: 68px;
@mixin sticky-top-positioning($extra: 0) {
top: $header-height + $extra;
.with-performance-bar & {
top: $header-height + $performance-bar-height + $extra;
}
}
.vulnerabilities-row { .vulnerabilities-row {
&.dismissed .table-mobile-content:not(.action-buttons) { &.dismissed .table-mobile-content:not(.action-buttons) {
opacity: 0.5; opacity: 0.5;
...@@ -23,10 +34,26 @@ ...@@ -23,10 +34,26 @@
} }
} }
.security_dashboard_filters { .security-dashboard-filters {
top: $header-height; @include sticky-top-positioning();
}
.with-performance-bar & { // Due to position: sticky not being supported on Chrome (https://caniuse.com/#feat=css-sticky),
top: $header-height + $performance-bar-height; // the property is assigned to the th element as a workaround
.vulnerability-list {
.card,
thead th {
position: -webkit-sticky;
position: sticky;
z-index: 1;
@include sticky-top-positioning($security-filter-height);
}
thead th {
box-shadow: 0 1px $gray-100;
}
thead.below-selection-summary th {
@include sticky-top-positioning($security-filter-height + $selection-summary-height);
} }
} }
---
title: Pin selection summary/list header to the page top
merge_request: 33875
author:
type: added
...@@ -74,8 +74,8 @@ describe('Vulnerability list component', () => { ...@@ -74,8 +74,8 @@ describe('Vulnerability list component', () => {
}); });
it('should not show the checkboxes if shouldShowSelection is passed in', () => { it('should not show the checkboxes if shouldShowSelection is passed in', () => {
expect(findCheckAllCheckboxCell().classes()).toContain('d-none'); expect(findCheckAllCheckboxCell().classes()).toContain('gl-display-none');
expect(findFirstCheckboxCell().classes()).toContain('d-none'); expect(findFirstCheckboxCell().classes()).toContain('gl-display-none');
}); });
}); });
......
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