diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-09-20 16:18:24 +0300 |
commit | 0653e08efd039a5905f3fa4f6e9cef9f5d2f799c (patch) | |
tree | 4dcc884cf6d81db44adae4aa99f8ec1233a41f55 /app/assets/javascripts/diffs | |
parent | 744144d28e3e7fddc117924fef88de5d9674fe4c (diff) |
Add latest changes from gitlab-org/gitlab@14-3-stable-eev14.3.0-rc42
Diffstat (limited to 'app/assets/javascripts/diffs')
15 files changed, 153 insertions, 141 deletions
diff --git a/app/assets/javascripts/diffs/components/app.vue b/app/assets/javascripts/diffs/components/app.vue index d03b5cbc26b..a2ea42e963c 100644 --- a/app/assets/javascripts/diffs/components/app.vue +++ b/app/assets/javascripts/diffs/components/app.vue @@ -1,9 +1,8 @@ <script> -import { GlLoadingIcon, GlPagination, GlSprintf } from '@gitlab/ui'; +import { GlLoadingIcon, GlPagination, GlSprintf, GlAlert } from '@gitlab/ui'; import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils'; import Mousetrap from 'mousetrap'; import { mapState, mapGetters, mapActions } from 'vuex'; -import { DynamicScroller, DynamicScrollerItem } from 'vendor/vue-virtual-scroller'; import api from '~/api'; import { keysFor, @@ -47,7 +46,6 @@ import { import diffsEventHub from '../event_hub'; import { reviewStatuses } from '../utils/file_reviews'; import { diffsApp } from '../utils/performance'; -import { fileByFile } from '../utils/preferences'; import { queueRedisHllEvents } from '../utils/queue_events'; import CollapsedFilesWarning from './collapsed_files_warning.vue'; import CommitWidget from './commit_widget.vue'; @@ -55,13 +53,18 @@ import CompareVersions from './compare_versions.vue'; import DiffFile from './diff_file.vue'; import HiddenFilesWarning from './hidden_files_warning.vue'; import NoChanges from './no_changes.vue'; -import PreRenderer from './pre_renderer.vue'; import TreeList from './tree_list.vue'; -import VirtualScrollerScrollSync from './virtual_scroller_scroll_sync'; export default { name: 'DiffsApp', components: { + DynamicScroller: () => + import('vendor/vue-virtual-scroller').then(({ DynamicScroller }) => DynamicScroller), + DynamicScrollerItem: () => + import('vendor/vue-virtual-scroller').then(({ DynamicScrollerItem }) => DynamicScrollerItem), + PreRenderer: () => import('./pre_renderer.vue').then((PreRenderer) => PreRenderer), + VirtualScrollerScrollSync: () => + import('./virtual_scroller_scroll_sync').then((VSSSync) => VSSSync), CompareVersions, DiffFile, NoChanges, @@ -73,11 +76,8 @@ export default { PanelResizer, GlPagination, GlSprintf, - DynamicScroller, - DynamicScrollerItem, - PreRenderer, - VirtualScrollerScrollSync, MrWidgetHowToMergeModal, + GlAlert, }, alerts: { ALERT_OVERFLOW_HIDDEN, @@ -189,25 +189,24 @@ export default { treeWidth, diffFilesLength: 0, virtualScrollCurrentIndex: -1, + subscribedToVirtualScrollingEvents: false, }; }, computed: { - ...mapState({ - isLoading: (state) => state.diffs.isLoading, - isBatchLoading: (state) => state.diffs.isBatchLoading, - diffFiles: (state) => state.diffs.diffFiles, - diffViewType: (state) => state.diffs.diffViewType, - commit: (state) => state.diffs.commit, - renderOverflowWarning: (state) => state.diffs.renderOverflowWarning, - numTotalFiles: (state) => state.diffs.realSize, - numVisibleFiles: (state) => state.diffs.size, - plainDiffPath: (state) => state.diffs.plainDiffPath, - emailPatchPath: (state) => state.diffs.emailPatchPath, - retrievingBatches: (state) => state.diffs.retrievingBatches, + ...mapState('diffs', { + numTotalFiles: 'realSize', + numVisibleFiles: 'size', }), ...mapState('diffs', [ 'showTreeList', 'isLoading', + 'diffFiles', + 'diffViewType', + 'commit', + 'renderOverflowWarning', + 'plainDiffPath', + 'emailPatchPath', + 'retrievingBatches', 'startVersion', 'latestDiff', 'currentDiffFileId', @@ -227,8 +226,9 @@ export default { 'isParallelView', 'currentDiffIndex', 'isVirtualScrollingEnabled', + 'isBatchLoading', + 'isBatchLoadingError', ]), - ...mapGetters('batchComments', ['draftsCount']), ...mapGetters(['isNotesFetched', 'getNoteableData']), diffs() { if (!this.viewDiffsFileByFile) { @@ -316,6 +316,7 @@ export default { } this.adjustView(); + this.subscribeToVirtualScrollingEvents(); }, isLoading: 'adjustView', renderFileTree: 'adjustView', @@ -330,7 +331,7 @@ export default { projectPath: this.projectPath, dismissEndpoint: this.dismissEndpoint, showSuggestPopover: this.showSuggestPopover, - viewDiffsFileByFile: fileByFile(this.fileByFileUserPreference), + viewDiffsFileByFile: this.fileByFileUserPreference || false, defaultSuggestionCommitMessage: this.defaultSuggestionCommitMessage, mrReviews: this.rehydratedMrReviews, }); @@ -349,11 +350,6 @@ export default { this.setHighlightedRow(id.split('diff-content').pop().slice(1)); } - if (window.gon?.features?.diffsVirtualScrolling) { - diffsEventHub.$on('scrollToFileHash', this.scrollVirtualScrollerToFileHash); - diffsEventHub.$on('scrollToIndex', this.scrollVirtualScrollerToIndex); - } - if (window.gon?.features?.diffSettingsUsageData) { const events = []; @@ -383,6 +379,8 @@ export default { queueRedisHllEvents(events); } + + this.subscribeToVirtualScrollingEvents(); }, beforeCreate() { diffsApp.instrument(); @@ -611,6 +609,21 @@ export default { } } }, + subscribeToVirtualScrollingEvents() { + if ( + window.gon?.features?.diffsVirtualScrolling && + this.shouldShow && + !this.subscribedToVirtualScrollingEvents + ) { + diffsEventHub.$on('scrollToFileHash', this.scrollVirtualScrollerToFileHash); + diffsEventHub.$on('scrollToIndex', this.scrollVirtualScrollerToIndex); + + this.subscribedToVirtualScrollingEvents = true; + } + }, + reloadPage() { + window.location.reload(); + }, }, minTreeWidth: MIN_TREE_WIDTH, maxTreeWidth: MAX_TREE_WIDTH, @@ -629,17 +642,19 @@ export default { :diff-files-count-text="numTotalFiles" /> - <hidden-files-warning - v-if="visibleWarning == $options.alerts.ALERT_OVERFLOW_HIDDEN" - :visible="numVisibleFiles" - :total="numTotalFiles" - :plain-diff-path="plainDiffPath" - :email-patch-path="emailPatchPath" - /> - <collapsed-files-warning - v-if="visibleWarning == $options.alerts.ALERT_COLLAPSED_FILES" - :limited="isLimitedContainer" - /> + <template v-if="!isBatchLoadingError"> + <hidden-files-warning + v-if="visibleWarning == $options.alerts.ALERT_OVERFLOW_HIDDEN" + :visible="numVisibleFiles" + :total="numTotalFiles" + :plain-diff-path="plainDiffPath" + :email-patch-path="emailPatchPath" + /> + <collapsed-files-warning + v-if="visibleWarning == $options.alerts.ALERT_COLLAPSED_FILES" + :limited="isLimitedContainer" + /> + </template> <div :data-can-create-note="getNoteableData.current_user.can_create_note" @@ -648,7 +663,6 @@ export default { <div v-if="renderFileTree" :style="{ width: `${treeWidth}px` }" - :class="{ 'review-bar-visible': draftsCount > 0 }" class="diff-tree-list js-diff-tree-list px-3 pr-md-0" > <panel-resizer @@ -668,11 +682,21 @@ export default { }" > <commit-widget v-if="commit" :commit="commit" :collapsible="false" /> - <div v-if="isBatchLoading" class="loading"><gl-loading-icon size="lg" /></div> + <gl-alert + v-if="isBatchLoadingError" + variant="danger" + :dismissible="false" + :primary-button-text="__('Reload page')" + @primaryAction="reloadPage" + > + {{ __("Error: Couldn't load some or all of the changes.") }} + </gl-alert> + <div v-if="isBatchLoading && !isBatchLoadingError" class="loading"> + <gl-loading-icon size="lg" /> + </div> <template v-else-if="renderDiffFiles"> <dynamic-scroller v-if="isVirtualScrollingEnabled" - ref="virtualScroller" :items="diffs" :min-item-size="70" :buffer="1000" @@ -745,7 +769,10 @@ export default { </div> <gl-loading-icon v-else-if="retrievingBatches" size="lg" /> </template> - <no-changes v-else :changes-empty-state-illustration="changesEmptyStateIllustration" /> + <no-changes + v-else-if="!isBatchLoadingError" + :changes-empty-state-illustration="changesEmptyStateIllustration" + /> </div> </div> <mr-widget-how-to-merge-modal diff --git a/app/assets/javascripts/diffs/components/commit_item.vue b/app/assets/javascripts/diffs/components/commit_item.vue index 820c64a9502..4435a533591 100644 --- a/app/assets/javascripts/diffs/components/commit_item.vue +++ b/app/assets/javascripts/diffs/components/commit_item.vue @@ -1,5 +1,4 @@ <script> -/* eslint-disable vue/no-v-html */ import { GlButtonGroup, GlButton, GlTooltipDirective } from '@gitlab/ui'; import CommitPipelineStatus from '~/projects/tree/components/commit_pipeline_status_component.vue'; @@ -100,7 +99,10 @@ export default { <div class="commit-actions flex-row d-none d-sm-flex align-items-start flex-wrap justify-content-end" > - <div v-if="commit.signature_html" v-html="commit.signature_html"></div> + <div + v-if="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" :endpoint="commit.pipeline_status_path" @@ -142,7 +144,7 @@ export default { <a :href="commit.commit_url" class="commit-row-message item-title" - v-html="commit.title_html" + v-html="commit.title_html /* eslint-disable-line vue/no-v-html */" ></a> <span class="commit-row-message d-block d-sm-none">· {{ commit.short_id }}</span> @@ -174,7 +176,7 @@ export default { v-if="commit.description_html" :class="{ 'js-toggle-content': collapsible, 'd-block': !collapsible }" class="commit-row-description gl-mb-3 gl-text-body" - v-html="commitDescription" + v-html="commitDescription /* eslint-disable-line vue/no-v-html */" ></pre> </div> </li> diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index 933891d698c..d09cc064b2c 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -170,10 +170,7 @@ export default { return !this.isCollapsed && !this.isFileTooLarge; }, showLocalFileReviews() { - const loggedIn = Boolean(gon.current_user_id); - const featureOn = this.glFeatures.localFileReviews; - - return loggedIn && featureOn; + return Boolean(gon.current_user_id); }, codequalityDiffForFile() { return this.codequalityDiff?.files?.[this.file.file_path] || []; diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index 667b8745f7b..4bcb99424db 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -341,7 +341,7 @@ export default { :gfm="gfmCopyText" data-testid="diff-file-copy-clipboard" category="tertiary" - data-track-event="click_copy_file_button" + data-track-action="click_copy_file_button" data-track-label="diff_copy_file_path_button" data-track-property="diff_copy_file" /> @@ -382,7 +382,7 @@ export default { :title="externalUrlLabel" :aria-label="externalUrlLabel" target="_blank" - data-track-event="click_toggle_external_button" + data-track-action="click_toggle_external_button" data-track-label="diff_toggle_external_button" data-track-property="diff_toggle_external" icon="external-link" diff --git a/app/assets/javascripts/diffs/components/diff_row.vue b/app/assets/javascripts/diffs/components/diff_row.vue index db3ad074d2f..737c4d8f33c 100644 --- a/app/assets/javascripts/diffs/components/diff_row.vue +++ b/app/assets/javascripts/diffs/components/diff_row.vue @@ -1,5 +1,4 @@ <script> -/* eslint-disable vue/no-v-html */ import { memoize } from 'lodash'; import { isLoggedIn } from '~/lib/utils/common_utils'; import { @@ -268,7 +267,7 @@ export default { ]" class="diff-td line_content with-coverage left-side" data-testid="left-content" - v-html="$options.lineContent(props.line.left)" + v-html="$options.lineContent(props.line.left) /* eslint-disable-line vue/no-v-html */" ></div> </template> <template @@ -390,7 +389,7 @@ export default { }, ]" class="diff-td line_content with-coverage right-side parallel" - v-html="$options.lineContent(props.line.right)" + v-html="$options.lineContent(props.line.right) /* eslint-disable-line vue/no-v-html */" ></div> </template> <template v-else> diff --git a/app/assets/javascripts/diffs/components/diff_view.vue b/app/assets/javascripts/diffs/components/diff_view.vue index 5cf242b4ddd..64ded1ca8ca 100644 --- a/app/assets/javascripts/diffs/components/diff_view.vue +++ b/app/assets/javascripts/diffs/components/diff_view.vue @@ -133,7 +133,10 @@ export default { <template> <div - :class="[$options.userColorScheme, { inline, 'with-codequality': hasCodequalityChanges }]" + :class="[ + $options.userColorScheme, + { 'inline-diff-view': inline, 'with-codequality': hasCodequalityChanges }, + ]" :data-commit-id="commitId" class="diff-grid diff-table code diff-wrap-lines js-syntax-highlight text-file" @mousedown="handleParallelLineMouseDown" diff --git a/app/assets/javascripts/diffs/components/pre_renderer.vue b/app/assets/javascripts/diffs/components/pre_renderer.vue index c357aa2d924..e4320c40d2c 100644 --- a/app/assets/javascripts/diffs/components/pre_renderer.vue +++ b/app/assets/javascripts/diffs/components/pre_renderer.vue @@ -17,7 +17,6 @@ export default { }, mounted() { this.width = this.$el.parentNode.offsetWidth; - window.test = this; this.$_itemsWithSizeWatcher = this.$watch('vscrollParent.itemsWithSize', async () => { await this.$nextTick(); diff --git a/app/assets/javascripts/diffs/constants.js b/app/assets/javascripts/diffs/constants.js index 8dda5eadb16..93961b07e2e 100644 --- a/app/assets/javascripts/diffs/constants.js +++ b/app/assets/javascripts/diffs/constants.js @@ -72,11 +72,6 @@ export const ALERT_COLLAPSED_FILES = 'collapsed'; export const DIFF_FILE_AUTOMATIC_COLLAPSE = 'automatic'; export const DIFF_FILE_MANUAL_COLLAPSE = 'manual'; -// Diff view single file mode -export const DIFF_FILE_BY_FILE_COOKIE_NAME = 'fileViewMode'; -export const DIFF_VIEW_FILE_BY_FILE = 'single'; -export const DIFF_VIEW_ALL_FILES = 'all'; - // State machine states export const STATE_IDLING = 'idle'; export const STATE_LOADING = 'loading'; diff --git a/app/assets/javascripts/diffs/index.js b/app/assets/javascripts/diffs/index.js index bddc28c4758..1b1ab59b2b4 100644 --- a/app/assets/javascripts/diffs/index.js +++ b/app/assets/javascripts/diffs/index.js @@ -3,7 +3,6 @@ import Vue from 'vue'; import { mapActions, mapState, mapGetters } from 'vuex'; import { parseBoolean } from '~/lib/utils/common_utils'; import { getParameterValues } from '~/lib/utils/url_utility'; -import FindFile from '~/vue_shared/components/file_finder/index.vue'; import eventHub from '../notes/event_hub'; import diffsApp from './components/app.vue'; @@ -12,51 +11,7 @@ import { getReviewsForMergeRequest } from './utils/file_reviews'; import { getDerivedMergeRequestInformation } from './utils/merge_request'; export default function initDiffsApp(store) { - const fileFinderEl = document.getElementById('js-diff-file-finder'); - - if (fileFinderEl) { - // eslint-disable-next-line no-new - new Vue({ - el: fileFinderEl, - store, - computed: { - ...mapState('diffs', ['fileFinderVisible', 'isLoading']), - ...mapGetters('diffs', ['flatBlobsList']), - }, - watch: { - fileFinderVisible(newVal, oldVal) { - if (newVal && !oldVal && !this.flatBlobsList.length) { - eventHub.$emit('fetchDiffData'); - } - }, - }, - methods: { - ...mapActions('diffs', ['toggleFileFinder', 'scrollToFile']), - openFile(file) { - window.mrTabs.tabShown('diffs'); - this.scrollToFile(file.path); - }, - }, - render(createElement) { - return createElement(FindFile, { - props: { - files: this.flatBlobsList, - visible: this.fileFinderVisible, - loading: this.isLoading, - showDiffStats: true, - clearSearchOnClose: false, - }, - on: { - toggle: this.toggleFileFinder, - click: this.openFile, - }, - class: ['diff-file-finder'], - }); - }, - }); - } - - return new Vue({ + const vm = new Vue({ el: '#js-diffs-app', name: 'MergeRequestDiffs', components: { @@ -157,4 +112,53 @@ export default function initDiffsApp(store) { }); }, }); + + const fileFinderEl = document.getElementById('js-diff-file-finder'); + + if (fileFinderEl) { + // eslint-disable-next-line no-new + new Vue({ + el: fileFinderEl, + store, + components: { + FindFile: () => import('~/vue_shared/components/file_finder/index.vue'), + }, + computed: { + ...mapState('diffs', ['fileFinderVisible', 'isLoading']), + ...mapGetters('diffs', ['flatBlobsList']), + }, + watch: { + fileFinderVisible(newVal, oldVal) { + if (newVal && !oldVal && !this.flatBlobsList.length) { + eventHub.$emit('fetchDiffData'); + } + }, + }, + methods: { + ...mapActions('diffs', ['toggleFileFinder', 'scrollToFile']), + openFile(file) { + window.mrTabs.tabShown('diffs'); + this.scrollToFile(file.path); + }, + }, + render(createElement) { + return createElement('find-file', { + props: { + files: this.flatBlobsList, + visible: this.fileFinderVisible, + loading: this.isLoading, + showDiffStats: true, + clearSearchOnClose: false, + }, + on: { + toggle: this.toggleFileFinder, + click: this.openFile, + }, + class: ['diff-file-finder'], + }); + }, + }); + } + + return vm; } diff --git a/app/assets/javascripts/diffs/store/actions.js b/app/assets/javascripts/diffs/store/actions.js index f7bdbe94bac..5c94c6b803b 100644 --- a/app/assets/javascripts/diffs/store/actions.js +++ b/app/assets/javascripts/diffs/store/actions.js @@ -29,9 +29,6 @@ import { EVT_PERF_MARK_FILE_TREE_START, EVT_PERF_MARK_FILE_TREE_END, EVT_PERF_MARK_DIFF_FILES_START, - DIFF_VIEW_FILE_BY_FILE, - DIFF_VIEW_ALL_FILES, - DIFF_FILE_BY_FILE_COOKIE_NAME, TRACKING_CLICK_DIFF_VIEW_SETTING, TRACKING_DIFF_VIEW_INLINE, TRACKING_DIFF_VIEW_PARALLEL, @@ -104,7 +101,7 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { let totalLoaded = 0; let scrolledVirtualScroller = false; - commit(types.SET_BATCH_LOADING, true); + commit(types.SET_BATCH_LOADING_STATE, 'loading'); commit(types.SET_RETRIEVING_BATCHES, true); eventHub.$emit(EVT_PERF_MARK_DIFF_FILES_START); @@ -115,7 +112,7 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { totalLoaded += diff_files.length; commit(types.SET_DIFF_DATA_BATCH, { diff_files }); - commit(types.SET_BATCH_LOADING, false); + commit(types.SET_BATCH_LOADING_STATE, 'loaded'); if (window.gon?.features?.diffsVirtualScrolling && !scrolledVirtualScroller) { const index = state.diffFiles.findIndex( @@ -130,7 +127,7 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { } if (!isNoteLink && !state.currentDiffFileId) { - commit(types.VIEW_DIFF_FILE, diff_files[0].file_hash); + commit(types.VIEW_DIFF_FILE, diff_files[0]?.file_hash); } if (isNoteLink) { @@ -182,11 +179,14 @@ export const fetchDiffFilesBatch = ({ commit, state, dispatch }) => { return null; }) - .catch(() => commit(types.SET_RETRIEVING_BATCHES, false)); + .catch(() => { + commit(types.SET_RETRIEVING_BATCHES, false); + commit(types.SET_BATCH_LOADING_STATE, 'error'); + }); - return getBatch() - .then(() => !window.gon?.features?.diffsVirtualScrolling && handleLocationHash()) - .catch(() => null); + return getBatch().then( + () => !window.gon?.features?.diffsVirtualScrolling && handleLocationHash(), + ); }; export const fetchDiffFilesMeta = ({ commit, state }) => { @@ -816,9 +816,7 @@ export const navigateToDiffFileIndex = ({ commit, state }, index) => { }; export const setFileByFile = ({ state, commit }, { fileByFile }) => { - const fileViewMode = fileByFile ? DIFF_VIEW_FILE_BY_FILE : DIFF_VIEW_ALL_FILES; commit(types.SET_FILE_BY_FILE, fileByFile); - Cookies.set(DIFF_FILE_BY_FILE_COOKIE_NAME, fileViewMode); if (window.gon?.features?.diffSettingsUsageData) { const events = [TRACKING_CLICK_SINGLE_FILE_SETTING]; diff --git a/app/assets/javascripts/diffs/store/getters.js b/app/assets/javascripts/diffs/store/getters.js index 18bd8e5f1d8..ca85be5d829 100644 --- a/app/assets/javascripts/diffs/store/getters.js +++ b/app/assets/javascripts/diffs/store/getters.js @@ -191,3 +191,6 @@ export const isVirtualScrollingEnabled = (state) => { getParameterValues('virtual_scrolling')[0] === 'true') ); }; + +export const isBatchLoading = (state) => state.batchLoadingState === 'loading'; +export const isBatchLoadingError = (state) => state.batchLoadingState === 'error'; diff --git a/app/assets/javascripts/diffs/store/modules/diff_state.js b/app/assets/javascripts/diffs/store/modules/diff_state.js index d76361513d4..a5b1a577a78 100644 --- a/app/assets/javascripts/diffs/store/modules/diff_state.js +++ b/app/assets/javascripts/diffs/store/modules/diff_state.js @@ -2,8 +2,6 @@ import Cookies from 'js-cookie'; import { getParameterValues } from '~/lib/utils/url_utility'; import { INLINE_DIFF_VIEW_TYPE, DIFF_VIEW_COOKIE_NAME } from '../../constants'; -import { fileByFile } from '../../utils/preferences'; - const getViewTypeFromQueryString = () => getParameterValues('view')[0]; const viewTypeFromCookie = Cookies.get(DIFF_VIEW_COOKIE_NAME); @@ -12,7 +10,7 @@ const defaultViewType = INLINE_DIFF_VIEW_TYPE; export default () => ({ isLoading: true, isTreeLoaded: false, - isBatchLoading: false, + batchLoadingState: null, retrievingBatches: false, addedLines: null, removedLines: null, @@ -36,7 +34,7 @@ export default () => ({ highlightedRow: null, renderTreeList: true, showWhitespace: true, - viewDiffsFileByFile: fileByFile(), + viewDiffsFileByFile: false, fileFinderVisible: false, dismissEndpoint: '', showSuggestPopover: true, diff --git a/app/assets/javascripts/diffs/store/mutation_types.js b/app/assets/javascripts/diffs/store/mutation_types.js index 2c370221f40..60836f747f5 100644 --- a/app/assets/javascripts/diffs/store/mutation_types.js +++ b/app/assets/javascripts/diffs/store/mutation_types.js @@ -1,6 +1,6 @@ export const SET_BASE_CONFIG = 'SET_BASE_CONFIG'; export const SET_LOADING = 'SET_LOADING'; -export const SET_BATCH_LOADING = 'SET_BATCH_LOADING'; +export const SET_BATCH_LOADING_STATE = 'SET_BATCH_LOADING_STATE'; export const SET_RETRIEVING_BATCHES = 'SET_RETRIEVING_BATCHES'; export const SET_DIFF_METADATA = 'SET_DIFF_METADATA'; diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js index 1aa83453bf7..6bc927b9d1f 100644 --- a/app/assets/javascripts/diffs/store/mutations.js +++ b/app/assets/javascripts/diffs/store/mutations.js @@ -60,8 +60,8 @@ export default { Object.assign(state, { isLoading }); }, - [types.SET_BATCH_LOADING](state, isBatchLoading) { - Object.assign(state, { isBatchLoading }); + [types.SET_BATCH_LOADING_STATE](state, batchLoadingState) { + Object.assign(state, { batchLoadingState }); }, [types.SET_RETRIEVING_BATCHES](state, retrievingBatches) { diff --git a/app/assets/javascripts/diffs/utils/preferences.js b/app/assets/javascripts/diffs/utils/preferences.js deleted file mode 100644 index 6b4aaf45937..00000000000 --- a/app/assets/javascripts/diffs/utils/preferences.js +++ /dev/null @@ -1,13 +0,0 @@ -import Cookies from 'js-cookie'; -import { DIFF_FILE_BY_FILE_COOKIE_NAME, DIFF_VIEW_FILE_BY_FILE } from '../constants'; - -export function fileByFile(pref = false) { - const cookie = Cookies.get(DIFF_FILE_BY_FILE_COOKIE_NAME); - - // use the cookie first, if it exists - if (cookie) { - return cookie === DIFF_VIEW_FILE_BY_FILE; - } - - return pref; -} |