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'; ...@@ -4,6 +4,24 @@ import Store from './repo_store';
import '../flash'; import '../flash';
const RepoHelper = { 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: '', key: '',
isTree(data) { isTree(data) {
...@@ -165,7 +183,6 @@ const RepoHelper = { ...@@ -165,7 +183,6 @@ const RepoHelper = {
}) })
.catch((e) => { .catch((e) => {
// RepoHelper.setLoading(false, loadingData); // RepoHelper.setLoading(false, loadingData);
console.log('catch', e)
RepoHelper.loadingError(); RepoHelper.loadingError();
}); });
}, },
......
...@@ -29,21 +29,7 @@ const RepoStore = { ...@@ -29,21 +29,7 @@ const RepoStore = {
tempPrivateToken: '', tempPrivateToken: '',
submitCommitsLoading: false, submitCommitsLoading: false,
binaryLoaded:false, binaryLoaded:false,
activeFile: { activeFile: RepoHelper.getDefaultActiveFile(),
active: true,
binary: false,
extension: '',
html: '',
mime_type: '',
name: 'loading...',
plain: '',
size: 0,
url: '',
raw: false,
newContent: '',
changed: false,
loading: false,
},
activeFileIndex: 0, activeFileIndex: 0,
activeLine: 0, activeLine: 0,
activeFileLabel: 'Raw', activeFileLabel: 'Raw',
...@@ -66,7 +52,6 @@ const RepoStore = { ...@@ -66,7 +52,6 @@ const RepoStore = {
readOnly: true, readOnly: true,
// mutations // mutations
checkIsCommitable() { checkIsCommitable() {
RepoStore.service.checkCurrentBranchIsCommitable() RepoStore.service.checkCurrentBranchIsCommitable()
.then((data) => { .then((data) => {
...@@ -89,7 +74,6 @@ const RepoStore = { ...@@ -89,7 +74,6 @@ const RepoStore = {
setActiveFiles(file) { setActiveFiles(file) {
if (RepoStore.isActiveFile(file)) return; if (RepoStore.isActiveFile(file)) return;
RepoStore.openedFiles = RepoStore.openedFiles RepoStore.openedFiles = RepoStore.openedFiles
.map((openedFile, i) => RepoStore.setFileActivity(file, openedFile, i)); .map((openedFile, i) => RepoStore.setFileActivity(file, openedFile, i));
...@@ -158,7 +142,11 @@ const RepoStore = { ...@@ -158,7 +142,11 @@ const RepoStore = {
}); });
// now activate the right tab based on what you closed. // 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) { if(RepoStore.openedFiles.length === 1 || foundIndex === 0) {
RepoStore.setActiveFiles(RepoStore.openedFiles[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