diff options
Diffstat (limited to 'app/assets/javascripts/diffs/components')
11 files changed, 48 insertions, 54 deletions
diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue index 5707e4d67f9..c86f2c8451c 100644 --- a/app/assets/javascripts/diffs/components/app.vue +++ b/app/assets/javascripts/diffs/components/app.vue @@ -21,7 +21,7 @@ import MrWidgetHowToMergeModal from '~/vue_merge_request_widget/components/mr_wi import PanelResizer from '~/vue_shared/components/panel_resizer.vue'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import notesEventHub from '../../notes/event_hub'; +import notesEventHub from '~/notes/event_hub'; import { TREE_LIST_WIDTH_STORAGE_KEY, INITIAL_TREE_WIDTH, @@ -347,36 +347,34 @@ export default { this.setHighlightedRow(id.split('diff-content').pop().slice(1)); } - if (window.gon?.features?.diffSettingsUsageData) { - const events = []; + const events = []; - if (this.renderTreeList) { - events.push(TRACKING_FILE_BROWSER_TREE); - } else { - events.push(TRACKING_FILE_BROWSER_LIST); - } - - if (this.diffViewType === INLINE_DIFF_VIEW_TYPE) { - events.push(TRACKING_DIFF_VIEW_INLINE); - } else { - events.push(TRACKING_DIFF_VIEW_PARALLEL); - } + if (this.renderTreeList) { + events.push(TRACKING_FILE_BROWSER_TREE); + } else { + events.push(TRACKING_FILE_BROWSER_LIST); + } - if (this.showWhitespace) { - events.push(TRACKING_WHITESPACE_SHOW); - } else { - events.push(TRACKING_WHITESPACE_HIDE); - } + if (this.diffViewType === INLINE_DIFF_VIEW_TYPE) { + events.push(TRACKING_DIFF_VIEW_INLINE); + } else { + events.push(TRACKING_DIFF_VIEW_PARALLEL); + } - if (this.viewDiffsFileByFile) { - events.push(TRACKING_SINGLE_FILE_MODE); - } else { - events.push(TRACKING_MULTIPLE_FILES_MODE); - } + if (this.showWhitespace) { + events.push(TRACKING_WHITESPACE_SHOW); + } else { + events.push(TRACKING_WHITESPACE_HIDE); + } - queueRedisHllEvents(events); + if (this.viewDiffsFileByFile) { + events.push(TRACKING_SINGLE_FILE_MODE); + } else { + events.push(TRACKING_MULTIPLE_FILES_MODE); } + queueRedisHllEvents(events); + this.subscribeToVirtualScrollingEvents(); }, beforeCreate() { @@ -534,10 +532,8 @@ export default { if (delta >= 0 && delta < 1000) { this.disableVirtualScroller(); - if (window.gon?.features?.usageDataDiffSearches) { - api.trackRedisHllUserEvent('i_code_review_user_searches_diff'); - api.trackRedisCounterEvent('diff_searches'); - } + api.trackRedisHllUserEvent('i_code_review_user_searches_diff'); + api.trackRedisCounterEvent('diff_searches'); } } }); @@ -574,12 +570,8 @@ export default { this.scrollVirtualScrollerToIndex(index); } }, - async scrollVirtualScrollerToIndex(index) { + scrollVirtualScrollerToIndex(index) { this.virtualScrollCurrentIndex = index; - - await this.$nextTick(); - - this.virtualScrollCurrentIndex = -1; }, scrollVirtualScrollerToDiffNote() { const id = window?.location?.hash; @@ -705,7 +697,7 @@ export default { </dynamic-scroller-item> </template> </pre-renderer> - <virtual-scroller-scroll-sync :index="virtualScrollCurrentIndex" /> + <virtual-scroller-scroll-sync v-model="virtualScrollCurrentIndex" /> </template> </dynamic-scroller> <template v-else> diff --git a/app/assets/javascripts/diffs/components/commit_item.vue b/app/assets/javascripts/diffs/components/commit_item.vue index ba10f6deb29..42f4ea8eb58 100644 --- a/app/assets/javascripts/diffs/components/commit_item.vue +++ b/app/assets/javascripts/diffs/components/commit_item.vue @@ -103,7 +103,7 @@ export default { > <div v-if="commit.signature_html" - v-safe-html:[$options.safeHtmlConfig]="commit.signature_html" + v-html="commit.signature_html /* eslint-disable-line vue/no-v-html */" ></div> <commit-pipeline-status v-if="commit.pipeline_status_path" @@ -137,7 +137,7 @@ export default { :link-href="authorUrl" :img-src="authorAvatar" :img-alt="authorName" - :img-size="40" + :img-size="32" class="avatar-cell d-none d-sm-block" /> </div> diff --git a/app/assets/javascripts/diffs/components/compare_versions.vue b/app/assets/javascripts/diffs/components/compare_versions.vue index 2b871680d5e..4dfd672f99b 100644 --- a/app/assets/javascripts/diffs/components/compare_versions.vue +++ b/app/assets/javascripts/diffs/components/compare_versions.vue @@ -2,7 +2,7 @@ import { GlTooltipDirective, GlIcon, GlLink, GlButtonGroup, GlButton, GlSprintf } from '@gitlab/ui'; import { mapActions, mapGetters, mapState } from 'vuex'; import { __ } from '~/locale'; -import { setUrlParams } from '../../lib/utils/url_utility'; +import { setUrlParams } from '~/lib/utils/url_utility'; import { EVT_EXPAND_ALL_FILES } from '../constants'; import eventHub from '../event_hub'; import CompareDropdownLayout from './compare_dropdown_layout.vue'; diff --git a/app/assets/javascripts/diffs/components/diff_content.vue b/app/assets/javascripts/diffs/components/diff_content.vue index 7ed5713ebfa..b4bffdcb07f 100644 --- a/app/assets/javascripts/diffs/components/diff_content.vue +++ b/app/assets/javascripts/diffs/components/diff_content.vue @@ -9,9 +9,9 @@ import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form'; import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue'; import NoPreviewViewer from '~/vue_shared/components/diff_viewer/viewers/no_preview.vue'; import NotDiffableViewer from '~/vue_shared/components/diff_viewer/viewers/not_diffable.vue'; -import NoteForm from '../../notes/components/note_form.vue'; -import eventHub from '../../notes/event_hub'; -import userAvatarLink from '../../vue_shared/components/user_avatar/user_avatar_link.vue'; +import NoteForm from '~/notes/components/note_form.vue'; +import eventHub from '~/notes/event_hub'; +import userAvatarLink from '~/vue_shared/components/user_avatar/user_avatar_link.vue'; import { IMAGE_DIFF_POSITION_TYPE } from '../constants'; import { getDiffMode } from '../store/utils'; import DiffDiscussions from './diff_discussions.vue'; @@ -170,7 +170,6 @@ export default { <note-form v-if="diffFileCommentForm" ref="noteForm" - :is-editing="false" :save-button-title="__('Comment')" class="diff-comment-form new-note discussion-form discussion-form-container" @handleFormUpdateAddToReview="addToReview" diff --git a/app/assets/javascripts/diffs/components/diff_discussions.vue b/app/assets/javascripts/diffs/components/diff_discussions.vue index 47a05ce11cc..b39b50c4cdc 100644 --- a/app/assets/javascripts/diffs/components/diff_discussions.vue +++ b/app/assets/javascripts/diffs/components/diff_discussions.vue @@ -2,7 +2,7 @@ import { GlIcon } from '@gitlab/ui'; import { mapActions } from 'vuex'; import DesignNotePin from '~/vue_shared/components/design_management/design_note_pin.vue'; -import noteableDiscussion from '../../notes/components/noteable_discussion.vue'; +import noteableDiscussion from '~/notes/components/noteable_discussion.vue'; export default { components: { diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index 4e77bf81c1e..d8f27a967df 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -17,7 +17,7 @@ import { diffViewerErrors } from '~/ide/constants'; import { scrollToElement } from '~/lib/utils/common_utils'; import { sprintf } from '~/locale'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import notesEventHub from '../../notes/event_hub'; +import notesEventHub from '~/notes/event_hub'; import { DIFF_FILE_AUTOMATIC_COLLAPSE, diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index 495c87a695c..8cdbd2b7dbc 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -340,6 +340,7 @@ export default { :title="__('Copy file path')" :text="diffFile.file_path" :gfm="gfmCopyText" + size="small" data-testid="diff-file-copy-clipboard" category="tertiary" data-track-action="click_copy_file_button" @@ -392,6 +393,7 @@ export default { /> <gl-dropdown v-gl-tooltip.hover.focus="$options.i18n.optionsDropdownTitle" + size="small" right toggle-class="btn-icon js-diff-more-actions" class="gl-pt-0!" @@ -400,7 +402,7 @@ export default { @hidden="setMoreActionsShown(false)" > <template #button-content> - <gl-icon name="ellipsis_v" class="mr-0" /> + <gl-icon name="ellipsis_v" class="mr-0" :size="12" /> <span class="sr-only">{{ $options.i18n.optionsDropdownTitle }}</span> </template> <gl-dropdown-item diff --git a/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue b/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue index e2f3f9cad7b..a077c8ae3af 100644 --- a/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue +++ b/app/assets/javascripts/diffs/components/diff_gutter_avatars.vue @@ -74,6 +74,7 @@ export default { v-for="note in notesInGutter" :key="note.id" :img-src="note.author.avatar_url" + :size="24" :tooltip-text="getTooltipText(note)" lazy class="diff-comment-avatar js-diff-comment-avatar" diff --git a/app/assets/javascripts/diffs/components/diff_line_note_form.vue b/app/assets/javascripts/diffs/components/diff_line_note_form.vue index 9d355c96af1..7a30740e31b 100644 --- a/app/assets/javascripts/diffs/components/diff_line_note_form.vue +++ b/app/assets/javascripts/diffs/components/diff_line_note_form.vue @@ -4,13 +4,10 @@ import { s__ } from '~/locale'; import diffLineNoteFormMixin from '~/notes/mixins/diff_line_note_form'; import { confirmAction } from '~/lib/utils/confirm_via_gl_modal/confirm_via_gl_modal'; import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin'; -import MultilineCommentForm from '../../notes/components/multiline_comment_form.vue'; -import { - commentLineOptions, - formatLineRange, -} from '../../notes/components/multiline_comment_utils'; -import noteForm from '../../notes/components/note_form.vue'; -import autosave from '../../notes/mixins/autosave'; +import MultilineCommentForm from '~/notes/components/multiline_comment_form.vue'; +import { commentLineOptions, formatLineRange } from '~/notes/components/multiline_comment_utils'; +import noteForm from '~/notes/components/note_form.vue'; +import autosave from '~/notes/mixins/autosave'; import { DIFF_NOTE_TYPE, INLINE_DIFF_LINES_KEY, @@ -221,7 +218,6 @@ export default { </div> <note-form ref="noteForm" - :is-editing="false" :line-code="line.line_code" :line="line" :lines="commentLines" diff --git a/app/assets/javascripts/diffs/components/no_changes.vue b/app/assets/javascripts/diffs/components/no_changes.vue index ab518fcfb16..42af2ab7880 100644 --- a/app/assets/javascripts/diffs/components/no_changes.vue +++ b/app/assets/javascripts/diffs/components/no_changes.vue @@ -61,7 +61,7 @@ export default { </gl-sprintf> </div> <div class="text-center"> - <gl-button :href="getNoteableData.new_blob_path" variant="success" category="primary">{{ + <gl-button :href="getNoteableData.new_blob_path" variant="confirm" category="primary">{{ __('Create commit') }}</gl-button> </div> diff --git a/app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js b/app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js index 984c6f8c0c9..d44dffecc38 100644 --- a/app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js +++ b/app/assets/javascripts/diffs/components/virtual_scroller_scroll_sync.js @@ -2,6 +2,9 @@ import { handleLocationHash } from '~/lib/utils/common_utils'; export default { inject: ['vscrollParent'], + model: { + prop: 'index', + }, props: { index: { type: Number, @@ -39,6 +42,7 @@ export default { methods: { scrollToIndex(index) { this.vscrollParent.scrollToItem(index); + this.$emit('update', -1); setTimeout(() => { handleLocationHash(); |