ulozeni gitDirStatTree do promene
This commit is contained in:
@@ -80,14 +80,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
updateFileStats() {
|
updateFileStats() {
|
||||||
this.model.getGitStatusTree().then(
|
this.view.statDirTree(this.model.gitDirTreeStat, undefined);
|
||||||
function (value) {
|
|
||||||
this.view.statDirTree(value, undefined);
|
|
||||||
}.bind(this),
|
|
||||||
function (error) {
|
|
||||||
console.log(error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================== Text Area ================== */
|
/* ================== Text Area ================== */
|
||||||
@@ -113,16 +106,23 @@ class Controller {
|
|||||||
|
|
||||||
saveFile() {
|
saveFile() {
|
||||||
var textArea = this.view.simplemde;
|
var textArea = this.view.simplemde;
|
||||||
this.model.saveFile(this.openedFile, textArea.value());
|
this.model.saveFile(this.openedFile, textArea.value()).then(
|
||||||
this.openedFileValue = textArea.value();
|
function() {
|
||||||
this.saveButton();
|
this.openedFileValue = textArea.value();
|
||||||
|
this.view.closeEditor();
|
||||||
|
this.saveButton();
|
||||||
|
|
||||||
this.updateFileStats();
|
this.updateFileStats();
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================== Controls ================== */
|
/* ================== Controls ================== */
|
||||||
|
|
||||||
wipeFS() {
|
wipeFS() {
|
||||||
|
this.view.closeEditor();
|
||||||
|
|
||||||
this.model.wipeFS().then(function () {
|
this.model.wipeFS().then(function () {
|
||||||
this.redrawDirTree();
|
this.redrawDirTree();
|
||||||
}.bind(this));
|
}.bind(this));
|
||||||
|
|||||||
34
js/model.js
34
js/model.js
@@ -48,29 +48,33 @@ class Model {
|
|||||||
}
|
}
|
||||||
var tree = await this.dirList(baseDir);
|
var tree = await this.dirList(baseDir);
|
||||||
this.dirTree = tree;
|
this.dirTree = tree;
|
||||||
return tree;
|
|
||||||
|
await this.getGitStatusTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
async getGitStatusTree() {
|
async getGitStatusTree() {
|
||||||
var dirtree = await this.getDirTree();
|
this.gitDirTreeStat = await this.dirGitStatus(this.dirTree);
|
||||||
var tree = await this.dirGitStatus(dirtree);
|
|
||||||
|
|
||||||
return tree;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async dirGitStatus(list) {
|
async dirGitStatus(list) {
|
||||||
for (let i = 1; i < list.length; i++) {
|
let statList = [];
|
||||||
|
for (let i = 0; i < list.length; i++) {
|
||||||
if (Array.isArray(list[i])) {
|
if (Array.isArray(list[i])) {
|
||||||
await this.dirGitStatus(list[i]);
|
statList[i] = await this.dirGitStatus(list[i]);
|
||||||
} else {
|
} else {
|
||||||
list[i] = await git.status({
|
if (i == 0) {
|
||||||
fs,
|
statList[i] = list[0];
|
||||||
dir,
|
} else {
|
||||||
filepath: list[0].substring(1) + list[i],
|
statList[i] = await git.status({
|
||||||
});
|
fs,
|
||||||
|
dir,
|
||||||
|
filepath: list[0].substring(1) + list[i],
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return list;
|
|
||||||
|
return statList;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================== Text Area ================== */
|
/* ================== Text Area ================== */
|
||||||
@@ -79,8 +83,10 @@ class Model {
|
|||||||
return pfs.readFile(file, "utf8");
|
return pfs.readFile(file, "utf8");
|
||||||
}
|
}
|
||||||
|
|
||||||
saveFile(cesta, obsah) {
|
async saveFile(cesta, obsah) {
|
||||||
pfs.writeFile(cesta, obsah, "utf8");
|
pfs.writeFile(cesta, obsah, "utf8");
|
||||||
|
|
||||||
|
await this.getGitStatusTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================== Controls ================== */
|
/* ================== Controls ================== */
|
||||||
|
|||||||
Reference in New Issue
Block a user