diff options
author | Phil Hughes <me@iamphill.com> | 2018-03-23 11:37:34 +0000 |
---|---|---|
committer | Phil Hughes <me@iamphill.com> | 2018-03-28 14:08:31 +0100 |
commit | bfdeee1de9a152bfda2ae5658f0f3de834a21571 (patch) | |
tree | 39aa1e80eeed115d4ebedb3fb1ec8a28fafb3ab4 /app | |
parent | c5c7baec60184b89dad63a8123c4c0661256f83e (diff) | |
download | gitlab-ce-bfdeee1de9a152bfda2ae5658f0f3de834a21571.tar.gz |
correctly toggle between tabs
Diffstat (limited to 'app')
4 files changed, 18 insertions, 9 deletions
diff --git a/app/assets/javascripts/ide/components/repo_editor.vue b/app/assets/javascripts/ide/components/repo_editor.vue index b75f8ab5fb1..5cf1d9f09c6 100644 --- a/app/assets/javascripts/ide/components/repo_editor.vue +++ b/app/assets/javascripts/ide/components/repo_editor.vue @@ -71,7 +71,7 @@ export default { this.getRawFileData(this.file) .then(() => { const viewerPromise = this.delayViewerUpdated - ? this.updateViewer('editor') + ? this.updateViewer(this.file.pending ? 'diff' : 'editor') : Promise.resolve(); return viewerPromise; diff --git a/app/assets/javascripts/ide/components/repo_tab.vue b/app/assets/javascripts/ide/components/repo_tab.vue index b36fb6b4830..f82588219cc 100644 --- a/app/assets/javascripts/ide/components/repo_tab.vue +++ b/app/assets/javascripts/ide/components/repo_tab.vue @@ -37,9 +37,15 @@ export default { }, methods: { - ...mapActions(['closeFile']), + ...mapActions(['closeFile', 'updateDelayViewerUpdated', 'openPendingTab']), clickFile(tab) { - this.$router.push(`/project${tab.url}`); + this.updateDelayViewerUpdated(true); + + if (tab.pending) { + this.openPendingTab(tab); + } else { + this.$router.push(`/project${tab.url}`); + } }, mouseOverTab() { if (this.tab.changed) { diff --git a/app/assets/javascripts/ide/lib/common/model.js b/app/assets/javascripts/ide/lib/common/model.js index ff720fc0174..83847bf457d 100644 --- a/app/assets/javascripts/ide/lib/common/model.js +++ b/app/assets/javascripts/ide/lib/common/model.js @@ -80,7 +80,7 @@ export default class Model { eventHub.$off(`editor.update.model.dispose.${this.file.key}`, this.dispose); eventHub.$off( - `editor.update.model.content.${this.file.key}`, + `editor.update.model.content.${this.file.path}`, this.updateContent, ); } diff --git a/app/assets/javascripts/ide/stores/mutations/file.js b/app/assets/javascripts/ide/stores/mutations/file.js index 5dcbf9aa294..e49a74ac3ed 100644 --- a/app/assets/javascripts/ide/stores/mutations/file.js +++ b/app/assets/javascripts/ide/stores/mutations/file.js @@ -92,6 +92,14 @@ export default { [types.ADD_PENDING_TAB](state, file) { const pendingTab = state.pendingTabs.find(f => f.path === file.path); + Object.assign(state, { + openFiles: state.openFiles.map(f => + Object.assign(f, { + active: false, + }), + ), + }); + if (pendingTab) { Object.assign(state, { pendingTabs: state.pendingTabs.map(tab => ({ @@ -107,11 +115,6 @@ export default { pending: true, key: `pending-${file.key}`, }), - openFiles: state.openFiles.map(f => - Object.assign(f, { - active: false, - }), - ), }); } }, |