Problem/Motivation
According to @bnjmnm, Project Browser was originally envisioned to have more of an "add to cart" UX - as you browse, you choose which projects you want, and then you can click a single button to do the whole installation. Due to evolutionary and historical reasons, this wasn't implemented; we instead go through a laborious process of creating and destroying a whole sandbox every time you install a single project.
Proposed resolution
With the backend changes made by #3472206: Change the project_browser.stage.require and project_browser.activate routes to accept a list of project IDs in place, we are in a position to actually have this shopping cart type of UX. So let's do it - each project that can be installed should show an "Add to queue" button -- we can workshop the wording later. As you click them, you build up the list of projects you'll install. At the bottom of the screen, you should see a single "Install 3 projects" button, which when clicked kicks off the process of creating a single sandbox with the selected projects.
Select projects to install

Installing phase, with loader

After install phase

| Comment | File | Size | Author |
|---|---|---|---|
| #37 | navigation.jpg | 406.78 KB | rkoller |
| #37 | toolbar.jpg | 405.83 KB | rkoller |
| #36 | after-install.png | 556.98 KB | narendrar |
| #36 | installing-project.png | 613.49 KB | narendrar |
| #36 | select-project.png | 603.09 KB | narendrar |
Issue fork project_browser-3330887
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #3
chrisfromredfinComment #4
narendrarComment #8
narendrarThis MR still needs work, but it would be helpful to get early feedback on code/functionality.
To test this feature, enable Allow multiple installs at once checkbox at
admin/config/development/project_browserComment #9
rkollerthank you! a few initial thoughts testing the current state.
QueueandDequeare quite abstract terms micro copy wise, same for the button label "Process queue". Plus "Process queue" sort of hides the fact that modules are being installed.oh and one fun fact. i've tried to process a queue but that had no effect (the button label jumed back to process queue after after a while). i then had one module queued then switched the number of modules shown per page count. that made the list of results reload. but the spinner spun indefinitely before any new results showed. so after while i simply did a reload and now i am presented with the installer and i am forwarded to
core/install.php:D that was completely unexpected. not sure if there is a way to provide any infos what might have caused that behavior? i dont want to just run a siteinstall and wipe the database (it seems to be it is still available and in place), wanted to wait on a feedback first. without the gui changes in front of me right now i am unable to ideate on potential other approaches ui wise for now.Comment #10
rkollerha it looks like it is reproducible. I have set up a new instance with the MR applied:
Comment #11
phenaproxima@rkoller, thanks for testing this. I think we might want to handle some of your feedback in follow-up issues (as well as re-titling this issue for clarity), since we're simply trying to get the plumbing in place to install multiple modules at once, which is a significant lift, and UI issues will take a back seat for this issue.
Tagging this for a follow-up to make sure that all your feedback is captured in another issue.
Comment #12
rkollerall good, thanks for the clarification! the only detail perhaps relevant within the scope of this issue is the problem outlined in #10, or is it only caused by the ui and isn't caused in the plumbing?
p.s. even if i run
drush sianother time i am still getting re directed to the install pageComment #13
narendrarStill more work needs to be done, but here is current functionality:
1. In branch 2.0.x, After clicking Add and Install and then reloading page. (Does not worked, need to Unlock Install stage)
2. In branch 2.0.x, After clicking Add and Install and then increasing pagination size from 12 to 24 (It worked, but status on button does not changed to installed, will create issue for that)
3. Add multiple modules with multiple install MR and click Process Queue button and wait. (It works as expected)
4. Repeated step 1 for multiple install MR. (Same problem as step 1, need to unlock stage)
5. Repeated step 2 for multiple install MR. (Same problem as step 1, need to unlock stage, but if you wait, modules will get installed)
Comment #14
phenaproximaI discussed this issue with @bnjmnm today.
In reviewing the code with @narendrar, I felt a certain tension between what the code is trying to do -- which, by the way, is a perfectly reasonable approach -- and the way Project Browser wants to work: install one thing at a time, creating and destroying a sandbox for each thing that gets installed. That has led to the current code needing to do some very tricky state management and tip-toeing around the possibility of page refreshes, etc.
Then Ben and I remembered something -- Package Manager can require multiple things at once into a single sandbox! That, I realized, is game-changing.
Instead of trying to create a queue of projects to require into the sandbox, I think we should actually keep the current approach, wherein you create the sandbox, require everything, and then apply the sandbox, in one go. The only difference should be that, rather than requiring one module at a time into the sandbox, we require several!
To put it another way: if the user selects Token, Metatag, and Pathauto in Project Browser, then the following single call should be made to Package Manager:
This has the major advantage that it will immediately fail if any of the chosen projects have dependency conflicts amongst themselves. It also means that we get to keep the front-end changes relatively simple, and don't need to implement a queue.
That said, the main blocker to being able to do this is the fact that Project Browser has a route for requiring a project into the sandbox, and it assumes you're only requiring a single project, whose ID is passed in the URL. We need to change that route so that it can accept a list of project IDs, not just a single one.
So I propose the following: let's open an issue that blocks this one, and which changes the
project_browser.stage.requireroute such that:/admin/modules/project_browser/install-require. (No more{source}or{id}parameters).In that same issue, let's also change the
project_browser.activateroute to work the same way, so we can activate multiple projects at once.Once we have that committed, we can come back to this issue, and then implement a much simpler set of changes that simply adjusts the current front-end code to pass a list of chosen projects to the backend. (The "Queue" and "Dequeue" stuff, and the "Install N projects" button, will function more or less the way they already do.)
I think this will get us where we need to be much more cleanly and quite a bit more simply. It's a win.
Comment #15
phenaproximaBlocker created: #3472206: Change the project_browser.stage.require and project_browser.activate routes to accept a list of project IDs
Comment #16
phenaproximaAnd, unblocked!
Comment #18
narendrarComment #21
narendrarTests failure seems unrelated to this MR changes. See #3469490: Nightwatch tests failing due to lack of "capabilities" - need Selenium driver and #3475852: [IGNORE] Test issue
Comment #24
phenaproximaI solved the failing tests!
Turns out the problems is that the GitLab CI template now runs Chromedriver in W3C mode (at least when the next major version of core is in use), which doesn't allow you to "click" an
optionelement. So I don't think our changes here introduced this problem - it was a latent thing waiting to be discovered. Having said that, the fix was easy; just handleoptionelements properly inclickWithWait(). We're good now.Beyond that, I think something in the JS could be a little more cleanly encapsulated but I don't think I have too much to complain about, overall. Coding standards checks are failing, too, but should be easy to resolve.
Comment #25
narendrarComment #26
phenaproximaI gave this another review and I'm a little concerned about certain scoping issues and a few other things. I don't want to hold up commit, but this feels like it could be a little tighter in some places...
Comment #27
chrisfromredfinI think in going "all in" on the multiple-at-a-time, it's good to remove / change the functionality of the "add and install" button. That button becomes more of a checkbox of what you're putting in your "Cart" (for lack of a better word), and we move the "Install >" action ("checkout") somewhere else (my current random thought is a sticky ribbon at the bottom of the page?)
Comment #28
phenaproximaComment #29
narendrarComment #30
phenaproximaI'm running low on things to complain about. You're probably sick of me kicking this back by now. But this really does make sense and I like the UX improvement we're doing here, yet there are a few things I can't sign off on -- at least not without more explanation.
Comment #31
narendrarRe #30,
Comment #32
phenaproximaOh, are these random failures?? If they are, I'm not clear on how changing the assertion is going to fix them.
Sure, but I'm curious why. Is it harder to flatten the queue than to segment it by tab? If so, why is that?
Comment #33
narendrarThese are failure in 2.0.x and nothing to do with changes we have done.
It's not hard to do, recommending it so that what you suggested can be done in a single issue. Currently we are showing
'Install selected projects'based on queued projects under specific plugin which otherwise needs to check each queued project and then needs to be updated.Comment #34
phenaproximaI ran a
git bisectand confirmed that #3318817: Improve the categories filter type in context to the rest of the filter component ui broke the results count.Tests passed in that issue, though, so it's not clear why it didn't break then and there, or indeed, in any subsequent issues. There have been several commits since that one.
However, I'm satisfied that we did not cause this problem. I don't fully trust that we've actually fixed it, and we still don't know the root cause, but I don't think there's any need to hold this issue up on that anymore. At least we've got a trail we can follow for forensic purposes now.
Comment #35
phenaproximaThere are a few assertions which could be made less flaky, and one follow-up to file.
Otherwise, I'd call this RTBC from a code perspective. There are things we could fine-tune and streamline and clean-up but this appears to accomplish what it sets out to do.
@narendrar, can you add screenshots?
Marking for manual testing as well.
Comment #36
narendrarI have addressed all feedback and added screenshots.
Comment #37
rkollerI've tested the latest changes. one detail to note, the install selected projects button is visible and reachable with the toolbar module installed
while it is not visible nor reachable with the navigation module installed on drupal 11.x
Comment #38
narendrarRe #37, Thanks for reporting this @rkoller. Actually the install selected projects button was hidden under admin toolbar which is fixed now.
Comment #39
narendrarComment #40
phenaproximaNo complaints at the code level.
This has been manually tested now by @rkoller, and he didn't find too much, which is a good sign because he usually finds a lot! It's also been reviewed, although I'm not sure how deeply, by @bnjmnm - his feedback has not yet been addressed. Since that will help make the tests less fragile, I'm kicking this back to just do what he has asked, and once that's done, this is ready in my opinion.
Comment #41
narendrarI tried to address Ben's feedback in previous commit.
Comment #42
phenaproximaOK, well, as far as I can tell we're good to go here. At long last, let's ship it.
Comment #43
chrisfromredfinI've manually tested this and while I don't LOVE the UI, my feedback is very likely minor, most likely considered feature requests, and can readily be dealt with as a follow-up. This is a big step for 2.0.x-dev as we move forward. To get the plumbing in there's no reason to wait on this.
Comment #45
chrisfromredfinHuge!