Commit 0d0f9a2e authored by Kushal Pandya's avatar Kushal Pandya

Merge branch 'ph/showFullFileUnifiedDiffs' into 'master'

Fix show full diff file not working with unified diffs

See merge request gitlab-org/gitlab!47272
parents 010dd247 1afe8010
...@@ -10,6 +10,7 @@ import { ...@@ -10,6 +10,7 @@ import {
GlDropdown, GlDropdown,
GlDropdownItem, GlDropdownItem,
GlDropdownDivider, GlDropdownDivider,
GlLoadingIcon,
} from '@gitlab/ui'; } from '@gitlab/ui';
import ClipboardButton from '~/vue_shared/components/clipboard_button.vue'; import ClipboardButton from '~/vue_shared/components/clipboard_button.vue';
import FileIcon from '~/vue_shared/components/file_icon.vue'; import FileIcon from '~/vue_shared/components/file_icon.vue';
...@@ -32,6 +33,7 @@ export default { ...@@ -32,6 +33,7 @@ export default {
GlDropdown, GlDropdown,
GlDropdownItem, GlDropdownItem,
GlDropdownDivider, GlDropdownDivider,
GlLoadingIcon,
}, },
directives: { directives: {
GlTooltip: GlTooltipDirective, GlTooltip: GlTooltipDirective,
...@@ -365,8 +367,10 @@ export default { ...@@ -365,8 +367,10 @@ export default {
<gl-dropdown-item <gl-dropdown-item
v-if="!diffFile.is_fully_expanded" v-if="!diffFile.is_fully_expanded"
ref="expandDiffToFullFileButton" ref="expandDiffToFullFileButton"
:disabled="diffFile.isLoadingFullFile"
@click="toggleFullDiff(diffFile.file_path)" @click="toggleFullDiff(diffFile.file_path)"
> >
<gl-loading-icon v-if="diffFile.isLoadingFullFile" inline />
{{ expandDiffToFullFileTitle }} {{ expandDiffToFullFileTitle }}
</gl-dropdown-item> </gl-dropdown-item>
</template> </template>
......
...@@ -543,15 +543,20 @@ export const setExpandedDiffLines = ({ commit, state }, { file, data }) => { ...@@ -543,15 +543,20 @@ export const setExpandedDiffLines = ({ commit, state }, { file, data }) => {
}), }),
}), }),
}; };
const unifiedDiffLinesEnabled = window.gon?.features?.unifiedDiffLines;
const currentDiffLinesKey = 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 = const hiddenDiffLinesKey =
state.diffViewType === INLINE_DIFF_VIEW_TYPE ? PARALLEL_DIFF_LINES_KEY : INLINE_DIFF_LINES_KEY; state.diffViewType === INLINE_DIFF_VIEW_TYPE ? PARALLEL_DIFF_LINES_KEY : INLINE_DIFF_LINES_KEY;
if (!unifiedDiffLinesEnabled) {
commit(types.SET_HIDDEN_VIEW_DIFF_FILE_LINES, { commit(types.SET_HIDDEN_VIEW_DIFF_FILE_LINES, {
filePath: file.file_path, filePath: file.file_path,
lines: expandedDiffLines[hiddenDiffLinesKey], lines: expandedDiffLines[hiddenDiffLinesKey],
}); });
}
if (expandedDiffLines[currentDiffLinesKey].length > MAX_RENDERING_DIFF_LINES) { if (expandedDiffLines[currentDiffLinesKey].length > MAX_RENDERING_DIFF_LINES) {
let index = START_RENDERING_INDEX; let index = START_RENDERING_INDEX;
......
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