Follow-up to #1828410: Provide a bulk_form element for actions

Problem

  • The available actions in the views bulk operations select widget cannot be configured/limited.

Details

  • Experience with admin_views leads me to believe that this should have two essential configuration modes:

    A) Inclusive selection
    or
    B) Exclusive selection

  • That is, because the typical use-case of administration views is "I don't care, give me each and every available action from all modules that you have and the current user is allowed to perform, EXCEPT these." (whereas "these" would be e.g., ban_ip_action() [whereas we just removed that particular example, but there are certainly more, such as "Show a message"... ;)])

Related issues

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

One possible UI would be to choose whether to include/exclude and a select element to choose which one to include/exclude?

At the moment VBO in d7 just supports including elements.

sun’s picture

VBO in d7 just supports including elements.

Yeah, and that's a detail that admin_views module is actually struggling with, because it inherently means that the default views provided by admin_views will only ever expose the actions that have been explicitly included. And because core can only know about core, the only actions that can reasonably be included are the actions defined in core.

Thus, if you've installed 100 additional modules, of which 10 provide additional actions, then those won't be exposed - even though they exist in the system.

The only way to expose them is to override the entire default view — just to get all available actions into that bulk update select.

This reminds a lot of the considerations in #1823608: Admin views in core... Default configuration for views generally seems to cross the boundaries of what can reasonably be configuration and what cannot (because the behavior of individual views plugins needs to be dynamic enough to account for a modular system — whereas (default) configuration is always hard-coded and final).

dawehner’s picture

Status: Active » Needs review
FileSize
3.83 KB

First version with a horrible UI and no tests.

Status: Needs review » Needs work

The last submitted patch, drupal-1845836-3.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
2.75 KB
5.6 KB

Fixed the test errors (just a left over dsm) and provided actual tests for this new feature.

The current UI looks like that.

sun’s picture

Perhaps silly question, but do we want to retain the ability to include all actions?

(Technically that's identical to choosing "exclude" and selecting no action to exclude, but that may not be clear to all users.)

dawehner’s picture

Even one radio + a list of checkboxes itself doesn't feel like the perfect UI,
so it seems to be that we should some feedback from the UX team for a proper way, first.

Bojhan’s picture

There is no UI to review? I dont see screens?

eaton’s picture

Perhaps silly question, but do we want to retain the ability to include all actions?

(Technically that's identical to choosing "exclude" and selecting no action to exclude, but that may not be clear to all users.)

We can still have a two-option UI -- 'All actions, except the following:' and 'Only the following:' would make it clearer without having to provide an explicit third option.

dawehner’s picture

FileSize
24.86 KB
5.54 KB

Well making screenshots is easy, but don't forget to upload them, that's hard ;)

sun’s picture

+++ b/core/modules/action/lib/Drupal/action/Plugin/views/field/BulkForm.php
@@ -21,6 +21,54 @@
+        'exclude' => t('All actions, except the following'),
+        'include' => t('Only the following'),

1) "All actions, except selected"

2) "Only selected actions"

+++ b/core/modules/action/lib/Drupal/action/Plugin/views/field/BulkForm.php
@@ -21,6 +21,54 @@
+      '#title' => t('Available actions'),
...
+      '#title' => t('Select actions.'),

1) Let's remove the trailing dot in the second label.

2) Finding proper labels for such a compound/dependent UI widget is tough ;)

But perhaps, it might already make sense with aforementioned adjustment of the options, and with the additional step of renaming the second label to:

"Selected actions"

Thus, "Selected actions" works for both "All actions, except selected" as well as "Only selected actions".

podarok’s picture

Status: Needs review » Needs work

agreed tp #11
all other looks good for RTBC

sun’s picture

Status: Needs work » Needs review
FileSize
4.79 KB

I'm not sure whether this works, but here's a re-roll against HEAD + #11 + a few more adjustments.

podarok’s picture

FileSize
25.28 KB

#13 works for me
bulk1.png

Status: Needs review » Needs work

The last submitted patch, drupal8.action-configure.13.patch, failed testing.

damiankloip’s picture

Status: Needs work » Needs review
FileSize
4.44 KB
6.48 KB

