#18 Upload Completion Bug Fix

This commit is contained in:
Dev-JamesR
2019-10-13 21:44:25 -07:00
parent 30f0c8c544
commit cbd296ab35
3 changed files with 132 additions and 124 deletions

View File

@@ -454,15 +454,13 @@ function finishUploadModal() {
$('#uploadTrackerModal').modal('hide');
stopApplication();
resetUploadSystem();
updateContractTable();
return false;
return;
}
function resetUploadModal() {
stopApplication();
resetUploadSystem();
updateContractTable();
return false;
return;
}
/*************************************************************************************************************/
//CHECK FOR PROPAGATED & AVAILABLE DATA ON NETWORK - FINAL VERIFICATION FOR UPLOADED CONTENT
@@ -711,6 +709,7 @@ const healthMessageHandler = (message) => {
healthMessage = message.data.toString();
UpdateHealthCheckInfo(healthMessage);
}
function UpdateHealthCheckInfo(healthMessage) {
var mainMessage = healthMessage.split(";")[1];
var splitMessage = mainMessage.split(",");
@@ -730,6 +729,7 @@ function UpdateHealthCheckInfo(healthMessage) {
updateStorageArrays(usedStorageTotal, availableStorageTotal, nodeCounter);
}
});
function updateStorageArrays(usedStorageTotal, availableStorageTotal, nodecount) {
if (availableStorageArray.length >= 50) {
@@ -748,6 +748,7 @@ function UpdateHealthCheckInfo(healthMessage) {
}
calculateStorageAverages(usedStorageArray, availableStorageArray, nodeCountArray);
}
function calculateStorageAverages(usedStorageArray, availableStorageArray, nodeCountArray) {
var sumAvailableStorage = 0;
@@ -802,16 +803,6 @@ const publishImmediatePin = (hash) => {
/* ===========================================================================
Files handling
=========================================================================== */
const sendFileList = () => FILES.forEach((hash) => publishHash(hash))
/*const updateProgress = (bytesLoaded) => {
let percent = 100 - ((bytesLoaded / fileSize) * 100)
if (percent <= 5) {
document.getElementById("upload-confirm-button").style.visibility = "visible";
}
$progressBar.style.transform = `translateX(${-percent}%)`
}*/
const resetProgress = () => {
$progressBar.style.transform = 'translateX(-100%)'
}
@@ -896,7 +887,7 @@ function startUploadProcess() {
let hashVerificationArray = [...GlobalHashArray, ...GlobalMainHashArray];
hashVerificationArray.push(GlobalMainContentHash);
var hashConfirmationCount = 0;
var uploadCompleteFlag = false;
for (var i = 0; i < MainHashArray.length; i++) {
console.log("Sending Immediate Pin Request: " + MainHashArray[i]);
@@ -923,19 +914,34 @@ function startUploadProcess() {
if (confirmationPercentage >= 99) {
$uploadMessage.innerText = "Upload Complete";
document.getElementById("upload-status-message").textContent = "Complete";
if(!uploadCompleteFlag) {
uploadCompleteFlag = true;
updateContractTable();
finishUploadModal();
}
return;
}
} else {
var confirmationPercentage = Math.ceil((hashConfirmationCount / hashVerificationArray.length) * 100);
if (confirmationPercentage < 99) {
setTimeout(function () {
verifyDataUpload(hash)
}, 2000);
} else {
return;
}
}
} catch (error) {
console.log(error);
console.log("Data Confirmation Error: " + error.status);
var confirmationPercentage = Math.ceil((hashConfirmationCount / hashVerificationArray.length) * 100);
if (confirmationPercentage < 99) {
setTimeout(function () {
verifyDataUpload(hash)
}, 2000);
} else {
return;
}
}
};
}
@@ -1049,6 +1055,9 @@ function startUploadProcess() {
}
function resetUploadProcess() {
updateUploadProgress(0);
$uploadMessage.innerText = "Preparing Upload";
document.getElementById("upload-status-message").textContent = "";
MainFileArray = new Array();
GlobalUploadSize = 0;
}
@@ -1346,6 +1355,7 @@ function startApplication() {
function extendedStartApplication() {
$ethomessage.innerText = GlobalUserAddress;
}
function stopApplication() {
resetUploadProcess();
resetFileTable();

View File

@@ -74,7 +74,6 @@ function start() {
updateView('ready', window.node)
onSuccess('Node is ready.')
setInterval(refreshPeerList, 10000)
setInterval(sendFileList, 10000)
})
.catch((error) => onError(error))
})

View File

@@ -72,7 +72,6 @@ function start() {
updateView('ready', window.node)
onSuccess('Node is ready.')
setInterval(refreshPeerList, 10000)
setInterval(sendFileList, 10000)
})
.catch((error) => onError(error))
})