Commit 55836b94 authored by Alexander Turinske's avatar Alexander Turinske

Create sticky section in security dashboard layout

- put filters section into it
- update it on project, group, and instance level dashboard
parent 3e4aaaac
...@@ -52,7 +52,7 @@ export default { ...@@ -52,7 +52,7 @@ export default {
<template> <template>
<security-dashboard-layout> <security-dashboard-layout>
<template #header> <template #sticky>
<filters :projects="projects" @filterChange="handleFilterChange" /> <filters :projects="projects" @filterChange="handleFilterChange" />
</template> </template>
<group-security-vulnerabilities <group-security-vulnerabilities
......
...@@ -118,6 +118,8 @@ export default { ...@@ -118,6 +118,8 @@ export default {
>{{ toggleButtonProps.text }}</gl-button >{{ toggleButtonProps.text }}</gl-button
> >
</header> </header>
</template>
<template #sticky>
<filters <filters
v-if="shouldShowDashboard" v-if="shouldShowDashboard"
:projects="graphqlProjectList" :projects="graphqlProjectList"
......
...@@ -112,6 +112,8 @@ export default { ...@@ -112,6 +112,8 @@ export default {
<csv-export-button :vulnerabilities-export-endpoint="vulnerabilitiesExportEndpoint" /> <csv-export-button :vulnerabilities-export-endpoint="vulnerabilitiesExportEndpoint" />
</div> </div>
<vulnerabilities-count-list :project-full-path="projectFullPath" /> <vulnerabilities-count-list :project-full-path="projectFullPath" />
</template>
<template #sticky>
<filters @filterChange="handleFilterChange" /> <filters @filterChange="handleFilterChange" />
</template> </template>
<project-vulnerabilities-app <project-vulnerabilities-app
......
<script> <script>
export default { export default {
stickyHeight: process.env.NODE_ENV === 'development' ? '75px' : '40px',
computed: { computed: {
hasHeaderSlot() { hasHeaderSlot() {
return Boolean(this.$slots.header); return Boolean(this.$slots.header);
}, },
hasStickySlot() {
return Boolean(this.$slots.sticky);
},
stickyClasses() {
return this.hasStickySlot ? ['position-sticky', 'gl-z-index-2'] : [];
},
hasAsideSlot() { hasAsideSlot() {
return Boolean(this.$slots.aside); return Boolean(this.$slots.aside);
}, },
...@@ -17,6 +24,10 @@ export default { ...@@ -17,6 +24,10 @@ export default {
<slot name="header"></slot> <slot name="header"></slot>
</header> </header>
<section v-if="hasStickySlot" :class="stickyClasses" :style="{ top: $options.stickyHeight }">
<slot name="sticky"></slot>
</section>
<div class="row mt-4"> <div class="row mt-4">
<article class="col" :class="{ 'col-xl-7': hasAsideSlot }"> <article class="col" :class="{ 'col-xl-7': hasAsideSlot }">
<slot></slot> <slot></slot>
......
---
title: Create sticky section in security dashboard layout
merge_request: 33651
author:
type: added
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