The bulk operations work that is in 0.4-beta2, does not show all tasks, such as Backup. Is this by design?

CommentFileSizeAuthor
#3 1005014-3.patch1.35 KBunivate
#1 1005014.patch1.05 KBunivate

Comments

univate’s picture

Status: Active » Needs review
StatusFileSize
new1.05 KB

The task form only include 'simple' tasks where you don't have to provide other information.

In the case of more complex tasks that need to do something else the current code checks if there is a form requesting any additional information and skips those tasks:

    foreach (hosting_available_tasks('site') as $task => $array) {
      // At this stage we only want to handle simple tasks, the presense of a
      // specific task form means there are other options for this tasks.
      $func = 'hosting_task_' . $task . '_form';
      if (!function_exists($func) && user_access('create '. $task .' task')) {
        $options[$task] = $array['title'];
      }
    }

Since backup was one of the operations that I wanted in this bulk operation form, so the following patch will now check over the form for '#required' = FALSE and if all the elements are not required it can now still add those item to the list. Its a little crude but works.

univate’s picture

Category: support » feature

Changing this issue to a feature request.

univate’s picture

StatusFileSize
new1.35 KB

This patch now also hide tasks that are marked as hidden, so 'install' and 'import' tasks will not show up in the list which takes care of the issue: #1003908: The bulk operations form for site listings shouldn't list install and import tasks

Anonymous’s picture

So can I confirm here '$func_required' means 'input required'? Would it be less cryptic to change it to $input_required ? Just musing out loud.

It didn't occur to me at the time that backup (of course) requires input and so was not shown here. I'm ok with that.. does that still require all that code to be there? Since it sounds like it worked as designed in the first place.

Finally, if you do want to perform this check, I wonder if there is a way to fetch the 'dialog' attribute from the task rather than check in the loop for a #required element in the form.

For instance, in hosting_site_hosting_tasks()


   $tasks['site']['backup'] = array(
     'title' => t('Backup'),
     'description' => t('Generate a backup of this site that can be restored to at any time'),
      'dialog' => TRUE,
    );

tasks with 'dialog' => TRUE require input, those that don't, don't. This might be a cleaner method of checking for user input required.

However this is just a high level review: I'm not sure if that information from hook_hosting_tasks() is even available to us when this check is performed

Anonymous’s picture

Actually I guess checking for dialog => TRUE would only leave two bulk tasks available: Verify and Login Reset :) so perhaps this isn't such a good idea after all.

univate’s picture

Exactly dialog -> true is also used on tasks that just have a confirmation box.

We should include tasks like backup, as while that has the option to add some text its only optional, so can be done in bulk quite easily. Its tasks like clone that require you to select a new platform and new url are probably not going to be possible to do in bulk.

univate’s picture

And yes, $input_required might be a better variable name for the above.

anarcat’s picture

Status: Needs review » Fixed

fix committed, thanks!

I have removed those funky === TRUE/FALSE calls that didn't seem to serve any purpose and were making the code harder to read. I also renamed a variable for clarity.

Status: Fixed » Closed (fixed)

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

  • Commit 07bdcdd on 6.x-2.x, 7.x-3.x, dev-ssl-ip-allocation-refactor, dev-sni, dev-helmo-3.x by anarcat:
    #1005014 - display the right tasks in bulk operations
    
    we do this by...
  • Commit 37f063e on 6.x-2.x, 7.x-3.x, dev-ssl-ip-allocation-refactor, dev-sni, dev-helmo-3.x by anarcat:
    Revert "#1005014 - display the right tasks in bulk operations"
    
    This...

  • Commit 07bdcdd on 6.x-2.x, 7.x-3.x, dev-ssl-ip-allocation-refactor, dev-sni, dev-helmo-3.x by anarcat:
    #1005014 - display the right tasks in bulk operations
    
    we do this by...
  • Commit 37f063e on 6.x-2.x, 7.x-3.x, dev-ssl-ip-allocation-refactor, dev-sni, dev-helmo-3.x by anarcat:
    Revert "#1005014 - display the right tasks in bulk operations"
    
    This...