From cf9864002c912f1fe64a6f1f7fad76bb42d1ed7e Mon Sep 17 00:00:00 2001 From: utkarsh_33 <60460-Utkarsh_33@users.noreply.drupalcode.org> Date: Tue, 28 Jan 2025 13:58:07 +0000 Subject: [PATCH] Issue #3499411: After composer error on install, card incorrectly reflects "Installed" status --- sveltejs/public/build/bundle.js | Bin 297852 -> 298052 bytes sveltejs/public/build/bundle.js.map | Bin 272084 -> 272463 bytes sveltejs/src/QueueProcessor.js | 8 +++++- .../ProjectBrowserInstallerUiTest.php | 27 ++++++++++++++++++ 4 files changed, 34 insertions(+), 1 deletion(-) diff --git a/sveltejs/public/build/bundle.js b/sveltejs/public/build/bundle.js index 5cfe970d1bd668fb2a2e64351ac7a2cc9a8df694..03ea8024892214e6f3c205eb16e9be48ff9b90f3 100644 GIT binary patch delta 96 zcmew}P3XuBp$+=;Ca+xUJ~?Njl}Kt)QGStvtpb?#O)V}?Oi$gcI<Hb#JTpy0v7jhF uD>b=94=k&xP|c;FFnQWWO=bm!+R1`5M4QiUY(Kk^5r~<#pWVp3{w4r+NGHSq delta 39 vcmX>yL+H;mp$+=;HlLf9FFZMBlj3BF8GOxCH?>dQ#0bPp+ox_~UVjq+fTR;P diff --git a/sveltejs/public/build/bundle.js.map b/sveltejs/public/build/bundle.js.map index d12b193f55d82ab6fae62b40b29726e517643db7..97ecba48adbc78483f17139a24da0d15e4c6e8aa 100644 GIT binary patch delta 228 zcmca|R^a>vfrc%N#WB-wWHFjd_sC;37fCHD$}du|RRGhzsl~;K>8abZV;FgaBr?-9 z6bp*-vr>~w^uW@Z3e_=r3JTMU^B9$w6%=aQC+0D3pP0v_(>;APJ2TgGFBWEp=~W!e zrqh*7nT6S`Jsq91oToovWft9j<|k7h7o+3$XclHK7Cv`JM|T}(M@MHJe@93E>52JF zA_7i2zK)K*U;(hy^ul{gBGW%CXJX;WaMtm5bo2(9=QI5T2eSf8man$+bbohd$>{-{ R%<SzvoXp#KI9X1}0szyCMZ5q2 delta 118 zcmX?qLEy?+frc%N#WCA|#W1o6O_$1Nlxw%oXWVX|&!o{k-JOG(f4j(UrarFejlY-- zwqIgpmS&lL=NA*#bOkPEaWzXP9d}1ZcWX~aXAd1`M@MIC6kz7+Z0w`$JiS1jS+c!> Mi+Otk7t48B09NfJjQ{`u diff --git a/sveltejs/src/QueueProcessor.js b/sveltejs/src/QueueProcessor.js index 5bc677812..3e5564189 100644 --- a/sveltejs/src/QueueProcessor.js +++ b/sveltejs/src/QueueProcessor.js @@ -48,6 +48,10 @@ export const handleError = async (errorResponse) => { } else { div.innerHTML += `<p>${errorMessage}</p>`; } + const currentQueueList = get(queueList) || []; + for (const project of currentQueueList) { + project.error = errorMessage; + } openPopup(div, { title: 'Error while installing package(s)' }); }; @@ -196,6 +200,8 @@ export const processQueue = async () => { clearQueue(); for (const project of currentQueueList) { - project.status = 'active'; + if(!project.error) { + project.status = 'active'; + } } }; diff --git a/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php b/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php index 6930bbf33..58e87f9f0 100644 --- a/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php +++ b/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php @@ -485,4 +485,31 @@ class ProjectBrowserInstallerUiTest extends WebDriverTestBase { $this->assertTrue($was_selected); } + /** + * Tests that the install state does not change on error. + */ + public function testInstallStatusUnchangedOnError(): void { + $assert_session = $this->assertSession(); + $page = $this->getSession()->getPage(); + + // Start install begin. + $this->drupalGet('admin/modules/project_browser/install-begin', [ + 'query' => ['source' => 'project_browser_test_mock'], + ]); + $this->drupalGet('admin/modules/browse/project_browser_test_mock'); + $this->svelteInitHelper('text', 'Cream cheese on a bagel'); + // Try beginning another install while one is in progress, but not yet in + // the applying stage. + $cream_cheese_module_selector = '#project-browser .pb-layout__main ul > li:nth-child(1)'; + $cream_cheese_button = $page->find('css', "$cream_cheese_module_selector button.pb__action_button"); + $cream_cheese_button?->click(); + // Close the dialog to assert the state of install button. + $page->find('css', '.ui-dialog-titlebar-close')?->click(); + $download_button = $assert_session->waitForElementVisible('css', "$cream_cheese_module_selector button.pb__action_button"); + $this->assertNotEmpty($download_button); + // Assertion that the install state does not change. + $this->assertSame('Install Cream cheese on a bagel', $download_button->getText()); + + } + } -- GitLab