diff --git a/sveltejs/public/build/bundle.js b/sveltejs/public/build/bundle.js index 5cfe970d1bd668fb2a2e64351ac7a2cc9a8df694..03ea8024892214e6f3c205eb16e9be48ff9b90f3 100644 Binary files a/sveltejs/public/build/bundle.js and b/sveltejs/public/build/bundle.js differ diff --git a/sveltejs/public/build/bundle.js.map b/sveltejs/public/build/bundle.js.map index d12b193f55d82ab6fae62b40b29726e517643db7..97ecba48adbc78483f17139a24da0d15e4c6e8aa 100644 Binary files a/sveltejs/public/build/bundle.js.map and b/sveltejs/public/build/bundle.js.map differ diff --git a/sveltejs/src/QueueProcessor.js b/sveltejs/src/QueueProcessor.js index 5bc677812fdc32f69ce13af96fb2299a3620d9e8..3e5564189b0d36630da02f5a69c6f4eac9397e3a 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 6930bbf3369672d499c682e1ca8a49627531d2fc..58e87f9f09096fcb322ad247d3be533c508911ca 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()); + + } + }