diff options
Diffstat (limited to 'app/assets/javascripts/diffs/components/diff_file_header.vue')
-rw-r--r-- | app/assets/javascripts/diffs/components/diff_file_header.vue | 35 |
1 files changed, 19 insertions, 16 deletions
diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index 45c7fe35f03..667b8745f7b 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -13,6 +13,7 @@ import { } from '@gitlab/ui'; import { escape } from 'lodash'; import { mapActions, mapGetters, mapState } from 'vuex'; +import { IdState } from 'vendor/vue-virtual-scroller'; import { diffViewerModes } from '~/ide/constants'; import { scrollToElement } from '~/lib/utils/common_utils'; import { truncateSha } from '~/lib/utils/text_utility'; @@ -41,13 +42,12 @@ export default { GlDropdownDivider, GlFormCheckbox, GlLoadingIcon, - CodeQualityBadge: () => import('ee_component/diffs/components/code_quality_badge.vue'), }, directives: { GlTooltip: GlTooltipDirective, SafeHtml: GlSafeHtmlDirective, }, - mixins: [glFeatureFlagsMixin()], + mixins: [glFeatureFlagsMixin(), IdState({ idProp: (vm) => vm.diffFile.file_hash })], i18n: { ...DIFF_FILE_HEADER, compareButtonLabel: s__('Compare submodule commit revisions'), @@ -102,7 +102,7 @@ export default { default: () => [], }, }, - data() { + idState() { return { moreActionsShown: false, }; @@ -202,8 +202,18 @@ export default { externalUrlLabel() { return sprintf(__('View on %{url}'), { url: this.diffFile.formatted_external_url }); }, - showCodequalityBadge() { - return this.codequalityDiff?.length > 0 && !this.glFeatures.codequalityMrDiffAnnotations; + }, + watch: { + 'idState.moreActionsShown': { + handler(val) { + const el = this.$el.closest('.vue-recycle-scroller__item-view'); + + if (this.glFeatures.diffsVirtualScrolling && el) { + // We can't add a style with Vue because of the way the virtual + // scroller library renders the diff files + el.style.zIndex = val ? '1' : null; + } + }, }, }, methods: { @@ -239,7 +249,7 @@ export default { } }, setMoreActionsShown(val) { - this.moreActionsShown = val; + this.idState.moreActionsShown = val; }, toggleReview(newReviewedStatus) { const autoCollapsed = @@ -268,7 +278,7 @@ export default { <template> <div ref="header" - :class="{ 'gl-z-dropdown-menu!': moreActionsShown }" + :class="{ 'gl-z-dropdown-menu!': idState.moreActionsShown }" class="js-file-title file-title file-title-flex-parent" data-qa-selector="file_title_container" :data-qa-file-name="filePath" @@ -292,7 +302,7 @@ export default { > <file-icon :file-name="filePath" - :size="18" + :size="16" aria-hidden="true" css-classes="gl-mr-2" :submodule="diffFile.submodule" @@ -336,13 +346,6 @@ export default { data-track-property="diff_copy_file" /> - <code-quality-badge - v-if="showCodequalityBadge" - :file-name="filePath" - :codequality-diff="codequalityDiff" - class="gl-mr-2" - /> - <small v-if="isModeChanged" ref="fileMode" class="mr-1"> {{ diffFile.a_mode }} → {{ diffFile.b_mode }} </small> @@ -453,7 +456,7 @@ export default { :disabled="diffFile.isLoadingFullFile" @click="toggleFullDiff(diffFile.file_path)" > - <gl-loading-icon v-if="diffFile.isLoadingFullFile" inline /> + <gl-loading-icon v-if="diffFile.isLoadingFullFile" size="sm" inline /> {{ expandDiffToFullFileTitle }} </gl-dropdown-item> </template> |