summaryrefslogtreecommitdiff
path: root/app/assets/javascripts/ide/stores/actions/file.js
diff options
context:
space:
mode:
Diffstat (limited to 'app/assets/javascripts/ide/stores/actions/file.js')
-rw-r--r--app/assets/javascripts/ide/stores/actions/file.js12
1 files changed, 9 insertions, 3 deletions
diff --git a/app/assets/javascripts/ide/stores/actions/file.js b/app/assets/javascripts/ide/stores/actions/file.js
index 5a39bfb02c4..755e8e14989 100644
--- a/app/assets/javascripts/ide/stores/actions/file.js
+++ b/app/assets/javascripts/ide/stores/actions/file.js
@@ -18,9 +18,9 @@ export const closeFile = ({ commit, state, getters, dispatch }, file) => {
commit(types.TOGGLE_FILE_OPEN, path);
commit(types.SET_FILE_ACTIVE, { path, active: false });
- if (state.openFiles.length > 0 && fileWasActive) {
+ if (getters.tabs.length > 0 && fileWasActive) {
const nextIndexToOpen = indexOfClosedFile === 0 ? 0 : indexOfClosedFile - 1;
- const nextFileToOpen = state.entries[state.openFiles[nextIndexToOpen].path];
+ const nextFileToOpen = state.openFiles[nextIndexToOpen];
router.push(`/project${nextFileToOpen.url}`);
} else if (!state.openFiles.length) {
@@ -133,6 +133,12 @@ export const discardFileChanges = ({ state, commit }, path) => {
eventHub.$emit(`editor.update.model.content.${file.path}`, file.raw);
};
-export const openPendingTab = ({ commit }, file) => {
+export const openPendingTab = ({ commit, state }, file) => {
commit(types.ADD_PENDING_TAB, file);
+
+ router.push(`/project/${file.projectId}/tree/${state.currentBranchId}/`);
+};
+
+export const removePendingTab = ({ commit }, file) => {
+ commit(types.REMOVE_PENDING_TAB, file);
};