Commit ef92d8bf authored by Phil Hughes's avatar Phil Hughes

Merge branch '288343-show-full-treeview' into 'master'

Fix MR diff file tree being hidden behind review bar

See merge request gitlab-org/gitlab!59150
parents f654bb35 32e3f13f
...@@ -185,6 +185,7 @@ export default { ...@@ -185,6 +185,7 @@ export default {
'mrReviews', 'mrReviews',
]), ]),
...mapGetters('diffs', ['whichCollapsedTypes', 'isParallelView', 'currentDiffIndex']), ...mapGetters('diffs', ['whichCollapsedTypes', 'isParallelView', 'currentDiffIndex']),
...mapGetters('batchComments', ['draftsCount']),
...mapGetters(['isNotesFetched', 'getNoteableData']), ...mapGetters(['isNotesFetched', 'getNoteableData']),
diffs() { diffs() {
if (!this.viewDiffsFileByFile) { if (!this.viewDiffsFileByFile) {
...@@ -500,6 +501,7 @@ export default { ...@@ -500,6 +501,7 @@ export default {
<div <div
v-if="renderFileTree" v-if="renderFileTree"
:style="{ width: `${treeWidth}px` }" :style="{ width: `${treeWidth}px` }"
:class="{ 'review-bar-visible': draftsCount > 0 }"
class="diff-tree-list js-diff-tree-list px-3 pr-md-0" class="diff-tree-list js-diff-tree-list px-3 pr-md-0"
> >
<panel-resizer <panel-resizer
......
...@@ -929,6 +929,7 @@ Merge requests ...@@ -929,6 +929,7 @@ Merge requests
$mr-tabs-height: 48px; $mr-tabs-height: 48px;
$mr-version-controls-height: 56px; $mr-version-controls-height: 56px;
$mr-widget-margin-left: 40px; $mr-widget-margin-left: 40px;
$mr-review-bar-height: calc(2rem + 13px);
/* /*
Compare Branches Compare Branches
......
...@@ -9,6 +9,18 @@ ...@@ -9,6 +9,18 @@
min-width: 0; min-width: 0;
} }
.with-system-header {
--system-header-height: #{$system-header-height};
}
.with-performance-bar {
--performance-bar-height: #{$performance-bar-height};
}
.review-bar-visible {
--review-bar-height: #{$mr-review-bar-height};
}
.diff-tree-list { .diff-tree-list {
// This 11px value should match the additional value found in // This 11px value should match the additional value found in
// /assets/stylesheets/framework/diffs.scss // /assets/stylesheets/framework/diffs.scss
...@@ -23,24 +35,13 @@ ...@@ -23,24 +35,13 @@
position: -webkit-sticky; position: -webkit-sticky;
position: sticky; position: sticky;
top: $top-pos; // Unitless zero values are not allowed in calculations https://stackoverflow.com/a/55391061
max-height: calc(100vh - #{$top-pos}); // stylelint-disable-next-line length-zero-no-unit
top: calc(#{$top-pos} + var(--system-header-height, 0px) + var(--performance-bar-height, 0px));
// stylelint-disable-next-line length-zero-no-unit
max-height: calc(100vh - #{$top-pos} - var(--system-header-height, 0px) - var(--performance-bar-height, 0px) - var(--review-bar-height, 0px));
z-index: 202; z-index: 202;
.with-system-header & {
top: $top-pos + $system-header-height;
}
.with-system-header.with-performance-bar & {
top: $top-pos + $system-header-height + $performance-bar-height;
}
.with-performance-bar & {
$performance-bar-top-pos: $performance-bar-height + $top-pos;
top: $performance-bar-top-pos;
max-height: calc(100vh - #{$performance-bar-top-pos});
}
.drag-handle { .drag-handle {
bottom: 16px; bottom: 16px;
transform: translateX(10px); transform: translateX(10px);
......
---
title: Fix MR diff file tree being hidden behind review bar
merge_request: 59150
type: fixed
...@@ -705,4 +705,24 @@ describe('diffs/components/app', () => { ...@@ -705,4 +705,24 @@ describe('diffs/components/app', () => {
); );
}); });
}); });
describe('diff file tree is aware of review bar', () => {
it('it does not have review-bar-visible class when review bar is not visible', () => {
createComponent({}, ({ state }) => {
state.diffs.diffFiles = [{ file_hash: '111', file_path: '111.js' }];
});
expect(wrapper.find('.js-diff-tree-list').exists()).toBe(true);
expect(wrapper.find('.js-diff-tree-list.review-bar-visible').exists()).toBe(false);
});
it('it does have review-bar-visible class when review bar is visible', () => {
createComponent({}, ({ state }) => {
state.diffs.diffFiles = [{ file_hash: '111', file_path: '111.js' }];
state.batchComments.drafts = ['draft message'];
});
expect(wrapper.find('.js-diff-tree-list.review-bar-visible').exists()).toBe(true);
});
});
}); });
import Vue from 'vue'; import Vue from 'vue';
import Vuex from 'vuex'; import Vuex from 'vuex';
import batchCommentsModule from '~/batch_comments/stores/modules/batch_comments';
import diffsModule from '~/diffs/store/modules'; import diffsModule from '~/diffs/store/modules';
import notesModule from '~/notes/stores/modules'; import notesModule from '~/notes/stores/modules';
...@@ -10,6 +11,7 @@ export default function createDiffsStore() { ...@@ -10,6 +11,7 @@ export default function createDiffsStore() {
modules: { modules: {
diffs: diffsModule(), diffs: diffsModule(),
notes: notesModule(), notes: notesModule(),
batchComments: batchCommentsModule(),
}, },
}); });
} }
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