I think we needed a bit more logic to do the correct conditional filtering of the actions, as we were getting no actions for 'include'. I also changed the view field key to be 'action_bulk_form' and not just 'bulk_form', as that's what you would get if you actually just saved a view with this field.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Awesome!

podarok’s picture

+1RTBC

podarok’s picture

Category: feature » task

BTW
this is not feature request, it looks like a real task to make actions much more configurable via views

xjm’s picture

Issue tags: -vbo, -VDC

#16: 1845836-16.patch queued for re-testing.

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 1845836-16.patch, failed testing.

xjm’s picture

Status: Needs work » Needs review

#16: 1845836-16.patch queued for re-testing.

Status: Needs review » Needs work

The last submitted patch, 1845836-16.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
Issue tags: +vbo, +VDC

#16: 1845836-16.patch queued for re-testing.

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

This one was already RTBC before the random test failure time loop.

yoroy’s picture

Congrats on this issue title by the way :-)

dawehner’s picture

What about "Allow to configure actions to expose in the views bulk operations field handler configuration modal" ^^

xjm’s picture

Title: Allow to configure actions to expose in the views bulk operations select widget » Make the actions exposed in the views bulk operation handler configurable

"Allow to configure" isn't really idiomatic... is this what we're trying to say? ;)

xjm’s picture

#16: 1845836-16.patch queued for re-testing.

xjm’s picture

Priority: Normal » Major

This is pretty useful for #1851086: Replace admin/people with a View, which is major, so bumping the priority.

xjm’s picture

Priority: Major » Normal

And, never mind.

eaton’s picture

I will give a bag of jellybeans to the person who commits this patch.

xjm’s picture

FileSize
41.15 KB

Here's what this patch adds.

configurable_actions.png

yoroy’s picture

Status: Reviewed & tested by the community » Needs review

Thanks for the screenshot. Makes me wonder though: why the added complexity of 'All except selected' vs 'Selected'?

Is this list of options really that long that it's useful to add the 'all except selected' option? It reverses the meaning of what checking the box does.
It makes me think.
Don't make me think! :-)

Removing that bit can be a follow-up if need be, but if it is added with this patch, might as well remove it now.

damiankloip’s picture

Issue tags: -VDC

Yoroy, see the comments above. There was a lot of talk about this before.

yoroy’s picture

Thanks for the pointer. I don't understand wether/how the the issue discussed in #2 applies to how this ui is presented. The discussion after that is about wether select all is still needed, then usability feedback was requested. I gave some :-)

If there's a technical need to have both ways, I missed it. From a ux point of view this is featuritis that I think will slow people down instead of helpping them get the thing done.

damiankloip’s picture

Issue tags: +VDC

...because it inherently means that the default views provided by admin_views will only ever expose the actions that have been explicitly included. And because core can only know about core, the only actions that can reasonably be included are the actions defined in core.

yoroy’s picture

Issue tags: -VDC

Yes I read that. i don't understand how that makes it necessary to have the two ways to (not) select stuff.

damiankloip’s picture

Issue tags: +VDC

I don't understand why you wouldn't want this. It's not like it makes it ridiculously complex.

Some people might want to create a view that only exposes 1 operation. We want to ship with more for core, and not restrict other actions added by other modules. So I think it makes alot of sense to have the include/exclude logic for this.

tim.plunkett’s picture

Status: Needs review » Reviewed & tested by the community
FileSize
20.53 KB

Here is the problem if we don't have this extra toggle.

You decide that you never want to expose sticky and promoted, because your site doesn't use them. You check all the other boxes, and save your view, and you have what you want. Maybe you do this in more than one view.
Then you download and enable a new module that provides new actions that you want to expose. You now have to go through EVERY view, to click those checkboxes.

Or, you have this toggle, you select "All except selected" and check off sticky/promoted, and everything works as you continue adding modules.

This exact pattern has existed in core for a long time: Screen Shot 2013-04-10 at 9.46.09 AM.png

eaton’s picture

If there's a technical need to have both ways, I missed it. From a ux point of view this is featuritis that I think will slow people down instead of helpping them get the thing done.

In a nutshell, the previous Views Bulk Operations maintainers identified three basic ways that VBO views were being created:

  1. The user should be able to perform a specific set of actions
  2. The user should be able to perform any action currently supported by the site's installed modules
  3. The user should be able to perform any action supported by the installed modules except for a few dangerous ones.

