diff --git a/app/assets/javascripts/ide/components/changed_file_icon.vue b/app/assets/javascripts/ide/components/changed_file_icon.vue index a4e06bbbe3c26e47bcce9d8e692c0026178f597f..720ae11aaa6dbcf0e3546b58430311cf54a5ab65 100644 --- a/app/assets/javascripts/ide/components/changed_file_icon.vue +++ b/app/assets/javascripts/ide/components/changed_file_icon.vue @@ -3,6 +3,7 @@ import tooltip from '~/vue_shared/directives/tooltip'; import Icon from '~/vue_shared/components/icon.vue'; import { pluralize } from '~/lib/utils/text_utility'; import { __, sprintf } from '~/locale'; +import { getCommitIconMap } from '../utils'; export default { components: { @@ -34,16 +35,14 @@ export default { }, computed: { changedIcon() { - const suffix = this.file.staged && !this.showStagedIcon ? '-solid' : ''; - return this.file.tempFile && !this.forceModifiedIcon - ? `file-addition${suffix}` - : `file-modified${suffix}`; - }, - stagedIcon() { - return `${this.changedIcon}-solid`; + const suffix = !this.file.changed && this.file.staged && !this.showStagedIcon ? '-solid' : ''; + + if (this.forceModifiedIcon) return `file-modified${suffix}`; + + return `${getCommitIconMap(this.file).icon}${suffix}`; }, changedIconClass() { - return `multi-${this.changedIcon} float-left`; + return `ide-${this.changedIcon} float-left`; }, tooltipTitle() { if (!this.showTooltip) return undefined; @@ -66,6 +65,9 @@ export default { return undefined; }, + showIcon() { + return this.file.changed || this.file.tempFile || this.file.staged || this.file.deleted; + }, }, }; @@ -79,7 +81,7 @@ export default { class="ide-file-changed-icon" > { + this.updateViewer('editor'); + }); + } else if (this.activeFile && this.activeFile.deleted) { + this.resetOpenFiles(); + } + this.$nextTick(() => { this.updateViewer(this.currentMergeRequestId ? viewerTypes.mr : viewerTypes.diff); }); }, methods: { - ...mapActions(['updateViewer']), + ...mapActions(['updateViewer', 'resetOpenFiles']), }, }; @@ -36,7 +44,6 @@ export default {