diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-13 12:09:22 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-03-13 12:09:22 +0000 |
commit | 286fe61013674fe2d245ffc8d2233baf09923e70 (patch) | |
tree | 2037291f5863105e54e75be056b49f7d62007cae /app/assets/javascripts/ide | |
parent | 4cb5e5011abfe8d50ac3a7ebd0018c563c6d7af4 (diff) | |
download | gitlab-ce-286fe61013674fe2d245ffc8d2233baf09923e70.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'app/assets/javascripts/ide')
6 files changed, 25 insertions, 125 deletions
diff --git a/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue b/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue index 3398cd091ba..e618fb3daae 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/editor_header.vue @@ -24,25 +24,19 @@ export default { discardModalTitle() { return sprintf(__('Discard changes to %{path}?'), { path: this.activeFile.path }); }, - actionButtonText() { - return this.activeFile.staged ? __('Unstage') : __('Stage'); - }, isStaged() { return !this.activeFile.changed && this.activeFile.staged; }, }, methods: { ...mapActions(['stageChange', 'unstageChange', 'discardFileChanges']), - actionButtonClicked() { - if (this.activeFile.staged) { - this.unstageChange(this.activeFile.path); - } else { - this.stageChange(this.activeFile.path); - } - }, showDiscardModal() { this.$refs.discardModal.show(); }, + discardChanges(path) { + this.unstageChange(path); + this.discardFileChanges(path); + }, }, }; </script> @@ -65,19 +59,7 @@ export default { class="btn btn-remove btn-inverted append-right-8" @click="showDiscardModal" > - {{ __('Discard') }} - </button> - <button - ref="actionButton" - :class="{ - 'btn-success': !isStaged, - 'btn-warning': isStaged, - }" - type="button" - class="btn btn-inverted" - @click="actionButtonClicked" - > - {{ actionButtonText }} + {{ __('Discard changes') }} </button> </div> <gl-modal @@ -87,7 +69,7 @@ export default { :ok-title="__('Discard changes')" :modal-id="discardModalId" :title="discardModalTitle" - @ok="discardFileChanges(activeFile.path)" + @ok="discardChanges(activeFile.path)" > {{ __("You will lose all changes you've made to this file. This action cannot be undone.") }} </gl-modal> diff --git a/app/assets/javascripts/ide/components/commit_sidebar/form.vue b/app/assets/javascripts/ide/components/commit_sidebar/form.vue index 5ec3fc4041b..f6ca728defc 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/form.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/form.vue @@ -1,6 +1,6 @@ <script> import { mapState, mapActions, mapGetters } from 'vuex'; -import { sprintf, __ } from '~/locale'; +import { n__, __ } from '~/locale'; import LoadingButton from '~/vue_shared/components/loading_button.vue'; import CommitMessageField from './message_field.vue'; import Actions from './actions.vue'; @@ -26,15 +26,7 @@ export default { ...mapGetters(['hasChanges']), ...mapGetters('commit', ['discardDraftButtonDisabled', 'preBuiltCommitMessage']), overviewText() { - return sprintf( - __( - '<strong>%{stagedFilesLength} staged</strong> and <strong>%{changedFilesLength} unstaged</strong> changes', - ), - { - stagedFilesLength: this.stagedFiles.length, - changedFilesLength: this.changedFiles.length, - }, - ); + return n__('%d changed file', '%d changed files', this.stagedFiles.length); }, commitButtonText() { return this.stagedFiles.length ? __('Commit') : __('Stage & Commit'); @@ -125,7 +117,7 @@ export default { > {{ __('Commit…') }} </button> - <p class="text-center" v-html="overviewText"></p> + <p class="text-center bold">{{ overviewText }}</p> </div> <form v-if="!isCompact" ref="formEl" @submit.prevent.stop="commitChanges"> <transition name="fade"> <success-message v-show="lastCommitMsg" /> </transition> diff --git a/app/assets/javascripts/ide/components/commit_sidebar/list.vue b/app/assets/javascripts/ide/components/commit_sidebar/list.vue index d9a385a9d31..2e273d45506 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/list.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/list.vue @@ -17,10 +17,6 @@ export default { tooltip, }, props: { - title: { - type: String, - required: true, - }, fileList: { type: Array, required: true, @@ -29,18 +25,6 @@ export default { type: String, required: true, }, - action: { - type: String, - required: true, - }, - actionBtnText: { - type: String, - required: true, - }, - actionBtnIcon: { - type: String, - required: true, - }, stagedList: { type: Boolean, required: false, @@ -63,9 +47,9 @@ export default { }, computed: { titleText() { - return sprintf(__('%{title} changes'), { - title: this.title, - }); + if (!this.title) return __('Changes'); + + return sprintf(__('%{title} changes'), { title: this.title }); }, filesLength() { return this.fileList.length; @@ -73,17 +57,16 @@ export default { }, methods: { ...mapActions(['stageAllChanges', 'unstageAllChanges', 'discardAllChanges']), - actionBtnClicked() { - this[this.action](); - - $(this.$refs.actionBtn).tooltip('hide'); - }, openDiscardModal() { $('#discard-all-changes').modal('show'); }, + unstageAndDiscardAllChanges() { + this.unstageAllChanges(); + this.discardAllChanges(); + }, }, discardModalText: __( - "You will lose all the unstaged changes you've made in this project. This action cannot be undone.", + "You will lose all uncommitted changes you've made in this project. This action cannot be undone.", ), }; </script> @@ -96,24 +79,6 @@ export default { <strong> {{ titleText }} </strong> <div class="d-flex ml-auto"> <button - ref="actionBtn" - v-tooltip - :title="actionBtnText" - :aria-label="actionBtnText" - :disabled="!filesLength" - :class="{ - 'disabled-content': !filesLength, - }" - type="button" - class="d-flex ide-staged-action-btn p-0 border-0 align-items-center" - data-placement="bottom" - data-container="body" - data-boundary="viewport" - @click="actionBtnClicked" - > - <icon :name="actionBtnIcon" :size="16" class="ml-auto mr-auto" /> - </button> - <button v-if="!stagedList" v-tooltip :title="__('Discard all changes')" @@ -151,9 +116,9 @@ export default { v-if="!stagedList" id="discard-all-changes" :footer-primary-button-text="__('Discard all changes')" - :header-title-text="__('Discard all unstaged changes?')" + :header-title-text="__('Discard all changes?')" footer-primary-button-variant="danger" - @submit="discardAllChanges" + @submit="unstageAndDiscardAllChanges" > {{ $options.discardModalText }} </gl-modal> diff --git a/app/assets/javascripts/ide/components/commit_sidebar/list_item.vue b/app/assets/javascripts/ide/components/commit_sidebar/list_item.vue index 726e2b7e1fc..e49d96efe50 100644 --- a/app/assets/javascripts/ide/components/commit_sidebar/list_item.vue +++ b/app/assets/javascripts/ide/components/commit_sidebar/list_item.vue @@ -57,13 +57,7 @@ export default { }, }, methods: { - ...mapActions([ - 'discardFileChanges', - 'updateViewer', - 'openPendingTab', - 'unstageChange', - 'stageChange', - ]), + ...mapActions(['discardFileChanges', 'updateViewer', 'openPendingTab']), openFileInEditor() { if (this.file.type === 'tree') return null; @@ -76,13 +70,6 @@ export default { } }); }, - fileAction() { - if (this.file.staged) { - this.unstageChange(this.file.path); - } else { - this.stageChange(this.file.path); - } - }, }, }; </script> @@ -97,7 +84,6 @@ export default { }" class="multi-file-commit-list-path w-100 border-0 ml-0 mr-0" role="button" - @dblclick="fileAction" @click="openFileInEditor" > <span class="multi-file-commit-list-file-path d-flex align-items-center"> diff --git a/app/assets/javascripts/ide/components/file_row_extra.vue b/app/assets/javascripts/ide/components/file_row_extra.vue index 3ef7d863bd5..32822a75772 100644 --- a/app/assets/javascripts/ide/components/file_row_extra.vue +++ b/app/assets/javascripts/ide/components/file_row_extra.vue @@ -1,6 +1,6 @@ <script> import { mapGetters } from 'vuex'; -import { n__, __, sprintf } from '~/locale'; +import { n__ } from '~/locale'; import tooltip from '~/vue_shared/directives/tooltip'; import Icon from '~/vue_shared/components/icon.vue'; import ChangedFileIcon from '~/vue_shared/components/changed_file_icon.vue'; @@ -49,16 +49,7 @@ export default { folderChangesTooltip() { if (this.changesCount === 0) return undefined; - if (this.folderUnstagedCount > 0 && this.folderStagedCount === 0) { - return n__('%d unstaged change', '%d unstaged changes', this.folderUnstagedCount); - } else if (this.folderUnstagedCount === 0 && this.folderStagedCount > 0) { - return n__('%d staged change', '%d staged changes', this.folderStagedCount); - } - - return sprintf(__('%{staged} staged and %{unstaged} unstaged changes'), { - unstaged: this.folderUnstagedCount, - staged: this.folderStagedCount, - }); + return n__('%d changed file', '%d changed files', this.changesCount); }, showTreeChangesCount() { return this.isTree && this.changesCount > 0 && !this.file.opened; diff --git a/app/assets/javascripts/ide/components/repo_commit_section.vue b/app/assets/javascripts/ide/components/repo_commit_section.vue index 62fb0b03975..b8dca2709c8 100644 --- a/app/assets/javascripts/ide/components/repo_commit_section.vue +++ b/app/assets/javascripts/ide/components/repo_commit_section.vue @@ -86,28 +86,12 @@ export default { </deprecated-modal> <template v-if="showStageUnstageArea"> <commit-files-list - :title="__('Unstaged')" - :key-prefix="$options.stageKeys.unstaged" - :file-list="changedFiles" - :action-btn-text="__('Stage all changes')" - :active-file-key="activeFileKey" - :empty-state-text="__('There are no unstaged changes')" - action="stageAllChanges" - action-btn-icon="stage-all" - class="is-first" - icon-name="unstaged" - /> - <commit-files-list - :title="__('Staged')" :key-prefix="$options.stageKeys.staged" :file-list="stagedFiles" - :action-btn-text="__('Unstage all changes')" - :staged-list="true" :active-file-key="activeFileKey" - :empty-state-text="__('There are no staged changes')" - action="unstageAllChanges" - action-btn-icon="unstage-all" - icon-name="staged" + :empty-state-text="__('There are no changes')" + class="is-first" + icon-name="unstaged" /> </template> <empty-state v-if="unusedSeal" /> |