It's very similar to the block visibility question -- "Appear everywhere, appear on select pages, appear on all BUT select pages." It's important to remember that the users of this feature will be site administrators who are themselves building administrative/management tools. VBO currently supports this distinction and it's used quite often; I'd hate to see it crippled in core.

Do you think there's a clearer or better way of capturing the distinction between these three selection approaches?

UPDATE: Ignore me, listen to Tim.

yoroy’s picture

Thanks for the explanation! I did recognize it from blocks ui. It makes a bit more sense there because you're applying settings against dozens if not hundreds of pages.

Damiankloip: if ridiculously complex is the treshold then yes, almost anything goes. But Drupal UX suffers especially from the total of small issues like these. I wanted to understand why it is needed, now I do. I think it might be solved more elegantly, but sure, rtbc.

webchick’s picture

Assigned: Unassigned » webchick

I like jellybeans!

Reviewing this now.

yoroy’s picture

Thanks eaton, that helps as well, it's good to point out that this is very much a site builder task. A better ui might well be possible. Lets not do that in here :-)

xjm’s picture

Assigned: webchick » xjm

We reviewed this patch live with @WEBCHICK!!! and @MOSHE WEITZMAN!!! and @EFFULGENTSIA! and it looks great EXCEPT we found some pre-existing bugs in HEAD which I'll document shortly. For now though, some minor nitpicks that I'll clean up so we can get this one in:

+++ b/core/modules/action/lib/Drupal/action/Plugin/views/field/BulkForm.phpundefined
@@ -21,19 +21,76 @@
+  public function validateOptionsForm(&$form, &$form_state) {

Missing docblock.

+++ b/core/modules/action/lib/Drupal/action/Plugin/views/field/BulkForm.phpundefined
@@ -21,19 +21,76 @@
     // Filter actions by entity type and build select options.

This comment should probably be updated to reflect the extended logic.

+++ b/core/modules/action/lib/Drupal/action/Tests/BulkFormTest.phpundefined
@@ -78,6 +78,30 @@ public function testBulkForm() {
+    // Setup to include just the sticky actions.
...
+    // Setup to exclude the sticky actions.

"Set up" should be two words.

More soon! <3

xjm’s picture

Back to @webchick.

Meanwhile, I'll file a couple followups for:

  1. Swap the feed and page display order on the frontpage view if possible. Seriously, I edit the feed display by mistake EVERY TIME. :)
  2. HTML validation cancel failure in the Views UI.
  3. Empty views with bulk options say "Array"! Yay, hooray, array!
webchick’s picture

Status: Reviewed & tested by the community » Fixed

Since this is just changing comments, I'm going to live dangerously and commit without waiting for testbot. ;)

Committed and pushed to 8.x. Thanks!

xjm’s picture

Status: Fixed » Reviewed & tested by the community
xjm’s picture

Status: Reviewed & tested by the community » Fixed

Oopsie.

xjm’s picture

xjm’s picture

sun’s picture

Glad to see this finally in. Thanks everyone for sticking with it! :)

@yoroy:
I agree that the exposure of these settings is probably not optimal. I think your concerns mainly revolved around:

You present a control to me, which is supposed to mean one thing. But yet, this control has a completely different meaning, which depends on a different control on the UI.

That's a very legit UX concern, I think. Our existing controls and this new one in core aren't particularly good in presenting + clarifying the important relationship between the two (or possibly even more) controls. Thus, unless you read very carefully, there's a good chance for configuration mistakes and user confusion.

The "All except selected" option also does not account for the potential case of:

  1. Having 273 views, configured to expose "All except selected" bulk actions.
  2. Installing havoc_action.module.

Alas, you still need to re-configure 273 views to not expose the new havoc action. :-/

The only hope right now is that it's actually only Drupal core that exposes nonsensical actions. (which is nonsensical on its own :P)

Ultimately, I can't see a solid long-term solution that wouldn't involve a full-blown module installation + site reconfiguration wizard, which would allow you to perform bulk configuration changes, as a "Post-installation Task Manager", if you will.

Automatically closed -- issue fixed for 2 weeks with no activity.