Commit 2ff42f2c authored by Paul Slaughter's avatar Paul Slaughter

Merge branch 'himkp-ide-has-changes' into 'master'

Web IDE: Remove redundant getter `hasChanges`

Closes #196630

See merge request gitlab-org/gitlab!32990
parents 936c99b2 defca52a
......@@ -13,7 +13,7 @@ export default {
tooltip,
},
computed: {
...mapGetters(['hasChanges']),
...mapGetters(['someUncommittedChanges']),
...mapState(['currentActivityView']),
},
methods: {
......@@ -69,7 +69,7 @@ export default {
<icon name="file-modified" />
</button>
</li>
<li v-show="hasChanges">
<li v-show="someUncommittedChanges">
<button
v-tooltip
:class="{
......
......@@ -26,7 +26,7 @@ export default {
computed: {
...mapState(['changedFiles', 'stagedFiles', 'currentActivityView', 'lastCommitMsg']),
...mapState('commit', ['commitMessage', 'submitCommitLoading']),
...mapGetters(['hasChanges']),
...mapGetters(['someUncommittedChanges']),
...mapGetters('commit', ['discardDraftButtonDisabled', 'preBuiltCommitMessage']),
overviewText() {
return n__('%d changed file', '%d changed files', this.stagedFiles.length);
......@@ -126,7 +126,7 @@ export default {
>
<div v-if="isCompact" ref="compactEl" class="commit-form-compact">
<button
:disabled="!hasChanges"
:disabled="!someUncommittedChanges"
type="button"
class="btn btn-primary btn-sm btn-block qa-begin-commit-button"
@click="toggleIsCompact"
......
......@@ -40,7 +40,6 @@ export default {
...mapState([
'openFiles',
'viewer',
'currentMergeRequestId',
'fileFindVisible',
'emptyStateSvgPath',
'currentProjectId',
......@@ -49,7 +48,6 @@ export default {
]),
...mapGetters([
'activeFile',
'hasChanges',
'someUncommittedChanges',
'isCommitModeActive',
'allBlobs',
......@@ -108,14 +106,7 @@ export default {
<div class="multi-file-edit-pane">
<template v-if="activeFile">
<commit-editor-header v-if="isCommitModeActive" :active-file="activeFile" />
<repo-tabs
v-else
:active-file="activeFile"
:files="openFiles"
:viewer="viewer"
:has-changes="hasChanges"
:merge-request-id="currentMergeRequestId"
/>
<repo-tabs v-else :active-file="activeFile" :files="openFiles" :viewer="viewer" />
<repo-editor :file="activeFile" class="multi-file-edit-pane-content" />
</template>
<template v-else>
......
......@@ -16,7 +16,7 @@ export default {
computed: {
...mapState(['changedFiles', 'stagedFiles', 'lastCommitMsg']),
...mapState('commit', ['commitMessage', 'submitCommitLoading']),
...mapGetters(['lastOpenedFile', 'hasChanges', 'someUncommittedChanges', 'activeFile']),
...mapGetters(['lastOpenedFile', 'someUncommittedChanges', 'activeFile']),
...mapGetters('commit', ['discardDraftButtonDisabled']),
showStageUnstageArea() {
return Boolean(this.someUncommittedChanges || this.lastCommitMsg);
......@@ -26,8 +26,8 @@ export default {
},
},
watch: {
hasChanges() {
if (!this.hasChanges) {
someUncommittedChanges() {
if (!this.someUncommittedChanges) {
this.updateActivityBarView(leftSidebarViews.edit.name);
}
},
......
......@@ -20,15 +20,6 @@ export default {
type: String,
required: true,
},
hasChanges: {
type: Boolean,
required: true,
},
mergeRequestId: {
type: String,
required: false,
default: '',
},
},
methods: {
...mapActions(['updateViewer', 'removePendingTab']),
......
......@@ -50,9 +50,6 @@ export const emptyRepo = state =>
export const currentTree = state =>
state.trees[`${state.currentProjectId}/${state.currentBranchId}`];
export const hasChanges = state =>
Boolean(state.changedFiles.length) || Boolean(state.stagedFiles.length);
export const hasMergeRequest = state => Boolean(state.currentMergeRequestId);
export const allBlobs = state =>
......
......@@ -16,9 +16,7 @@ describe('RepoTabs', () => {
vm = createComponent(RepoTabs, {
files: openedFiles,
viewer: 'editor',
hasChanges: false,
activeFile: file('activeFile'),
hasMergeRequest: false,
});
openedFiles[0].active = true;
......
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