Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

x of y progressbar #79

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 14 additions & 7 deletions core/resources/homepage/js/quickpick.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
/*
*
* * Copyright (c) 2021-2024 Bearsampp
* * License: GNU General Public License version 3 or later; see LICENSE.txt
* * Website: https://bearsampp.com
* * Github: https://github.com/Bearsampp
*
*/

/**
* Initializes event listeners and handles the UI interactions for the custom select dropdown.
* This function is executed when the DOM content is fully loaded.
Expand Down Expand Up @@ -117,6 +126,7 @@ function hideall() {
*
* @param {string} moduleName - The name of the module to install.
* @param {string} version - The version of the module to install.
* @returns {Promise<void>} - A promise that resolves when the installation is complete.
*/
async function installModule(moduleName, version) {
const url = AJAX_URL;
Expand Down Expand Up @@ -174,19 +184,14 @@ async function installModule(moduleName, version) {
const progressValue = data.progress;
progressbar.style.width = '100%';
if (isDownloading) {
progressbar.setAttribute('aria-valuenow', progressValue);
progressbar.innerText = `${progressValue} KBytes Downloaded`;
} else {
progressbar.setAttribute('aria-valuenow', progressValue);
progressbar.innerText = `${progressValue} Extracted`;
}
} else if (data.success) {

console.log(data);
isCompleted = true;
messageData = data.message;
// window.alert(data.message);

} else if (data.error) {
console.error('Error:', data.error);
window.alert(`Error: ${data.error}`);
Expand All @@ -197,13 +202,15 @@ async function installModule(moduleName, version) {
// Ignore JSON parse errors for incomplete parts
}
}

// Clear responseText to keep only the unprocessed part
responseText = parts[parts.length - 1].startsWith('{') ? parts[parts.length - 1] : '';
}
} catch (error) {
console.error('Failed to install module:', error);
window.alert('Failed to install module: ' + error.message);
} finally {
if (isCompleted === true)
{
if (isCompleted === true) {
confirm(messageData);
}
setTimeout(() => {
Expand Down
Loading