diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 09:09:06 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-18 09:09:06 +0300 |
commit | cefe554b7ce2d0b52f9de855be832a47c2bc24ab (patch) | |
tree | 74c1ad2f688afd2f806aaf94e73e0bcd128cea00 /app/assets/javascripts/ide | |
parent | 5ee120f46740efac7b8a460d7a92e4da82f4fb0b (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/ide')
11 files changed, 41 insertions, 39 deletions
diff --git a/app/assets/javascripts/ide/components/activity_bar.vue b/app/assets/javascripts/ide/components/activity_bar.vue index 7b4e03be8eb..186d4b6d7d2 100644 --- a/app/assets/javascripts/ide/components/activity_bar.vue +++ b/app/assets/javascripts/ide/components/activity_bar.vue @@ -3,7 +3,7 @@ import $ from 'jquery'; import { mapActions, mapGetters, mapState } from 'vuex'; import Icon from '~/vue_shared/components/icon.vue'; import tooltip from '~/vue_shared/directives/tooltip'; -import { activityBarViews } from '../constants'; +import { leftSidebarViews } from '../constants'; export default { components: { @@ -26,7 +26,7 @@ export default { $(e.currentTarget).tooltip('hide'); }, }, - activityBarViews, + leftSidebarViews, }; </script> @@ -37,7 +37,7 @@ export default { <button v-tooltip :class="{ - active: currentActivityView === $options.activityBarViews.edit, + active: currentActivityView === $options.leftSidebarViews.edit.name, }" :title="s__('IDE|Edit')" :aria-label="s__('IDE|Edit')" @@ -45,7 +45,7 @@ export default { data-placement="right" type="button" class="ide-sidebar-link js-ide-edit-mode" - @click.prevent="changedActivityView($event, $options.activityBarViews.edit)" + @click.prevent="changedActivityView($event, $options.leftSidebarViews.edit.name)" > <icon name="code" /> </button> @@ -54,7 +54,7 @@ export default { <button v-tooltip :class="{ - active: currentActivityView === $options.activityBarViews.review, + active: currentActivityView === $options.leftSidebarViews.review.name, }" :title="s__('IDE|Review')" :aria-label="s__('IDE|Review')" @@ -62,7 +62,7 @@ export default { data-placement="right" type="button" class="ide-sidebar-link js-ide-review-mode" - @click.prevent="changedActivityView($event, $options.activityBarViews.review)" + @click.prevent="changedActivityView($event, $options.leftSidebarViews.review.name)" > <icon name="file-modified" /> </button> @@ -71,7 +71,7 @@ export default { <button v-tooltip :class="{ - active: currentActivityView === $options.activityBarViews.commit, + active: currentActivityView === $options.leftSidebarViews.commit.name, }" :title="s__('IDE|Commit')" :aria-label="s__('IDE|Commit')" @@ -79,7 +79,7 @@ export default { data-placement="right" type="button" class="ide-sidebar-link js-ide-commit-mode qa-commit-mode-tab" - @click.prevent="changedActivityView($event, $options.activityBarViews.commit)" + @click.prevent="changedActivityView($event, $options.leftSidebarViews.commit.name)" > <icon name="commit" /> </button> diff --git a/app/assets/javascripts/ide/components/commit_sidebar/form.vue b/app/assets/javascripts/ide/components/commit_sidebar/form.vue index 9777f365557..5ec3fc4041b 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/form.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/form.vue @@ -5,7 +5,7 @@ import LoadingButton from '~/vue_shared/components/loading_button.vue'; import CommitMessageField from './message_field.vue'; import Actions from './actions.vue'; import SuccessMessage from './success_message.vue'; -import { activityBarViews, MAX_WINDOW_HEIGHT_COMPACT } from '../../constants'; +import { leftSidebarViews, MAX_WINDOW_HEIGHT_COMPACT } from '../../constants'; export default { components: { @@ -41,7 +41,7 @@ export default { }, currentViewIsCommitView() { - return this.currentActivityView === activityBarViews.commit; + return this.currentActivityView === leftSidebarViews.commit.name; }, }, watch: { @@ -57,7 +57,7 @@ export default { lastCommitMsg() { this.isCompact = - this.currentActivityView !== activityBarViews.commit && this.lastCommitMsg === ''; + this.currentActivityView !== leftSidebarViews.commit.name && this.lastCommitMsg === ''; }, }, methods: { @@ -67,7 +67,7 @@ export default { if (this.currentViewIsCommitView) { this.isCompact = !this.isCompact; } else { - this.updateActivityBarView(activityBarViews.commit) + this.updateActivityBarView(leftSidebarViews.commit.name) .then(() => { this.isCompact = false; }) diff --git a/app/assets/javascripts/ide/components/ide_side_bar.vue b/app/assets/javascripts/ide/components/ide_side_bar.vue index 6178d2b1fc7..40cd2178e09 100644 --- a/app/assets/javascripts/ide/components/ide_side_bar.vue +++ b/app/assets/javascripts/ide/components/ide_side_bar.vue @@ -4,19 +4,19 @@ import { GlSkeletonLoading } from '@gitlab/ui'; import IdeTree from './ide_tree.vue'; import ResizablePanel from './resizable_panel.vue'; import ActivityBar from './activity_bar.vue'; -import CommitSection from './repo_commit_section.vue'; +import RepoCommitSection from './repo_commit_section.vue'; import CommitForm from './commit_sidebar/form.vue'; import IdeReview from './ide_review.vue'; import SuccessMessage from './commit_sidebar/success_message.vue'; import IdeProjectHeader from './ide_project_header.vue'; -import { activityBarViews } from '../constants'; +import { leftSidebarViews } from '../constants'; export default { components: { GlSkeletonLoading, ResizablePanel, ActivityBar, - CommitSection, + RepoCommitSection, IdeTree, CommitForm, IdeReview, @@ -28,7 +28,7 @@ export default { ...mapGetters(['currentProject', 'someUncommittedChanges']), showSuccessMessage() { return ( - this.currentActivityView === activityBarViews.edit && + this.currentActivityView === leftSidebarViews.edit.name && (this.lastCommitMsg && !this.someUncommittedChanges) ); }, diff --git a/app/assets/javascripts/ide/components/repo_commit_section.vue b/app/assets/javascripts/ide/components/repo_commit_section.vue index b3a7597e7bb..62fb0b03975 100644 --- a/app/assets/javascripts/ide/components/repo_commit_section.vue +++ b/app/assets/javascripts/ide/components/repo_commit_section.vue @@ -5,7 +5,7 @@ import DeprecatedModal from '~/vue_shared/components/deprecated_modal.vue'; import CommitFilesList from './commit_sidebar/list.vue'; import EmptyState from './commit_sidebar/empty_state.vue'; import consts from '../stores/modules/commit/constants'; -import { activityBarViews, stageKeys } from '../constants'; +import { leftSidebarViews, stageKeys } from '../constants'; export default { components: { @@ -37,7 +37,7 @@ export default { watch: { hasChanges() { if (!this.hasChanges) { - this.updateActivityBarView(activityBarViews.edit); + this.updateActivityBarView(leftSidebarViews.edit.name); } }, }, diff --git a/app/assets/javascripts/ide/components/repo_editor.vue b/app/assets/javascripts/ide/components/repo_editor.vue index 8af34dcb5cc..bfb760f3579 100644 --- a/app/assets/javascripts/ide/components/repo_editor.vue +++ b/app/assets/javascripts/ide/components/repo_editor.vue @@ -5,7 +5,7 @@ import flash from '~/flash'; import ContentViewer from '~/vue_shared/components/content_viewer/content_viewer.vue'; import DiffViewer from '~/vue_shared/components/diff_viewer/diff_viewer.vue'; import { - activityBarViews, + leftSidebarViews, viewerTypes, FILE_VIEW_MODE_EDITOR, FILE_VIEW_MODE_PREVIEW, @@ -100,7 +100,7 @@ export default { if (oldVal.key !== this.file.key) { this.initEditor(); - if (this.currentActivityView !== activityBarViews.edit) { + if (this.currentActivityView !== leftSidebarViews.edit.name) { this.setFileViewMode({ file: this.file, viewMode: FILE_VIEW_MODE_EDITOR, @@ -109,7 +109,7 @@ export default { } }, currentActivityView() { - if (this.currentActivityView !== activityBarViews.edit) { + if (this.currentActivityView !== leftSidebarViews.edit.name) { this.setFileViewMode({ file: this.file, viewMode: FILE_VIEW_MODE_EDITOR, diff --git a/app/assets/javascripts/ide/constants.js b/app/assets/javascripts/ide/constants.js index 54d3e79411f..e7762f9e0f2 100644 --- a/app/assets/javascripts/ide/constants.js +++ b/app/assets/javascripts/ide/constants.js @@ -11,12 +11,6 @@ export const FILE_VIEW_MODE_PREVIEW = 'preview'; export const PERMISSION_CREATE_MR = 'createMergeRequestIn'; export const PERMISSION_READ_MR = 'readMergeRequest'; -export const activityBarViews = { - edit: 'ide-tree', - commit: 'commit-section', - review: 'ide-review', -}; - export const viewerTypes = { mr: 'mrdiff', edit: 'editor', @@ -47,6 +41,12 @@ export const diffViewerErrors = Object.freeze({ stored_externally: 'server_side_but_stored_externally', }); +export const leftSidebarViews = { + edit: { name: 'ide-tree', keepAlive: false }, + review: { name: 'ide-review', keepAlive: false }, + commit: { name: 'repo-commit-section', keepAlive: false }, +}; + export const rightSidebarViews = { pipelines: { name: 'pipelines-list', keepAlive: true }, jobsDetail: { name: 'jobs-detail', keepAlive: false }, diff --git a/app/assets/javascripts/ide/stores/actions/merge_request.js b/app/assets/javascripts/ide/stores/actions/merge_request.js index 9e9c6fc42b3..fcaf060ef09 100644 --- a/app/assets/javascripts/ide/stores/actions/merge_request.js +++ b/app/assets/javascripts/ide/stores/actions/merge_request.js @@ -2,7 +2,7 @@ import flash from '~/flash'; import { __ } from '~/locale'; import service from '../../services'; import * as types from '../mutation_types'; -import { activityBarViews, PERMISSION_READ_MR } from '../../constants'; +import { leftSidebarViews, PERMISSION_READ_MR } from '../../constants'; export const getMergeRequestsForBranch = ( { commit, state, getters }, @@ -187,7 +187,7 @@ export const openMergeRequest = ( ) .then(mrChanges => { if (mrChanges.changes.length) { - dispatch('updateActivityBarView', activityBarViews.review); + dispatch('updateActivityBarView', leftSidebarViews.review.name); } mrChanges.changes.forEach((change, ind) => { diff --git a/app/assets/javascripts/ide/stores/getters.js b/app/assets/javascripts/ide/stores/getters.js index 257062d118c..d7ad39019a5 100644 --- a/app/assets/javascripts/ide/stores/getters.js +++ b/app/assets/javascripts/ide/stores/getters.js @@ -1,6 +1,6 @@ import { getChangesCountForFiles, filePathMatches } from './utils'; import { - activityBarViews, + leftSidebarViews, packageJsonPath, PERMISSION_READ_MR, PERMISSION_CREATE_MR, @@ -74,9 +74,11 @@ export const getOpenFile = state => path => state.openFiles.find(f => f.path === export const lastOpenedFile = state => [...state.changedFiles, ...state.stagedFiles].sort((a, b) => b.lastOpenedAt - a.lastOpenedAt)[0]; -export const isEditModeActive = state => state.currentActivityView === activityBarViews.edit; -export const isCommitModeActive = state => state.currentActivityView === activityBarViews.commit; -export const isReviewModeActive = state => state.currentActivityView === activityBarViews.review; +export const isEditModeActive = state => state.currentActivityView === leftSidebarViews.edit.name; +export const isCommitModeActive = state => + state.currentActivityView === leftSidebarViews.commit.name; +export const isReviewModeActive = state => + state.currentActivityView === leftSidebarViews.review.name; export const someUncommittedChanges = state => Boolean(state.changedFiles.length || state.stagedFiles.length); diff --git a/app/assets/javascripts/ide/stores/modules/commit/actions.js b/app/assets/javascripts/ide/stores/modules/commit/actions.js index 3be350db3da..9bf0542cd0b 100644 --- a/app/assets/javascripts/ide/stores/modules/commit/actions.js +++ b/app/assets/javascripts/ide/stores/modules/commit/actions.js @@ -7,7 +7,7 @@ import router from '../../../ide_router'; import service from '../../../services'; import * as types from './mutation_types'; import consts from './constants'; -import { activityBarViews } from '../../../constants'; +import { leftSidebarViews } from '../../../constants'; import eventHub from '../../../eventhub'; export const updateCommitMessage = ({ commit }, message) => { @@ -189,7 +189,7 @@ export const commitChanges = ({ commit, state, getters, dispatch, rootState, roo throw e; }); } else { - dispatch('updateActivityBarView', activityBarViews.edit, { root: true }); + dispatch('updateActivityBarView', leftSidebarViews.edit.name, { root: true }); dispatch('updateViewer', 'editor', { root: true }); if (rootGetters.activeFile) { diff --git a/app/assets/javascripts/ide/stores/modules/file_templates/getters.js b/app/assets/javascripts/ide/stores/modules/file_templates/getters.js index f10891a8e5b..453df8d7e0c 100644 --- a/app/assets/javascripts/ide/stores/modules/file_templates/getters.js +++ b/app/assets/javascripts/ide/stores/modules/file_templates/getters.js @@ -1,4 +1,4 @@ -import { activityBarViews } from '../../../constants'; +import { leftSidebarViews } from '../../../constants'; import { __ } from '~/locale'; export const templateTypes = () => [ @@ -22,6 +22,6 @@ export const templateTypes = () => [ export const showFileTemplatesBar = (_, getters, rootState) => name => getters.templateTypes.find(t => t.name === name) && - rootState.currentActivityView === activityBarViews.edit; + rootState.currentActivityView === leftSidebarViews.edit.name; export default () => {}; diff --git a/app/assets/javascripts/ide/stores/state.js b/app/assets/javascripts/ide/stores/state.js index 828cec3e141..a714562c5b2 100644 --- a/app/assets/javascripts/ide/stores/state.js +++ b/app/assets/javascripts/ide/stores/state.js @@ -1,4 +1,4 @@ -import { activityBarViews, viewerTypes } from '../constants'; +import { leftSidebarViews, viewerTypes } from '../constants'; import { DEFAULT_THEME } from '../lib/themes'; export default () => ({ @@ -21,7 +21,7 @@ export default () => ({ entries: {}, viewer: viewerTypes.edit, delayViewerUpdated: false, - currentActivityView: activityBarViews.edit, + currentActivityView: leftSidebarViews.edit.name, unusedSeal: true, fileFindVisible: false, links: {}, |