BigW Consortium Gitlab

Commit 71d08bfb by Jacob Schatz

Remove active file when no files are open.

parent d52172fa
......@@ -4,6 +4,24 @@ import Store from './repo_store';
import '../flash';
const RepoHelper = {
getDefaultActiveFile() {
return {
active: true,
binary: false,
extension: '',
html: '',
mime_type: '',
name: 'loading...',
plain: '',
size: 0,
url: '',
raw: false,
newContent: '',
changed: false,
loading: false,
}
},
key: '',
isTree(data) {
......@@ -165,7 +183,6 @@ const RepoHelper = {
})
.catch((e) => {
// RepoHelper.setLoading(false, loadingData);
console.log('catch', e)
RepoHelper.loadingError();
});
},
......
......@@ -29,21 +29,7 @@ const RepoStore = {
tempPrivateToken: '',
submitCommitsLoading: false,
binaryLoaded:false,
activeFile: {
active: true,
binary: false,
extension: '',
html: '',
mime_type: '',
name: 'loading...',
plain: '',
size: 0,
url: '',
raw: false,
newContent: '',
changed: false,
loading: false,
},
activeFile: RepoHelper.getDefaultActiveFile(),
activeFileIndex: 0,
activeLine: 0,
activeFileLabel: 'Raw',
......@@ -66,7 +52,6 @@ const RepoStore = {
readOnly: true,
// mutations
checkIsCommitable() {
RepoStore.service.checkCurrentBranchIsCommitable()
.then((data) => {
......@@ -89,7 +74,6 @@ const RepoStore = {
setActiveFiles(file) {
if (RepoStore.isActiveFile(file)) return;
RepoStore.openedFiles = RepoStore.openedFiles
.map((openedFile, i) => RepoStore.setFileActivity(file, openedFile, i));
......@@ -158,7 +142,11 @@ const RepoStore = {
});
// now activate the right tab based on what you closed.
if(RepoStore.openedFiles.length === 0) return;
if(RepoStore.openedFiles.length === 0) {
console.log('open 0')
RepoStore.activeFile = {};
return;
}
if(RepoStore.openedFiles.length === 1 || foundIndex === 0) {
RepoStore.setActiveFiles(RepoStore.openedFiles[0]);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment