diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-11 18:08:46 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-11-11 18:08:46 +0300 |
commit | 5fc3c77e2b08746bd39bfffae0c5918d63178433 (patch) | |
tree | f6d8d49f2caa07da9c09dc3333849b4c39cc857d /app/assets/javascripts/diffs | |
parent | 9517d0eb2ca8bde02d7fae2173e0a43b67b2b9f5 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/diffs')
-rw-r--r-- | app/assets/javascripts/diffs/components/diff_file.vue | 8 | ||||
-rw-r--r-- | app/assets/javascripts/diffs/components/diff_file_header.vue | 4 | ||||
-rw-r--r-- | app/assets/javascripts/diffs/store/actions.js | 15 |
3 files changed, 18 insertions, 9 deletions
diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index 59bd2d90158..32191d7e309 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -172,9 +172,9 @@ export default { notesEventHub.$on(`loadCollapsedDiff/${this.file.file_hash}`, this.requestDiff); eventHub.$on(EVT_EXPAND_ALL_FILES, this.expandAllListener); }, - async mounted() { + mounted() { if (this.hasDiff) { - await this.postRender(); + this.postRender(); } }, beforeDestroy() { @@ -231,8 +231,8 @@ export default { }) .then(() => { requestIdleCallback( - async () => { - await this.postRender(); + () => { + this.postRender(); this.assignDiscussionsToDiff(this.getDiffFileDiscussions(this.file)); }, { timeout: 1000 }, diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index e94f2e0e6d7..0d99a2e8a60 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -10,6 +10,7 @@ import { GlDropdown, GlDropdownItem, GlDropdownDivider, + GlLoadingIcon, } from '@gitlab/ui'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import FileIcon from '~/vue_shared/components/file_icon.vue'; @@ -32,6 +33,7 @@ export default { GlDropdown, GlDropdownItem, GlDropdownDivider, + GlLoadingIcon, }, directives: { GlTooltip: GlTooltipDirective, @@ -365,8 +367,10 @@ export default { <gl-dropdown-item v-if="!diffFile.is_fully_expanded" ref="expandDiffToFullFileButton" + :disabled="diffFile.isLoadingFullFile" @click="toggleFullDiff(diffFile.file_path)" > + <gl-loading-icon v-if="diffFile.isLoadingFullFile" inline /> {{ expandDiffToFullFileTitle }} </gl-dropdown-item> </template> diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index 72b99ca8486..91c4c51487f 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -543,15 +543,20 @@ export const setExpandedDiffLines = ({ commit, state }, { file, data }) => { }), }), }; + const unifiedDiffLinesEnabled = window.gon?.features?.unifiedDiffLines; const currentDiffLinesKey = - state.diffViewType === INLINE_DIFF_VIEW_TYPE ? INLINE_DIFF_LINES_KEY : PARALLEL_DIFF_LINES_KEY; + state.diffViewType === INLINE_DIFF_VIEW_TYPE || unifiedDiffLinesEnabled + ? INLINE_DIFF_LINES_KEY + : PARALLEL_DIFF_LINES_KEY; const hiddenDiffLinesKey = state.diffViewType === INLINE_DIFF_VIEW_TYPE ? PARALLEL_DIFF_LINES_KEY : INLINE_DIFF_LINES_KEY; - commit(types.SET_HIDDEN_VIEW_DIFF_FILE_LINES, { - filePath: file.file_path, - lines: expandedDiffLines[hiddenDiffLinesKey], - }); + if (!unifiedDiffLinesEnabled) { + commit(types.SET_HIDDEN_VIEW_DIFF_FILE_LINES, { + filePath: file.file_path, + lines: expandedDiffLines[hiddenDiffLinesKey], + }); + } if (expandedDiffLines[currentDiffLinesKey].length > MAX_RENDERING_DIFF_LINES) { let index = START_RENDERING_INDEX; |