From 685bb9742e91f0aa1102ad33ee019110dc501c45 Mon Sep 17 00:00:00 2001 From: Cohee <18619528+Cohee1207@users.noreply.github.com> Date: Sun, 19 Nov 2023 01:33:54 +0200 Subject: [PATCH] Fix update button icons --- public/scripts/extensions.js | 14 ++++++++------ public/scripts/extensions/assets/index.js | 2 +- 2 files changed, 9 insertions(+), 7 deletions(-) diff --git a/public/scripts/extensions.js b/public/scripts/extensions.js index 22f71df94..2c68b949a 100644 --- a/public/scripts/extensions.js +++ b/public/scripts/extensions.js @@ -512,8 +512,8 @@ async function generateExtensionHtml(name, manifest, isActive, isDisabled, isExt isUpToDate = data.isUpToDate; displayVersion = ` (${branch}-${commitHash.substring(0, 7)})`; updateButton = isUpToDate ? - `` : - ``; + `` : + ``; originHtml = ``; } @@ -641,6 +641,7 @@ async function showExtensionsDetails() { */ async function onUpdateClick() { const extensionName = $(this).data('name'); + $(this).find('i').addClass('fa-spin'); await updateExtension(extensionName, false); } @@ -658,6 +659,11 @@ async function updateExtension(extensionName, quiet) { }); const data = await response.json(); + + if (!quiet) { + showExtensionsDetails(); + } + if (data.isUpToDate) { if (!quiet) { toastr.success('Extension is already up to date'); @@ -665,10 +671,6 @@ async function updateExtension(extensionName, quiet) { } else { toastr.success(`Extension ${extensionName} updated to ${data.shortCommitHash}`); } - - if (!quiet) { - showExtensionsDetails(); - } } catch (error) { console.error('Error:', error); } diff --git a/public/scripts/extensions/assets/index.js b/public/scripts/extensions/assets/index.js index fe6cd12ef..1c49917ce 100644 --- a/public/scripts/extensions/assets/index.js +++ b/public/scripts/extensions/assets/index.js @@ -67,7 +67,7 @@ function downloadAssetsList(url) { const asset = availableAssets[assetType][i]; const elemId = `assets_install_${assetType}_${i}`; let element = $('