diff --git a/sveltejs/public/build/bundle.js b/sveltejs/public/build/bundle.js index f02b6e1a4aed43e7cd59dd90f0a920bde43c99f8..d8049058fcb929924e8c87034e66f6d111e2ee70 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 1505edb5bfcafad348fb7934a78bcaf12b17feea..30f25e3f2575fd9faa2bfe997557a726c1484da9 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/InstallListProcessor.js similarity index 90% rename from sveltejs/src/QueueProcessor.js rename to sveltejs/src/InstallListProcessor.js index cb5ec7ccb4ef137daa6ba139cdfccc2d4a033acb..f9144060b26d7a5654fd7fe61f4df9c037cca7a1 100644 --- a/sveltejs/src/QueueProcessor.js +++ b/sveltejs/src/InstallListProcessor.js @@ -4,11 +4,11 @@ import { BASE_URL, CURRENT_PATH } from './constants'; export const updated = writable(0); -// Store for the queue list. -export const queueList = writable([]); +// Store for the install list. +export const installList = writable([]); -export function addToQueue(project) { - queueList.update((currentList) => { +export function addToInstallList(project) { + installList.update((currentList) => { if (!currentList.includes(project)) { currentList.push(project); } @@ -16,8 +16,8 @@ export function addToQueue(project) { }); } -export function removeFromQueue(projectId) { - queueList.update((currentList) => { +export function removeFromInstallList(projectId) { + installList.update((currentList) => { currentList = currentList.filter( (item) => item.id !== projectId, ); @@ -25,8 +25,8 @@ export function removeFromQueue(projectId) { }); } -export function clearQueue() { - queueList.update((currentList) => { +export function clearInstallList() { + installList.update((currentList) => { currentList = []; return currentList; }); @@ -77,8 +77,8 @@ export const handleError = async (errorResponse) => { } else { div.innerHTML += `<p>${errorMessage}</p>`; } - const currentQueueList = get(queueList) || []; - for (const project of currentQueueList) { + const currentInstallList = get(installList) || []; + for (const project of currentInstallList) { project.error = errorMessage; } @@ -198,17 +198,17 @@ export const doRequests = async (projectIds) => { } }; -export const processQueue = async () => { - const currentQueueList = get(queueList) || []; +export const processInstallList = async () => { + const currentInstallList = get(installList) || []; const projectsToActivate = []; const projectsToDownloadAndActivate = []; - if (currentQueueList.length === 0) { + if (currentInstallList.length === 0) { new Drupal.Message().add(Drupal.t('No projects selected'), { type: 'error' }); window.scrollTo({ top: 0, behavior: 'smooth' }); return; } - for (const proj of currentQueueList) { + for (const proj of currentInstallList) { if (proj.status === 'absent') { projectsToDownloadAndActivate.push(proj.id); } else if (proj.status === 'present') { @@ -227,8 +227,8 @@ export const processQueue = async () => { document.body.style.pointerEvents = 'auto'; - clearQueue(); - for (const project of currentQueueList) { + clearInstallList(); + for (const project of currentInstallList) { if(!project.error) { project.status = 'active'; } diff --git a/sveltejs/src/ProcessQueueButton.svelte b/sveltejs/src/ProcessInstallListButton.svelte similarity index 80% rename from sveltejs/src/ProcessQueueButton.svelte rename to sveltejs/src/ProcessInstallListButton.svelte index e12f7aad09f46ecdebe2e5ff3114595cc302eb51..74b85d3ec354ac4c9750cc2cecca7326cfe3cdc6 100644 --- a/sveltejs/src/ProcessQueueButton.svelte +++ b/sveltejs/src/ProcessInstallListButton.svelte @@ -1,10 +1,10 @@ <script> import { - processQueue, - queueList, + processInstallList, + installList, updated, - clearQueue, - } from './QueueProcessor'; + clearInstallList, + } from './InstallListProcessor'; import Loading from './Loading.svelte'; import LoadingEllipsis from './Project/LoadingEllipsis.svelte'; @@ -14,14 +14,14 @@ let buttonClasses; let bulkActionClasses = ''; - $: currentQueueList = $queueList || []; - $: queueLength = currentQueueList.length; + $: currentInstallList = $installList || []; + $: installListLength = currentInstallList.length; let projectsToActivate = []; let projectsToDownloadAndActivate = []; const handleClick = async () => { loading = true; - await processQueue(); + await processInstallList(); loading = false; $updated = new Date().getTime(); }; @@ -29,7 +29,7 @@ function clearSelection() { projectsToDownloadAndActivate = []; projectsToActivate = []; - clearQueue(); + clearInstallList(); $updated = new Date().getTime(); } @@ -48,17 +48,17 @@ <div class=" views-bulk-actions pb-install_bulk_actions {bulkActionClasses}" - data-drupal-sticky-vbo={queueLength !== 0} + data-drupal-sticky-vbo={installListLength !== 0} > <div class="views-bulk-actions__item views-bulk-actions__item--status views-bulk-actions__item-gin" > - {#if queueLength === 0} + {#if installListLength === 0} {Drupal.t('No projects selected')} {:else} {Drupal.formatPlural( - queueLength, + installListLength, '1 project selected', '@count projects selected', )} @@ -72,7 +72,7 @@ <Loading /> <LoadingEllipsis message={Drupal.formatPlural( - queueLength, + installListLength, 'Installing 1 project', 'Installing @count projects', )} @@ -81,7 +81,7 @@ {Drupal.t('Install selected projects')} {/if} </button> - {#if queueLength !== 0} + {#if installListLength !== 0} <button class="button clear_button" on:click={clearSelection}> {Drupal.t('Clear selection')} </button> diff --git a/sveltejs/src/Project/ActionButton.svelte b/sveltejs/src/Project/ActionButton.svelte index 0cc036c4e7768396a0dd4fac8ea649ad523e10ee..e00da38a34abe07182c1be4b31d59fbe9ce5a4ed 100644 --- a/sveltejs/src/Project/ActionButton.svelte +++ b/sveltejs/src/Project/ActionButton.svelte @@ -6,12 +6,12 @@ import ProjectIcon from './ProjectIcon.svelte'; import LoadingEllipsis from './LoadingEllipsis.svelte'; import { - processQueue, - addToQueue, - queueList, - removeFromQueue, + processInstallList, + addToInstallList, + installList, + removeFromInstallList, updated, - } from '../QueueProcessor'; + } from '../InstallListProcessor'; // eslint-disable-next-line import/no-mutable-exports,import/prefer-default-export export let project; @@ -20,34 +20,34 @@ const { Drupal } = window; const processMultipleProjects = MAX_SELECTIONS === null || MAX_SELECTIONS > 1; - $: isInQueue = $queueList.some((item) => item.id === project.id); + $: isInInstallList = $installList.some((item) => item.id === project.id); - // If MAX_SELECTIONS is null (no limit), then the queue is never full. - const queueFull = $queueList.length === MAX_SELECTIONS; + // If MAX_SELECTIONS is null (no limit), then the install list is never full. + const InstallListFull = $installList.length === MAX_SELECTIONS; let loading = false; - function handleAddToQueueClick(singleProject) { - addToQueue(singleProject); + function handleAddToInstallListClick(singleProject) { + addToInstallList(singleProject); $updated = new Date().getTime(); } - function handleDequeueClick(projectId) { - removeFromQueue(projectId); + function handleRemoveFromInstallList(projectId) { + removeFromInstallList(projectId); $updated = new Date().getTime(); } const onClick = async () => { if (processMultipleProjects) { - if (isInQueue) { - handleDequeueClick(project.id); + if (isInInstallList) { + handleRemoveFromInstallList(project.id); } else { - handleAddToQueueClick(project); + handleAddToInstallListClick(project); } } else { - handleAddToQueueClick(project); + handleAddToInstallListClick(project); loading = true; - await processQueue(); + await processInstallList(); loading = false; $updated = new Date().getTime(); } @@ -68,11 +68,11 @@ {:else} <span> {#if PACKAGE_MANAGER.available && PACKAGE_MANAGER.errors.length === 0} - {#if isInQueue && !processMultipleProjects} + {#if isInInstallList && !processMultipleProjects} <ProjectButtonBase> <LoadingEllipsis /> </ProjectButtonBase> - {:else if queueFull && !isInQueue && processMultipleProjects} + {:else if InstallListFull && !isInInstallList && processMultipleProjects} <ProjectButtonBase disabled> {@html Drupal.t( 'Select <span class="visually-hidden">@title</span>', @@ -83,7 +83,7 @@ </ProjectButtonBase> {:else} <ProjectButtonBase click={onClick}> - {#if isInQueue} + {#if isInInstallList} {@html Drupal.t( 'Deselect <span class="visually-hidden">@title</span>', { diff --git a/sveltejs/src/ProjectBrowser.svelte b/sveltejs/src/ProjectBrowser.svelte index e8de2b36cfbf04dcb1aa117ea4ee61b3ea11f945..ef579d0b0a5cb8c5dcc86c905ae36b792f666e0d 100644 --- a/sveltejs/src/ProjectBrowser.svelte +++ b/sveltejs/src/ProjectBrowser.svelte @@ -6,7 +6,7 @@ import Pagination from './Pagination.svelte'; import Project from './Project/Project.svelte'; import { numberFormatter } from './util'; - import { updated, queueList } from './QueueProcessor'; + import { updated, installList } from './InstallListProcessor'; import MediaQuery from './MediaQuery.svelte'; import { BASE_URL, @@ -145,7 +145,7 @@ */ onMount(async () => { if (MAX_SELECTIONS === 1) { - $queueList = []; + $installList = []; } const savedPageSize = localStorage.getItem('pageSize'); if (savedPageSize) { diff --git a/sveltejs/src/ProjectGrid.svelte b/sveltejs/src/ProjectGrid.svelte index 97f090fc9d121803db428f33313e0a9e7b83dbe9..351f46e0c137ef657f039938f038735b282052da 100644 --- a/sveltejs/src/ProjectGrid.svelte +++ b/sveltejs/src/ProjectGrid.svelte @@ -1,7 +1,7 @@ <script context="module"> import Search from './Search/Search.svelte'; import Loading from './Loading.svelte'; - import ProcessQueueButton from './ProcessQueueButton.svelte'; + import ProcessInstallListButton from './ProcessInstallListButton.svelte'; export { Search }; </script> @@ -73,7 +73,7 @@ <slot rows={visibleRows} /> </ul> {#if PACKAGE_MANAGER.available && processMultipleProjects} - <ProcessQueueButton /> + <ProcessInstallListButton /> {/if} {/if} <slot name="foot" /> diff --git a/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php b/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php index c4168321bbcc1ce7456dea491a595d42b215c391..d7f459c28bfcdf8b3bf43810b143bf4fef545c13 100644 --- a/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php +++ b/tests/src/FunctionalJavascript/ProjectBrowserInstallerUiTest.php @@ -417,9 +417,9 @@ class ProjectBrowserInstallerUiTest extends WebDriverTestBase { } /** - * Tests that adding projects to queue is plugin specific. + * Tests that adding projects to install list is plugin specific. */ - public function testPluginSpecificQueue(): void { + public function testPluginSpecificInstallList(): void { $assert_session = $this->assertSession(); $this->container->get('module_installer')->install(['project_browser_devel'], TRUE); $this->drupalGet('project-browser/project_browser_test_mock');