vypis zmenenych souborů
This commit is contained in:
@@ -69,8 +69,10 @@
|
|||||||
<div class="commitWrapper">
|
<div class="commitWrapper">
|
||||||
<div class="commit">
|
<div class="commit">
|
||||||
<div class="close settingsClose">X</div>
|
<div class="close settingsClose">X</div>
|
||||||
|
Editted files:
|
||||||
|
<ul id="edittedFiles"></ul>
|
||||||
<div id="errorPublish">Test</div>
|
<div id="errorPublish">Test</div>
|
||||||
<form action="javascript:void(0);">
|
<form action="javascript:void(0);" id="formPublish">
|
||||||
<label for="inputCommitMsg">Poznámka k úpravám:</label>
|
<label for="inputCommitMsg">Poznámka k úpravám:</label>
|
||||||
<input type="text" id="inputCommitMsg" required>
|
<input type="text" id="inputCommitMsg" required>
|
||||||
<label for="inputUser">Git uživatelské jméno:</label>
|
<label for="inputUser">Git uživatelské jméno:</label>
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ class Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (localStorage.getItem("pushError") == "true") {
|
if (localStorage.getItem("pushError") == "true") {
|
||||||
this.view.openPublish();
|
this.openPublish();
|
||||||
this.view.errorPublish("Máte nepublikované změny: publikujte je.");
|
this.view.errorPublish("Máte nepublikované změny: publikujte je.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -115,7 +115,6 @@ class Controller {
|
|||||||
this.updateFileStats();
|
this.updateFileStats();
|
||||||
}.bind(this)
|
}.bind(this)
|
||||||
);
|
);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ================== Controls ================== */
|
/* ================== Controls ================== */
|
||||||
@@ -123,9 +122,11 @@ class Controller {
|
|||||||
wipeFS() {
|
wipeFS() {
|
||||||
this.view.closeEditor();
|
this.view.closeEditor();
|
||||||
|
|
||||||
this.model.wipeFS().then(function () {
|
this.model.wipeFS().then(
|
||||||
|
function () {
|
||||||
this.redrawDirTree();
|
this.redrawDirTree();
|
||||||
}.bind(this));
|
}.bind(this)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
cloneRep() {
|
cloneRep() {
|
||||||
@@ -174,10 +175,12 @@ class Controller {
|
|||||||
console.log(error);
|
console.log(error);
|
||||||
if (error == "HttpError: HTTP Error: 401 Unauthorized") {
|
if (error == "HttpError: HTTP Error: 401 Unauthorized") {
|
||||||
this.view.errorPublish("Změny nebyly publikovány: Chyba přihlášení.");
|
this.view.errorPublish("Změny nebyly publikovány: Chyba přihlášení.");
|
||||||
|
this.openPublish();
|
||||||
} else if (error == "HttpError: HTTP Error: 403 Forbidden") {
|
} else if (error == "HttpError: HTTP Error: 403 Forbidden") {
|
||||||
this.view.errorPublish(
|
this.view.errorPublish(
|
||||||
"Změny nebyly publikovány: Nemáte práva publikovat do tohoto repozitáře."
|
"Změny nebyly publikovány: Nemáte práva publikovat do tohoto repozitáře."
|
||||||
);
|
);
|
||||||
|
this.openPublish();
|
||||||
}
|
}
|
||||||
localStorage.setItem("pushError", "true");
|
localStorage.setItem("pushError", "true");
|
||||||
loading.style.removeProperty("display");
|
loading.style.removeProperty("display");
|
||||||
@@ -225,14 +228,14 @@ class Controller {
|
|||||||
let loading = document.getElementsByClassName("publishLoading")[0];
|
let loading = document.getElementsByClassName("publishLoading")[0];
|
||||||
|
|
||||||
if (localStorage.getItem("pushError") == "true") {
|
if (localStorage.getItem("pushError") == "true") {
|
||||||
if (gitUser.value == "" || gitPass.gitPass == "") {
|
if (gitUser.value == "" || gitPass.value == "") {
|
||||||
this.view.errorPublish("Vyplňte potřebné údaje.");
|
this.view.errorPublish("Vyplňte potřebné údaje.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
loading.style.display = "block";
|
loading.style.display = "block";
|
||||||
this.gitPush(gitUser.value, gitPass.value);
|
this.gitPush(gitUser.value, gitPass.value);
|
||||||
} else {
|
} else {
|
||||||
if (msg.value == "" || gitUser.value == "" || gitPass.gitPass == "") {
|
if (msg.value == "" || gitUser.value == "" || gitPass.value == "") {
|
||||||
this.view.errorPublish("Vyplňte potřebné údaje.");
|
this.view.errorPublish("Vyplňte potřebné údaje.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -258,6 +261,12 @@ class Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
openPublish() {
|
openPublish() {
|
||||||
this.view.openPublish();
|
this.model
|
||||||
|
.getChangedFiles(this.model.dirTree, this.model.gitDirTreeStat)
|
||||||
|
.then(
|
||||||
|
function (v) {
|
||||||
|
this.view.openPublish(v);
|
||||||
|
}.bind(this)
|
||||||
|
);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
22
js/model.js
22
js/model.js
@@ -77,6 +77,27 @@ class Model {
|
|||||||
return statList;
|
return statList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
async getChangedFiles(dirTree, statTree) {
|
||||||
|
var changedFiles = [];
|
||||||
|
|
||||||
|
for (let i = 1; i < dirTree.length; i++) {
|
||||||
|
if (Array.isArray(dirTree[i])) {
|
||||||
|
var vnorena = await this.getChangedFiles(dirTree[i], statTree[i]);
|
||||||
|
if (vnorena.length != 0) {
|
||||||
|
for (let i = 0; i < vnorena.length; i++) {
|
||||||
|
changedFiles.push(vnorena[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if (statTree[i] != "unmodified") {
|
||||||
|
changedFiles.push(dirTree[0] + dirTree[i]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return changedFiles;
|
||||||
|
}
|
||||||
|
|
||||||
/* ================== Text Area ================== */
|
/* ================== Text Area ================== */
|
||||||
|
|
||||||
readFile(file) {
|
readFile(file) {
|
||||||
@@ -158,6 +179,7 @@ class Model {
|
|||||||
email: localStorage.getItem("email"),
|
email: localStorage.getItem("email"),
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
await this.getGitStatusTree();
|
||||||
}
|
}
|
||||||
|
|
||||||
async gitPush(gitUser, gitPass) {
|
async gitPush(gitUser, gitPass) {
|
||||||
|
|||||||
20
js/view.js
20
js/view.js
@@ -147,6 +147,26 @@ class View {
|
|||||||
var publish = document.getElementsByClassName("commitWrapper")[0];
|
var publish = document.getElementsByClassName("commitWrapper")[0];
|
||||||
publish.style.display = "grid";
|
publish.style.display = "grid";
|
||||||
|
|
||||||
|
let form = document.getElementById("formPublish");
|
||||||
|
|
||||||
|
if (changedFiles.length == 0 && localStorage.getItem("pushError") != "true") {
|
||||||
|
this.errorPublish("Žádné soubory nebyly změněny.");
|
||||||
|
form.style.display = "none";
|
||||||
|
} else {
|
||||||
|
form.style.removeProperty("display");
|
||||||
|
|
||||||
|
let ul = document.getElementById("edittedFiles");
|
||||||
|
for (let i = 0; i < ul.children.length; i++) {
|
||||||
|
ul.lastChild.remove();
|
||||||
|
}
|
||||||
|
for (let i = 0; i < changedFiles.length; i++) {
|
||||||
|
let li = document.createElement("li");
|
||||||
|
var text = document.createTextNode(changedFiles[i]);
|
||||||
|
li.appendChild(text);
|
||||||
|
ul.appendChild(li);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
let gitMsg = document.getElementById("inputCommitMsg");
|
let gitMsg = document.getElementById("inputCommitMsg");
|
||||||
gitMsg.disabled = localStorage.getItem("pushError") == "true";
|
gitMsg.disabled = localStorage.getItem("pushError") == "true";
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user