Problem/Motivation

Some operations could take a lot of time (publishing 100 nodes) so users end up with timeout on admin pages

Proposed resolution

VBO in D7 has option to run operations via batch

Remaining tasks

Complex job in ViewExecutable::unserialize() causes data corruption
prepare a core patch

User interface changes

API changes

Data model changes

Comments

andypost created an issue. See original summary.

Version: 8.1.x-dev » 8.2.x-dev

Drupal 8.1.0-beta1 was released on March 2, 2016, which means new developments and disruptive changes should now be targeted against the 8.2.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

andypost’s picture

Status: Postponed » Active
dawehner’s picture

I'm wondering how much of #1823572: Port Views Bulk Operations to Drupal 8 we could extract and move slowly over time to core itself.

Version: 8.2.x-dev » 8.3.x-dev

Drupal 8.2.0-beta1 was released on August 3, 2016, which means new developments and disruptive changes should now be targeted against the 8.3.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.3.x-dev » 8.4.x-dev

Drupal 8.3.0-alpha1 will be released the week of January 30, 2017, which means new developments and disruptive changes should now be targeted against the 8.4.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

vierlex’s picture

Hi everyone!

I wrote ported some bare bones functionality from VBO 7 to Drupal 8.4.x
This is my first contribution ever so please nitpick about every little thing you can find,
which I am sure there are probably several :)

You can test it right away on the Content page.
Create some nodes and use the select-all checkbox in the header.
Some buttons will appear like they used to in VBO.

The bulk (hah!) of the changes can be found in docroot/core/modules/system/src/Plugin/views/field/BulkForm.php
in the functions viewsForm and viewsFormSubmit (on line 437 is probably the place to manage the actual batch processing)

andypost’s picture

Status: Active » Needs review
vierlex’s picture

As far as i can see this is actually blocked by https://www.drupal.org/node/2701829
which has this actual problem https://www.drupal.org/node/2849674

vierlex’s picture

Issue summary: View changes
scott_euser’s picture

Thank you for working on this functionality! Is your solution suitable without #9 being fixed?

vierlex’s picture

Hm no,.. now that i think about it, my changes are UI only, so no real "batching" takes place, an operation with a huge amount of nodes would still timeout.

My changes allow for selecting all those nodes a view returns even if a pager is used.

graber’s picture

I started working on VBO port for D8 a few months ago following this issue: https://www.drupal.org/node/1823572, sandbox: https://www.drupal.org/sandbox/graber/2862860, thought it'd be good to mention here.

I made a workaround for https://www.drupal.org/node/2701829 for now, more details in the original issue.

manuel garcia’s picture

Status: Needs review » Needs work

Let's do this!

Drive by quick review on the patch...

+++ b/core/modules/system/src/Plugin/views/field/BulkForm.php
@@ -292,6 +296,72 @@ public function viewsForm(&$form, FormStateInterface $form_state) {
+      $form['header'][$this->options['id']]['select_all_container'] = array(
...
+        '#attributes' => array(
+          'class' => array(
...
+          ),
+        ),
+      );
...
+      $this_page = t('Selected <strong>%row_count</strong> in this page.', array('%row_count' => $this_page_count));
...
+      $all_pages = t('Selected <strong>%row_count</strong> in this view.', array('%row_count' => $all_pages_count));
...
+      $form['header'][$this->options['id']]['select_all_container']['select_all'] = array(
...
+        '#attributes' => array('class' => 'select-all-rows'),
...
+      );
...
+      $form['header'][$this->options['id']]['select_all_container']['select_this_page'] = array(
...
+        '#attributes' => array('class' => array('bulk-select-this-page')),
...
+      );
+      $form['header'][$this->options['id']]['select_all_container'] ['select_all_pages'] = array(
...
+        '#attributes' => array('class' => array('bulk-select-all-pages')),
...
+      );
...
+      $form['header'][$this->options['id']]['select_all_container'] ['this_page'] = array(
...
+        '#attributes' => array('class' => array('bulk-this-page')),
...
+      );
+      $form['header'][$this->options['id']]['select_all_container'] ['all_pages'] = array(
...
+        '#attributes' => array('class' => array('bulk-all-pages')),
...
+      );

These need to use short array syntax.

jhedstrom’s picture

Issue tags: +Needs tests

Version: 8.4.x-dev » 8.5.x-dev

Drupal 8.4.0-alpha1 will be released the week of July 31, 2017, which means new developments and disruptive changes should now be targeted against the 8.5.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.0-alpha1 will be released the week of January 17, 2018, which means new developments and disruptive changes should now be targeted against the 8.6.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mglaman’s picture

Linking to #2239269: Have Views BulkForm optionally use batching with an option to chunk it. The other issues seems to be more correct in that it sets a batch properly.

Version: 8.7.x-dev » 8.8.x-dev

Drupal 8.7.0-alpha1 will be released the week of March 11, 2019, which means new developments and disruptive changes should now be targeted against the 8.8.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

Version: 8.8.x-dev » 8.9.x-dev

Drupal 8.8.0-alpha1 will be released the week of October 14th, 2019, which means new developments and disruptive changes should now be targeted against the 8.9.x-dev branch. (Any changes to 8.9.x will also be committed to 9.0.x in preparation for Drupal 9’s release, but some changes like significant feature additions will be deferred to 9.1.x.). For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

manuel garcia’s picture

Status: Needs work » Closed (duplicate)

Closing in favour of #2239269: Have Views BulkForm optionally use batching with an option to chunk it - let's continue the work there :)

andypost’s picture

The issue mostly about making JS frontens for views batching, so probably better to repurpose instead of closing

manuel garcia’s picture

Status: Closed (duplicate) » Needs work

True!

flocondetoile’s picture

Title: Add batch support for bulk operations » Allow selecting all entities in a given page or for every pages for bulk operations
flocondetoile’s picture

Title: Allow selecting all entities in a given page or for every pages for bulk operations » Allow selecting all entities in a given page or in every pages for bulk operations
graber’s picture

Maybe we should chose comprehensive approach and just change the title to "Move VBO to Drupal core"? :P

andypost’s picture

This title is better, but I think we should postpone it on #2239269: Have Views BulkForm optionally use batching with an option to chunk it which adds batching, then "select all" could be added here

dww’s picture

Title: Allow selecting all entities in a given page or in every pages for bulk operations » [PP-1] Allow selecting all entities in a given page or in every pages for bulk operations
Status: Needs work » Postponed

#28 sounds right to me. Changing status and title accordingly.

Version: 8.9.x-dev » 9.1.x-dev

Drupal 8.9.0-beta1 was released on March 20, 2020. 8.9.x is the final, long-term support (LTS) minor release of Drupal 8, which means new developments and disruptive changes should now be targeted against the 9.1.x-dev branch. For more information see the Drupal 8 and 9 minor version schedule and the Allowed changes during the Drupal 8 and 9 release cycles.

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.