diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-25 00:07:54 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-25 00:07:54 +0300 |
commit | c4db541c1b2c97ab1eda354ea3899489fe5c33e5 (patch) | |
tree | 45d5d381232179082ea11136e3b53211b37349d5 /app/assets/javascripts | |
parent | 603c7d4cac5e28bc1c75e50c23ed2cbe56f1aafc (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts')
13 files changed, 46 insertions, 74 deletions
diff --git a/app/assets/javascripts/diffs/components/diff_file.vue b/app/assets/javascripts/diffs/components/diff_file.vue index e09bf1f8005..8babc05f1ce 100644 --- a/app/assets/javascripts/diffs/components/diff_file.vue +++ b/app/assets/javascripts/diffs/components/diff_file.vue @@ -58,9 +58,6 @@ export default { hasDiff() { return hasDiff(this.file); }, - isActive() { - return this.currentDiffFileId === this.file.file_hash; - }, isFileTooLarge() { return this.file.viewer.error === diffViewerErrors.too_large; }, @@ -146,7 +143,7 @@ export default { <div :id="file.file_hash" :class="{ - 'is-active': isActive, + 'is-active': currentDiffFileId === file.file_hash, }" class="diff-file file-holder" > @@ -156,7 +153,6 @@ export default { :collapsible="true" :expanded="!isCollapsed" :add-merge-request-buttons="true" - :is-active="isActive" class="js-file-title file-title" @toggleFile="handleToggle" @showForkMessage="showForkMessage" diff --git a/app/assets/javascripts/diffs/components/diff_file_header.vue b/app/assets/javascripts/diffs/components/diff_file_header.vue index bad82c84601..d4270960f57 100644 --- a/app/assets/javascripts/diffs/components/diff_file_header.vue +++ b/app/assets/javascripts/diffs/components/diff_file_header.vue @@ -55,11 +55,6 @@ export default { type: Boolean, required: true, }, - isActive: { - type: Boolean, - required: false, - default: false, - }, }, computed: { ...mapGetters('diffs', ['diffHasExpandedDiscussions', 'diffHasDiscussions']), @@ -163,9 +158,6 @@ export default { <div ref="header" class="js-file-title file-title file-title-flex-parent" - :class="{ - 'is-active': isActive, - }" @click.self="handleToggleFile" > <div class="file-header-content"> diff --git a/app/assets/javascripts/diffs/components/tree_list.vue b/app/assets/javascripts/diffs/components/tree_list.vue index fcf87807e75..eca9091f92f 100644 --- a/app/assets/javascripts/diffs/components/tree_list.vue +++ b/app/assets/javascripts/diffs/components/tree_list.vue @@ -26,7 +26,7 @@ export default { }; }, computed: { - ...mapState('diffs', ['tree', 'renderTreeList', 'currentDiffFileId', 'viewedDiffFileIds']), + ...mapState('diffs', ['tree', 'renderTreeList']), ...mapGetters('diffs', ['allBlobs']), filteredTreeList() { const search = this.search.toLowerCase().trim(); @@ -96,8 +96,6 @@ export default { :level="0" :hide-file-stats="hideFileStats" :file-row-component="$options.DiffFileRow" - :active-file="currentDiffFileId" - :viewed-files="viewedDiffFileIds" @toggleTreeOpen="toggleTreeOpen" @clickFile="scrollToFile" /> diff --git a/app/assets/javascripts/diffs/store/modules/diff_state.js b/app/assets/javascripts/diffs/store/modules/diff_state.js index f1bd9d8981d..81f1506260c 100644 --- a/app/assets/javascripts/diffs/store/modules/diff_state.js +++ b/app/assets/javascripts/diffs/store/modules/diff_state.js @@ -26,7 +26,6 @@ export default () => ({ showTreeList: true, currentDiffFileId: '', projectPath: '', - viewedDiffFileIds: [], commentForms: [], highlightedRow: null, renderTreeList: true, diff --git a/app/assets/javascripts/diffs/store/mutations.js b/app/assets/javascripts/diffs/store/mutations.js index 6438dad4f7f..bb4c80b5759 100644 --- a/app/assets/javascripts/diffs/store/mutations.js +++ b/app/assets/javascripts/diffs/store/mutations.js @@ -284,9 +284,6 @@ export default { }, [types.UPDATE_CURRENT_DIFF_FILE_ID](state, fileId) { state.currentDiffFileId = fileId; - if (!state.viewedDiffFileIds.includes(fileId)) { - state.viewedDiffFileIds = [fileId, ...state.viewedDiffFileIds]; - } }, [types.OPEN_DIFF_FILE_COMMENT_FORM](state, formData) { state.commentForms.push({ diff --git a/app/assets/javascripts/releases/mount_edit.js b/app/assets/javascripts/releases/mount_edit.js index 102c4367aac..44530e4961a 100644 --- a/app/assets/javascripts/releases/mount_edit.js +++ b/app/assets/javascripts/releases/mount_edit.js @@ -1,22 +1,20 @@ import Vue from 'vue'; import ReleaseEditApp from './components/app_edit.vue'; import createStore from './stores'; -import detailModule from './stores/modules/detail'; +import createDetailModule from './stores/modules/detail'; export default () => { const el = document.getElementById('js-edit-release-page'); const store = createStore({ modules: { - detail: detailModule, + detail: createDetailModule(el.dataset), }, featureFlags: { releaseShowPage: Boolean(gon.features?.releaseShowPage), }, }); - store.dispatch('detail/setInitialState', el.dataset); - return new Vue({ el, store, diff --git a/app/assets/javascripts/releases/mount_show.js b/app/assets/javascripts/releases/mount_show.js index 73e34869b21..7ddc8e786c1 100644 --- a/app/assets/javascripts/releases/mount_show.js +++ b/app/assets/javascripts/releases/mount_show.js @@ -1,17 +1,16 @@ import Vue from 'vue'; import ReleaseShowApp from './components/app_show.vue'; import createStore from './stores'; -import detailModule from './stores/modules/detail'; +import createDetailModule from './stores/modules/detail'; export default () => { const el = document.getElementById('js-show-release-page'); const store = createStore({ modules: { - detail: detailModule, + detail: createDetailModule(el.dataset), }, }); - store.dispatch('detail/setInitialState', el.dataset); return new Vue({ el, diff --git a/app/assets/javascripts/releases/stores/modules/detail/actions.js b/app/assets/javascripts/releases/stores/modules/detail/actions.js index 35901a654b0..1b77f01368e 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/actions.js +++ b/app/assets/javascripts/releases/stores/modules/detail/actions.js @@ -5,9 +5,6 @@ import { s__ } from '~/locale'; import { redirectTo } from '~/lib/utils/url_utility'; import { convertObjectPropsToCamelCase } from '~/lib/utils/common_utils'; -export const setInitialState = ({ commit }, initialState) => - commit(types.SET_INITIAL_STATE, initialState); - export const requestRelease = ({ commit }) => commit(types.REQUEST_RELEASE); export const receiveReleaseSuccess = ({ commit }, data) => commit(types.RECEIVE_RELEASE_SUCCESS, data); diff --git a/app/assets/javascripts/releases/stores/modules/detail/index.js b/app/assets/javascripts/releases/stores/modules/detail/index.js index 243c2389d8c..b4430cff2ab 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/index.js +++ b/app/assets/javascripts/releases/stores/modules/detail/index.js @@ -1,10 +1,10 @@ import * as actions from './actions'; import mutations from './mutations'; -import state from './state'; +import createState from './state'; -export default { +export default initialState => ({ namespaced: true, actions, mutations, - state, -}; + state: createState(initialState), +}); diff --git a/app/assets/javascripts/releases/stores/modules/detail/mutation_types.js b/app/assets/javascripts/releases/stores/modules/detail/mutation_types.js index 75e1d78a645..51c0590012a 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/mutation_types.js +++ b/app/assets/javascripts/releases/stores/modules/detail/mutation_types.js @@ -1,5 +1,3 @@ -export const SET_INITIAL_STATE = 'SET_INITIAL_STATE'; - export const REQUEST_RELEASE = 'REQUEST_RELEASE'; export const RECEIVE_RELEASE_SUCCESS = 'RECEIVE_RELEASE_SUCCESS'; export const RECEIVE_RELEASE_ERROR = 'RECEIVE_RELEASE_ERROR'; diff --git a/app/assets/javascripts/releases/stores/modules/detail/mutations.js b/app/assets/javascripts/releases/stores/modules/detail/mutations.js index d739978d755..913db6c2b2a 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/mutations.js +++ b/app/assets/javascripts/releases/stores/modules/detail/mutations.js @@ -1,12 +1,6 @@ import * as types from './mutation_types'; export default { - [types.SET_INITIAL_STATE](state, initialState) { - Object.keys(state).forEach(key => { - state[key] = initialState[key]; - }); - }, - [types.REQUEST_RELEASE](state) { state.isFetchingRelease = true; }, diff --git a/app/assets/javascripts/releases/stores/modules/detail/state.js b/app/assets/javascripts/releases/stores/modules/detail/state.js index 7e3d975f1ae..a19e8d044e2 100644 --- a/app/assets/javascripts/releases/stores/modules/detail/state.js +++ b/app/assets/javascripts/releases/stores/modules/detail/state.js @@ -1,10 +1,17 @@ -export default () => ({ - projectId: null, - tagName: null, - releasesPagePath: null, - markdownDocsPath: null, - markdownPreviewPath: null, - updateReleaseApiDocsPath: null, +export default ({ + projectId, + tagName, + releasesPagePath, + markdownDocsPath, + markdownPreviewPath, + updateReleaseApiDocsPath, +}) => ({ + projectId, + tagName, + releasesPagePath, + markdownDocsPath, + markdownPreviewPath, + updateReleaseApiDocsPath, release: null, diff --git a/app/assets/javascripts/vue_shared/components/file_row.vue b/app/assets/javascripts/vue_shared/components/file_row.vue index 5a953b351f9..4d60cf5b1cc 100644 --- a/app/assets/javascripts/vue_shared/components/file_row.vue +++ b/app/assets/javascripts/vue_shared/components/file_row.vue @@ -18,16 +18,6 @@ export default { type: Number, required: true, }, - activeFile: { - type: String, - required: false, - default: '', - }, - viewedFiles: { - type: Array, - required: false, - default: () => [], - }, }, computed: { isTree() { @@ -44,8 +34,8 @@ export default { fileClass() { return { 'file-open': this.isBlob && this.file.opened, - 'is-active': this.isBlob && (this.file.active || this.activeFile === this.file.fileHash), - 'is-viewed': this.isBlob && this.viewedFiles.includes(this.file.fileHash), + 'is-active': this.isBlob && this.file.active, + folder: this.isTree, 'is-open': this.file.opened, }; }, @@ -117,23 +107,15 @@ export default { v-else :class="fileClass" :title="file.name" - class="file-row text-left px-1 py-2 ml-n2 d-flex align-items-center" + class="file-row" role="button" @click="clickFile" @mouseleave="$emit('mouseleave', $event)" > - <div class="file-row-name-container w-100 d-flex align-items-center"> - <span - ref="textOutput" - :style="levelIndentation" - class="file-row-name str-truncated d-inline-block" - :class="[ - { 'folder font-weight-normal': isTree }, - fileClass['is-viewed'] ? 'font-weight-normal' : 'font-weight-bold', - ]" - > + <div class="file-row-name-container"> + <span ref="textOutput" :style="levelIndentation" class="file-row-name str-truncated"> <file-icon - class="file-row-icon align-middle mr-1" + class="file-row-icon" :class="{ 'text-secondary': file.type === 'tree' }" :file-name="file.name" :loading="file.loading" @@ -150,8 +132,14 @@ export default { <style> .file-row { + display: flex; + align-items: center; height: 32px; + padding: 4px 8px; + margin-left: -8px; + margin-right: -8px; border-radius: 3px; + text-align: left; cursor: pointer; } @@ -169,15 +157,24 @@ export default { } .file-row-name-container { + display: flex; + width: 100%; + align-items: center; overflow: visible; } .file-row-name { + display: inline-block; flex: 1; max-width: inherit; - height: 20px; + height: 19px; line-height: 16px; text-overflow: ellipsis; white-space: nowrap; } + +.file-row-name .file-row-icon { + margin-right: 2px; + vertical-align: middle; +} </style> |