Skip to content

Commit e09e832

Browse files
author
GitLab Bot
committed
Add latest changes from gitlab-org/gitlab@master
1 parent 0fc7ea6 commit e09e832

File tree

89 files changed

+520
-2642
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

89 files changed

+520
-2642
lines changed

GITALY_SERVER_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
6bd8110489a44adeacff1897a757d8ea52bf4f87
1+
ee1bf60a8952f6e9b4f3bf7627ac671ef1427cad

GITLAB_SHELL_VERSION

+1-1
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
14.40.0
1+
14.41.0

app/assets/javascripts/diffs/components/app.vue

+15-16
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { GlBreakpointInstance as bp } from '@gitlab/ui/dist/utils';
44
import { debounce, throttle } from 'lodash';
55
// eslint-disable-next-line no-restricted-imports
66
import { mapState, mapGetters, mapActions } from 'vuex';
7+
import { mapState as mapPiniaState, mapActions as mapPiniaActions } from 'pinia';
78
import FindingsDrawer from 'ee_component/diffs/components/shared/findings_drawer.vue';
89
import glFeatureFlagsMixin from '~/vue_shared/mixins/gl_feature_flags_mixin';
910
import { convertToGraphQLId } from '~/graphql_shared/utils';
@@ -18,7 +19,7 @@ import {
1819
import { createAlert } from '~/alert';
1920
import { InternalEvents } from '~/tracking';
2021
import { helpPagePath } from '~/helpers/help_page_helper';
21-
import { parseBoolean, handleLocationHash } from '~/lib/utils/common_utils';
22+
import { parseBoolean, handleLocationHash, getCookie } from '~/lib/utils/common_utils';
2223
import { BV_HIDE_TOOLTIP, DEFAULT_DEBOUNCE_AND_THROTTLE_MS } from '~/lib/utils/constants';
2324
import { Mousetrap } from '~/lib/mousetrap';
2425
import { updateHistory, getLocationHash } from '~/lib/utils/url_utility';
@@ -27,9 +28,9 @@ import { __ } from '~/locale';
2728
import notesEventHub from '~/notes/event_hub';
2829
import { DynamicScroller, DynamicScrollerItem } from 'vendor/vue-virtual-scroller';
2930
import getMRCodequalityAndSecurityReports from 'ee_else_ce/diffs/components/graphql/get_mr_codequality_and_security_reports.query.graphql';
31+
import { useFileBrowser } from '~/diffs/stores/file_browser';
3032
import { sortFindingsByFile } from '../utils/sort_findings_by_file';
3133
import {
32-
MR_TREE_SHOW_KEY,
3334
ALERT_OVERFLOW_HIDDEN,
3435
ALERT_MERGE_CONFLICT,
3536
ALERT_COLLAPSED_FILES,
@@ -44,6 +45,7 @@ import {
4445
TRACKING_MULTIPLE_FILES_MODE,
4546
EVT_MR_PREPARED,
4647
EVT_DISCUSSIONS_ASSIGNED,
48+
FILE_BROWSER_VISIBLE,
4749
} from '../constants';
4850
4951
import { isCollapsed } from '../utils/diff_file';
@@ -243,7 +245,6 @@ export default {
243245
'showWhitespace',
244246
'targetBranchName',
245247
'branchName',
246-
'showTreeList',
247248
'addedLines',
248249
'removedLines',
249250
]),
@@ -259,6 +260,7 @@ export default {
259260
]),
260261
...mapGetters(['isNotesFetched', 'getNoteableData']),
261262
...mapGetters('findingsDrawer', ['activeDrawer']),
263+
...mapPiniaState(useFileBrowser, ['fileBrowserVisible']),
262264
diffs() {
263265
if (!this.viewDiffsFileByFile) {
264266
return this.diffFiles;
@@ -316,7 +318,7 @@ export default {
316318
return convertToGraphQLId('MergeRequest', this.getNoteableData.id);
317319
},
318320
renderFileTree() {
319-
return this.renderDiffFiles && this.showTreeList;
321+
return this.renderDiffFiles && this.fileBrowserVisible;
320322
},
321323
hideTooltips() {
322324
const hide = () => {
@@ -455,19 +457,18 @@ export default {
455457
'setCurrentFileHash',
456458
'setHighlightedRow',
457459
'goToFile',
458-
'setShowTreeList',
459460
'navigateToDiffFileIndex',
460461
'setFileByFile',
461462
'disableVirtualScroller',
462463
'fetchLinkedFile',
463-
'toggleTreeList',
464464
'expandAllFiles',
465465
'collapseAllFiles',
466466
'setDiffViewType',
467467
'setShowWhitespace',
468468
'goToFile',
469469
]),
470470
...mapActions('findingsDrawer', ['setDrawer']),
471+
...mapPiniaActions(useFileBrowser, ['setFileBrowserVisibility', 'toggleFileBrowserVisibility']),
471472
closeDrawer() {
472473
this.setDrawer({});
473474
},
@@ -684,16 +685,14 @@ export default {
684685
}
685686
},
686687
setTreeDisplay() {
687-
const storedTreeShow = localStorage.getItem(MR_TREE_SHOW_KEY);
688-
let showTreeList = true;
689-
690-
if (storedTreeShow !== null) {
691-
showTreeList = parseBoolean(storedTreeShow);
692-
} else if (!bp.isDesktop() || (!this.isBatchLoading && this.flatBlobsList.length <= 1)) {
693-
showTreeList = false;
688+
const hideBrowserPreference = getCookie(FILE_BROWSER_VISIBLE);
689+
if (hideBrowserPreference) {
690+
this.setFileBrowserVisibility(parseBoolean(hideBrowserPreference));
691+
} else {
692+
const shouldHide =
693+
!bp.isDesktop() || (!this.isBatchLoading && this.flatBlobsList.length <= 1);
694+
this.setFileBrowserVisibility(!shouldHide);
694695
}
695-
696-
return this.setShowTreeList({ showTreeList, saving: false });
697696
},
698697
async scrollVirtualScrollerToFileHash(hash) {
699698
const index = this.diffFiles.findIndex((f) => f.file_hash === hash);
@@ -741,7 +740,7 @@ export default {
741740
}
742741
},
743742
fileTreeToggled() {
744-
this.toggleTreeList();
743+
this.toggleFileBrowserVisibility();
745744
this.adjustView();
746745
},
747746
isDiffViewActive(item) {

app/assets/javascripts/diffs/components/compare_versions.vue

+9-6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from '@gitlab/ui';
1111
// eslint-disable-next-line no-restricted-imports
1212
import { mapActions, mapGetters, mapState } from 'vuex';
13+
import { mapActions as mapPiniaActions, mapState as mapPiniaState } from 'pinia';
1314
import { __ } from '~/locale';
1415
import { setUrlParams } from '~/lib/utils/url_utility';
1516
import {
@@ -20,6 +21,7 @@ import {
2021
} from '~/behaviors/shortcuts/keybindings';
2122
import { shouldDisableShortcuts } from '~/behaviors/shortcuts/shortcuts_toggle';
2223
import { sanitize } from '~/lib/dompurify';
24+
import { useFileBrowser } from '~/diffs/stores/file_browser';
2325
import CompareDropdownLayout from './compare_dropdown_layout.vue';
2426
2527
export default {
@@ -47,12 +49,13 @@ export default {
4749
'diffCompareDropdownTargetVersions',
4850
'diffCompareDropdownSourceVersions',
4951
]),
50-
...mapState('diffs', ['commit', 'showTreeList', 'startVersion', 'latestVersionPath']),
52+
...mapState('diffs', ['commit', 'startVersion', 'latestVersionPath']),
53+
...mapPiniaState(useFileBrowser, ['fileBrowserVisible']),
5154
toggleFileBrowserShortcutKey() {
5255
return shouldDisableShortcuts() ? null : keysFor(MR_TOGGLE_FILE_BROWSER)[0];
5356
},
5457
toggleFileBrowserTitle() {
55-
return this.showTreeList ? __('Hide file browser') : __('Show file browser');
58+
return this.fileBrowserVisible ? __('Hide file browser') : __('Show file browser');
5659
},
5760
toggleFileBrowserTooltip() {
5861
const description = this.toggleFileBrowserTitle;
@@ -113,7 +116,7 @@ export default {
113116
},
114117
},
115118
methods: {
116-
...mapActions('diffs', ['setShowTreeList']),
119+
...mapPiniaActions(useFileBrowser, ['toggleFileBrowserVisibility']),
117120
...mapActions('diffs', ['moveToNeighboringCommit']),
118121
},
119122
};
@@ -130,10 +133,10 @@ export default {
130133
data-testid="file-tree-button"
131134
:aria-label="toggleFileBrowserTitle"
132135
:aria-keyshortcuts="toggleFileBrowserShortcutKey"
133-
:selected="showTreeList"
134-
@click="setShowTreeList({ showTreeList: !showTreeList })"
136+
:selected="fileBrowserVisible"
137+
@click="toggleFileBrowserVisibility"
135138
>
136-
<gl-animated-sidebar-icon :is-on="showTreeList" />
139+
<gl-animated-sidebar-icon :is-on="fileBrowserVisible" />
137140
</gl-button>
138141
<div v-if="commit">
139142
{{ __('Viewing commit') }}

app/assets/javascripts/diffs/constants.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ export const LENGTH_OF_AVATAR_TOOLTIP = 17;
2828
export const DIFF_FILE_SYMLINK_MODE = '120000';
2929
export const DIFF_FILE_DELETED_MODE = '0';
3030

31-
export const MR_TREE_SHOW_KEY = 'mr_tree_show';
31+
export const FILE_BROWSER_VISIBLE = 'file_browser_visible';
3232

3333
export const TREE_TYPE = 'tree';
3434
export const TREE_LIST_STORAGE_KEY = 'mr_diff_tree_list';

app/assets/javascripts/diffs/store/actions.js

-13
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ import {
2929
import {
3030
INLINE_DIFF_VIEW_TYPE,
3131
DIFF_VIEW_COOKIE_NAME,
32-
MR_TREE_SHOW_KEY,
3332
TREE_LIST_STORAGE_KEY,
3433
OLD_LINE_KEY,
3534
NEW_LINE_KEY,
@@ -718,18 +717,6 @@ export const scrollToFile = ({ state, commit, getters }, { path }) => {
718717
}
719718
};
720719

721-
export const setShowTreeList = ({ commit }, { showTreeList, saving = true }) => {
722-
commit(types.SET_SHOW_TREE_LIST, showTreeList);
723-
724-
if (saving) {
725-
localStorage.setItem(MR_TREE_SHOW_KEY, showTreeList);
726-
}
727-
};
728-
729-
export const toggleTreeList = ({ state, commit }) => {
730-
commit(types.SET_SHOW_TREE_LIST, !state.showTreeList);
731-
};
732-
733720
export const openDiffFileCommentForm = ({ commit, getters }, formData) => {
734721
const form = getters.getCommentFormForDiffFile(formData.fileHash);
735722

app/assets/javascripts/diffs/store/modules/diff_state.js

-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ export default () => ({
2525
diffViewType: INLINE_DIFF_VIEW_TYPE,
2626
tree: [],
2727
treeEntries: {},
28-
showTreeList: true,
2928
currentDiffFileId: '',
3029
projectPath: '',
3130
viewedDiffFileIds: {},

app/assets/javascripts/diffs/store/mutation_types.js

-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ export const REMOVE_LINE_DISCUSSIONS_FOR_FILE = 'REMOVE_LINE_DISCUSSIONS_FOR_FIL
2323
export const TOGGLE_FOLDER_OPEN = 'TOGGLE_FOLDER_OPEN';
2424
export const SET_FOLDER_OPEN = 'SET_FOLDER_OPEN';
2525
export const TREE_ENTRY_DIFF_LOADING = 'TREE_ENTRY_DIFF_LOADING';
26-
export const SET_SHOW_TREE_LIST = 'SET_SHOW_TREE_LIST';
2726
export const SET_CURRENT_DIFF_FILE = 'SET_CURRENT_DIFF_FILE';
2827
export const SET_DIFF_FILE_VIEWED = 'SET_DIFF_FILE_VIEWED';
2928
export const SET_LINKED_FILE_HASH = 'SET_LINKED_FILE_HASH';

app/assets/javascripts/diffs/store/mutations.js

-3
Original file line numberDiff line numberDiff line change
@@ -297,9 +297,6 @@ export default {
297297
[types.TREE_ENTRY_DIFF_LOADING](state, { path, loading = true }) {
298298
state.treeEntries[path].diffLoading = loading;
299299
},
300-
[types.SET_SHOW_TREE_LIST](state, showTreeList) {
301-
state.showTreeList = showTreeList;
302-
},
303300
[types.SET_CURRENT_DIFF_FILE](state, fileId) {
304301
state.currentDiffFileId = fileId;
305302
},
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import { defineStore } from 'pinia';
2+
import { getCookie, parseBoolean, setCookie } from '~/lib/utils/common_utils';
3+
import { FILE_BROWSER_VISIBLE } from '~/diffs/constants';
4+
5+
export const useFileBrowser = defineStore('fileBrowser', {
6+
state() {
7+
return {
8+
fileBrowserVisible: true,
9+
};
10+
},
11+
actions: {
12+
setFileBrowserVisibility(visible) {
13+
this.fileBrowserVisible = visible;
14+
},
15+
toggleFileBrowserVisibility() {
16+
this.fileBrowserVisible = !this.fileBrowserVisible;
17+
setCookie(FILE_BROWSER_VISIBLE, this.fileBrowserVisible);
18+
},
19+
initFileBrowserVisibility() {
20+
const visibilityPreference = getCookie(FILE_BROWSER_VISIBLE);
21+
if (visibilityPreference) {
22+
this.fileBrowserVisible = parseBoolean(visibilityPreference);
23+
}
24+
},
25+
},
26+
});

app/assets/javascripts/diffs/stores/legacy_diffs/actions.js

-13
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import { useNotes } from '~/notes/store/legacy_notes';
3030
import {
3131
INLINE_DIFF_VIEW_TYPE,
3232
DIFF_VIEW_COOKIE_NAME,
33-
MR_TREE_SHOW_KEY,
3433
TREE_LIST_STORAGE_KEY,
3534
OLD_LINE_KEY,
3635
NEW_LINE_KEY,
@@ -718,18 +717,6 @@ export function scrollToFile({ path }) {
718717
}
719718
}
720719

721-
export function setShowTreeList({ showTreeList, saving = true }) {
722-
this[types.SET_SHOW_TREE_LIST](showTreeList);
723-
724-
if (saving) {
725-
localStorage.setItem(MR_TREE_SHOW_KEY, showTreeList);
726-
}
727-
}
728-
729-
export function toggleTreeList() {
730-
this[types.SET_SHOW_TREE_LIST](!this.showTreeList);
731-
}
732-
733720
export function openDiffFileCommentForm(formData) {
734721
const form = this.getCommentFormForDiffFile(formData.fileHash);
735722

app/assets/javascripts/diffs/stores/legacy_diffs/index.js

-1
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ export const useLegacyDiffs = defineStore('legacyDiffs', {
3636
diffViewType: INLINE_DIFF_VIEW_TYPE,
3737
tree: [],
3838
treeEntries: {},
39-
showTreeList: true,
4039
currentDiffFileId: '',
4140
projectPath: '',
4241
viewedDiffFileIds: {},

app/assets/javascripts/diffs/stores/legacy_diffs/mutations.js

-3
Original file line numberDiff line numberDiff line change
@@ -293,9 +293,6 @@ export default {
293293
[types.TREE_ENTRY_DIFF_LOADING]({ path, loading = true }) {
294294
this.treeEntries[path].diffLoading = loading;
295295
},
296-
[types.SET_SHOW_TREE_LIST](showTreeList) {
297-
this.showTreeList = showTreeList;
298-
},
299296
[types.SET_CURRENT_DIFF_FILE](fileId) {
300297
this.currentDiffFileId = fileId;
301298
},
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1-
import { initShow } from '~/issues';
1+
import { issuableInitialDataById, isLegacyIssueType } from '~/issues/show/utils/issuable_data';
22

3-
initShow();
3+
const initLegacyIssuePage = async () => {
4+
const [{ initShow }] = await Promise.all([import('~/issues')]);
5+
initShow();
6+
};
7+
8+
const initWorkItemPage = async () => {
9+
const [{ initWorkItemsRoot }] = await Promise.all([import('~/work_items')]);
10+
11+
initWorkItemsRoot({ workItemType: 'issue' });
12+
};
13+
14+
const issuableData = issuableInitialDataById('js-issuable-app');
15+
16+
if (
17+
!isLegacyIssueType(issuableData) &&
18+
gon.features.workItemsViewPreference &&
19+
gon.current_user_use_work_items_view
20+
) {
21+
initWorkItemPage();
22+
} else {
23+
initLegacyIssuePage();
24+
}

app/assets/javascripts/rapid_diffs/app/index.js

+2
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { DiffFile } from '~/rapid_diffs/diff_file';
44
import { DiffFileMounted } from '~/rapid_diffs/diff_file_mounted';
55
import { useDiffsList } from '~/rapid_diffs/stores/diffs_list';
66
import { initFileBrowser } from '~/rapid_diffs/app/init_file_browser';
7+
import { StreamingError } from '~/rapid_diffs/streaming_error';
78

89
// This facade interface joins together all the bits and pieces of Rapid Diffs: DiffFile, Settings, File browser, etc.
910
// It's a unified entrypoint for Rapid Diffs and all external communications should happen through this interface.
@@ -30,6 +31,7 @@ class RapidDiffsFacade {
3031
#registerCustomElements() {
3132
customElements.define('diff-file', this.DiffFileImplementation);
3233
customElements.define('diff-file-mounted', DiffFileMounted);
34+
customElements.define('streaming-error', StreamingError);
3335
}
3436
}
3537

Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { createAlert } from '~/alert';
2+
import { __ } from '~/locale';
3+
4+
export class StreamingError extends HTMLElement {
5+
connectedCallback() {
6+
const message = __(`Could not fetch all changes. Try reloading the page.`);
7+
// eslint-disable-next-line no-console
8+
console.error(`Failed to stream diffs: ${this.getAttribute('message')}`);
9+
createAlert({ message });
10+
}
11+
}

0 commit comments

Comments
 (0)