#18 Upload Completion Bug Fix
This commit is contained in:
@@ -454,15 +454,13 @@ function finishUploadModal() {
|
|||||||
$('#uploadTrackerModal').modal('hide');
|
$('#uploadTrackerModal').modal('hide');
|
||||||
stopApplication();
|
stopApplication();
|
||||||
resetUploadSystem();
|
resetUploadSystem();
|
||||||
updateContractTable();
|
return;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function resetUploadModal() {
|
function resetUploadModal() {
|
||||||
stopApplication();
|
stopApplication();
|
||||||
resetUploadSystem();
|
resetUploadSystem();
|
||||||
updateContractTable();
|
return;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
/*************************************************************************************************************/
|
/*************************************************************************************************************/
|
||||||
//CHECK FOR PROPAGATED & AVAILABLE DATA ON NETWORK - FINAL VERIFICATION FOR UPLOADED CONTENT
|
//CHECK FOR PROPAGATED & AVAILABLE DATA ON NETWORK - FINAL VERIFICATION FOR UPLOADED CONTENT
|
||||||
@@ -711,6 +709,7 @@ const healthMessageHandler = (message) => {
|
|||||||
healthMessage = message.data.toString();
|
healthMessage = message.data.toString();
|
||||||
UpdateHealthCheckInfo(healthMessage);
|
UpdateHealthCheckInfo(healthMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
function UpdateHealthCheckInfo(healthMessage) {
|
function UpdateHealthCheckInfo(healthMessage) {
|
||||||
var mainMessage = healthMessage.split(";")[1];
|
var mainMessage = healthMessage.split(";")[1];
|
||||||
var splitMessage = mainMessage.split(",");
|
var splitMessage = mainMessage.split(",");
|
||||||
@@ -730,6 +729,7 @@ function UpdateHealthCheckInfo(healthMessage) {
|
|||||||
updateStorageArrays(usedStorageTotal, availableStorageTotal, nodeCounter);
|
updateStorageArrays(usedStorageTotal, availableStorageTotal, nodeCounter);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
function updateStorageArrays(usedStorageTotal, availableStorageTotal, nodecount) {
|
function updateStorageArrays(usedStorageTotal, availableStorageTotal, nodecount) {
|
||||||
|
|
||||||
if (availableStorageArray.length >= 50) {
|
if (availableStorageArray.length >= 50) {
|
||||||
@@ -748,6 +748,7 @@ function UpdateHealthCheckInfo(healthMessage) {
|
|||||||
}
|
}
|
||||||
calculateStorageAverages(usedStorageArray, availableStorageArray, nodeCountArray);
|
calculateStorageAverages(usedStorageArray, availableStorageArray, nodeCountArray);
|
||||||
}
|
}
|
||||||
|
|
||||||
function calculateStorageAverages(usedStorageArray, availableStorageArray, nodeCountArray) {
|
function calculateStorageAverages(usedStorageArray, availableStorageArray, nodeCountArray) {
|
||||||
|
|
||||||
var sumAvailableStorage = 0;
|
var sumAvailableStorage = 0;
|
||||||
@@ -802,16 +803,6 @@ const publishImmediatePin = (hash) => {
|
|||||||
/* ===========================================================================
|
/* ===========================================================================
|
||||||
Files handling
|
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 = () => {
|
const resetProgress = () => {
|
||||||
$progressBar.style.transform = 'translateX(-100%)'
|
$progressBar.style.transform = 'translateX(-100%)'
|
||||||
}
|
}
|
||||||
@@ -896,7 +887,7 @@ function startUploadProcess() {
|
|||||||
let hashVerificationArray = [...GlobalHashArray, ...GlobalMainHashArray];
|
let hashVerificationArray = [...GlobalHashArray, ...GlobalMainHashArray];
|
||||||
hashVerificationArray.push(GlobalMainContentHash);
|
hashVerificationArray.push(GlobalMainContentHash);
|
||||||
var hashConfirmationCount = 0;
|
var hashConfirmationCount = 0;
|
||||||
|
var uploadCompleteFlag = false;
|
||||||
|
|
||||||
for (var i = 0; i < MainHashArray.length; i++) {
|
for (var i = 0; i < MainHashArray.length; i++) {
|
||||||
console.log("Sending Immediate Pin Request: " + MainHashArray[i]);
|
console.log("Sending Immediate Pin Request: " + MainHashArray[i]);
|
||||||
@@ -923,19 +914,34 @@ function startUploadProcess() {
|
|||||||
if (confirmationPercentage >= 99) {
|
if (confirmationPercentage >= 99) {
|
||||||
$uploadMessage.innerText = "Upload Complete";
|
$uploadMessage.innerText = "Upload Complete";
|
||||||
document.getElementById("upload-status-message").textContent = "Complete";
|
document.getElementById("upload-status-message").textContent = "Complete";
|
||||||
|
if(!uploadCompleteFlag) {
|
||||||
|
uploadCompleteFlag = true;
|
||||||
|
updateContractTable();
|
||||||
finishUploadModal();
|
finishUploadModal();
|
||||||
}
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
|
var confirmationPercentage = Math.ceil((hashConfirmationCount / hashVerificationArray.length) * 100);
|
||||||
|
if (confirmationPercentage < 99) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
verifyDataUpload(hash)
|
verifyDataUpload(hash)
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.log(error);
|
console.log(error);
|
||||||
console.log("Data Confirmation Error: " + error.status);
|
console.log("Data Confirmation Error: " + error.status);
|
||||||
|
var confirmationPercentage = Math.ceil((hashConfirmationCount / hashVerificationArray.length) * 100);
|
||||||
|
if (confirmationPercentage < 99) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
verifyDataUpload(hash)
|
verifyDataUpload(hash)
|
||||||
}, 2000);
|
}, 2000);
|
||||||
|
} else {
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -1049,6 +1055,9 @@ function startUploadProcess() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function resetUploadProcess() {
|
function resetUploadProcess() {
|
||||||
|
updateUploadProgress(0);
|
||||||
|
$uploadMessage.innerText = "Preparing Upload";
|
||||||
|
document.getElementById("upload-status-message").textContent = "";
|
||||||
MainFileArray = new Array();
|
MainFileArray = new Array();
|
||||||
GlobalUploadSize = 0;
|
GlobalUploadSize = 0;
|
||||||
}
|
}
|
||||||
@@ -1346,6 +1355,7 @@ function startApplication() {
|
|||||||
function extendedStartApplication() {
|
function extendedStartApplication() {
|
||||||
$ethomessage.innerText = GlobalUserAddress;
|
$ethomessage.innerText = GlobalUserAddress;
|
||||||
}
|
}
|
||||||
|
|
||||||
function stopApplication() {
|
function stopApplication() {
|
||||||
resetUploadProcess();
|
resetUploadProcess();
|
||||||
resetFileTable();
|
resetFileTable();
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ function start() {
|
|||||||
updateView('ready', window.node)
|
updateView('ready', window.node)
|
||||||
onSuccess('Node is ready.')
|
onSuccess('Node is ready.')
|
||||||
setInterval(refreshPeerList, 10000)
|
setInterval(refreshPeerList, 10000)
|
||||||
setInterval(sendFileList, 10000)
|
|
||||||
})
|
})
|
||||||
.catch((error) => onError(error))
|
.catch((error) => onError(error))
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -72,7 +72,6 @@ function start() {
|
|||||||
updateView('ready', window.node)
|
updateView('ready', window.node)
|
||||||
onSuccess('Node is ready.')
|
onSuccess('Node is ready.')
|
||||||
setInterval(refreshPeerList, 10000)
|
setInterval(refreshPeerList, 10000)
|
||||||
setInterval(sendFileList, 10000)
|
|
||||||
})
|
})
|
||||||
.catch((error) => onError(error))
|
.catch((error) => onError(error))
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user