summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/components/repo_commit_section.vue
diff options
context:
space:
mode:
authorPhil Hughes <me@iamphill.com>2018-03-21 10:05:08 +0000
committerPhil Hughes <me@iamphill.com>2018-03-22 10:33:19 +0000
commit51c64f3fc7180732621d60f939bfe6157165040f (patch)
treeeaa1154ec945cfc289de9d2fd3f54a906d74d43b /app/assets/javascripts/ide/components/repo_commit_section.vue
parent4718f22f5751f8d50bd7897ff4a967ccc5625c80 (diff)
downloadgitlab-ce-51c64f3fc7180732621d60f939bfe6157165040f.tar.gz
Added staged files state to IDE
Closes https://gitlab.com/gitlab-org/gitlab-ee/issues/4541
Diffstat (limited to 'app/assets/javascripts/ide/components/repo_commit_section.vue')
-rw-r--r--app/assets/javascripts/ide/components/repo_commit_section.vue101
1 files changed, 32 insertions, 69 deletions
diff --git a/app/assets/javascripts/ide/components/repo_commit_section.vue b/app/assets/javascripts/ide/components/repo_commit_section.vue
index d772cab2d0e..d8d447b80f3 100644
--- a/app/assets/javascripts/ide/components/repo_commit_section.vue
+++ b/app/assets/javascripts/ide/components/repo_commit_section.vue
@@ -5,14 +5,16 @@ import icon from '~/vue_shared/components/icon.vue';
import modal from '~/vue_shared/components/modal.vue';
import LoadingButton from '~/vue_shared/components/loading_button.vue';
import commitFilesList from './commit_sidebar/list.vue';
-import * as consts from '../stores/modules/commit/constants';
+import EmptyState from './commit_sidebar/empty_state.vue';
import Actions from './commit_sidebar/actions.vue';
+import * as consts from '../stores/modules/commit/constants';
export default {
components: {
modal,
icon,
commitFilesList,
+ EmptyState,
Actions,
LoadingButton,
},
@@ -30,45 +32,26 @@ export default {
},
},
computed: {
- ...mapState([
- 'currentProjectId',
- 'currentBranchId',
- 'rightPanelCollapsed',
- 'lastCommitMsg',
- 'changedFiles',
- ]),
- ...mapState('commit', [
- 'commitMessage',
- 'submitCommitLoading',
- ]),
+ ...mapState(['stagedFiles', 'rightPanelCollapsed']),
+ ...mapState('commit', ['commitMessage', 'submitCommitLoading']),
+ ...mapGetters(['unstagedFiles']),
...mapGetters('commit', [
'commitButtonDisabled',
'discardDraftButtonDisabled',
'branchName',
]),
- statusSvg() {
- return this.lastCommitMsg ? this.committedStateSvgPath : this.noChangesStateSvgPath;
- },
},
methods: {
- ...mapActions([
- 'setPanelCollapsedStatus',
- ]),
...mapActions('commit', [
'updateCommitMessage',
'discardDraft',
'commitChanges',
'updateCommitAction',
]),
- toggleCollapsed() {
- this.setPanelCollapsedStatus({
- side: 'right',
- collapsed: !this.rightPanelCollapsed,
- });
- },
forceCreateNewBranch() {
- return this.updateCommitAction(consts.COMMIT_TO_NEW_BRANCH)
- .then(() => this.commitChanges());
+ return this.updateCommitAction(consts.COMMIT_TO_NEW_BRANCH).then(() =>
+ this.commitChanges(),
+ );
},
},
};
@@ -77,9 +60,6 @@ export default {
<template>
<div
class="multi-file-commit-panel-section"
- :class="{
- 'multi-file-commit-empty-state-container': !changedFiles.length
- }"
>
<modal
id="ide-create-branch-modal"
@@ -93,15 +73,26 @@ export default {
Would you like to create a new branch?`) }}
</template>
</modal>
- <commit-files-list
- title="Staged"
- :file-list="changedFiles"
- :collapsed="rightPanelCollapsed"
- @toggleCollapsed="toggleCollapsed"
- />
<template
- v-if="changedFiles.length"
+ v-if="unstagedFiles.length || stagedFiles.length"
>
+ <commit-files-list
+ icon="unstaged"
+ :title="__('Unstaged')"
+ :file-list="unstagedFiles"
+ action="stageAllChanges"
+ :action-btn-text="__('Stage all')"
+ item-action-component="stage-button"
+ />
+ <commit-files-list
+ icon="staged"
+ :title="__('Staged')"
+ :file-list="stagedFiles"
+ action="unstageAllChanges"
+ :action-btn-text="__('Unstage all')"
+ item-action-component="unstage-button"
+ :show-toggle="false"
+ />
<form
class="form-horizontal multi-file-commit-form"
@submit.prevent.stop="commitChanges"
@@ -137,38 +128,10 @@ export default {
</div>
</form>
</template>
- <div
- v-else-if="!rightPanelCollapsed"
- class="row js-empty-state"
- >
- <div class="col-xs-10 col-xs-offset-1">
- <div class="svg-content svg-80">
- <img :src="statusSvg" />
- </div>
- </div>
- <div class="col-xs-10 col-xs-offset-1">
- <div
- class="text-content text-center"
- v-if="!lastCommitMsg"
- >
- <h4>
- {{ __('No changes') }}
- </h4>
- <p>
- {{ __('Edit files in the editor and commit changes here') }}
- </p>
- </div>
- <div
- class="text-content text-center"
- v-else
- >
- <h4>
- {{ __('All changes are committed') }}
- </h4>
- <p v-html="lastCommitMsg">
- </p>
- </div>
- </div>
- </div>
+ <empty-state
+ v-else
+ :no-changes-state-svg-path="noChangesStateSvgPath"
+ :committed-state-svg-path="committedStateSvgPath"
+ />
</div>
</template>