Hi,

I have a situation where the row order doesn't reflect the weights of the actions. A newly added action can't be put in its place. Editing and saving the weights doesn't help: the new action remains at the bottom, although the weights of each row reflect the correct order.

When disabling drag & drop, I see following actions and weights:

  • Load a list of entity objects from a VBO View. [-20]
  • Loop
    • Add an incident to a field (action of Radioactivity module) [0]
  • Add an incident to a field (again Radioactivity) [-18]
  • Convert data type [-17]
  • Calculate a value. [-15]
  • Set a value. [-14]
  • Convert data type. [-16]

The last action should be located right below the "Calculate data type [-17]" row.

The first time I recognized this error was after using the Devel "debug" action for several values. I was unable to reorder those actions and thought it might be a restriction of Devel.

It doesn't matter if I'm using drag & drop or edit the weights manually: both don't work.

CommentFileSizeAuthor
#14 screen capture.jpg50.98 KBbisonbleu
#11 1568870-vbo_rules_ui.patch1006 byteskrlucas

Comments

Anonymous’s picture

Title: presence of VBO "Load a list of entity objects" breaks UI » Newly added action can't be reordered

I found a way around the issue: export the bad rule, edit the array (so the order is right) and then reimport it.

The original rule isn't overwritten yet. Drop me a note, if you want to have a look at the data or so.

PS: the imported version has the same issue

Anonymous’s picture

I've been able to pinpoint the issue to the existence of a "Load a list of entity objects from a VBO View." action. On an affected installation, adding this action breaks the Rules UI. Removing this action heals it. Adding it again breaks the UI again.

I was not able to reliably reproduce it. On one system I could reproduce, on the other I couldn't. If you want to try yourself, follow these steps:

- create a new User view with a page
- add a VBO field
- create a new Rules action set component
- add a "Load a list of entity objects from a VBO View." action
- select the view created above (no matter what display)
- add another action (eg. output some text to the website)
- move the other action above the VBO action
- save the component

Anonymous’s picture

Title: Newly added action can't be reordered » presence of VBO "Load a list of entity objects" breaks UI
Anonymous’s picture

Title: Newly added action can't be reordered » presence of VBO "Load a list of entity objects" breaks UI

When reordering and saving, it seems the weights of actions are saved, but the rule configuration isn't updated accordingly. Is this possible?

Anonymous’s picture

Again, sorry for spamming the issue queue. But there is one new effect to mention. I simply don't know, if it helps. So just posting and pointing at it...

Copying the affected rule is possible only by export and reimport (machine name renamed).

Afterwards it is not possible to rename the affected rules. I tried to rename them. The renaming in the surface seemed to succeed, but it wasn't stored: reloading the rule settings has shown the old name. Loading the rules list has shown the old name, too.

I then removed the VBO loading action. Afterwards the rule was healed, I could save it.

There might be some kind of validity check when storing the rule, making it fail. So I looked into the Watchdog-Log: no entry about this. The VBO action returns a list of values of a specific type (user in my case). Could it be there is type checking in place that fails?

Anonymous’s picture

Title: presence of VBO "Load a list of entity objects" breaks UI » presence of certain action (eg. VBO "Load a list of entity objects") may freeze rule configuration
Component: User interface » Rules Engine

Settings and title adjusted. The UI is actually working, but the backend doesn't store changes nor does it point at a failure.

mitchell’s picture

Title: presence of certain action (eg. VBO "Load a list of entity objects") may freeze rule configuration » "Load a list of entity objects" may freeze rule configuration
Project: Rules » Views Bulk Operations (VBO)
Version: 7.x-2.x-dev » 7.x-3.x-dev
Component: Rules Engine » Actions
Issue tags: +rules integration

Seems like it might be a bug in VBO and not Rules. Let's ask.

Anonymous’s picture

Although it might be a bug in VBO, Rules shouldn't fail to store the configuration or at least provide a reason why it can't be stored.

Best workaround is to wrap the VBO loading actions in an action-set (component). This way only the action-set wrapper freezes (can't be stored, cloned etc.), but the calling rule isn't affected anymore and can be used as usual.

krlucas’s picture

I can confirm that this is an issue. The weight of VBO actions of "Load list of entity..." are not saved after dragging dropping in the Rules UI and saved.

I have not seen this behavior with any other modules' actions so does seem to be VBO specific.

krlucas’s picture

Ok. So what seems to be happening is when VBO generates the list of Rules eligible Views in views_bulk_operations_views_list() it iterates over every enabled View and calls $view->build(). If the View is configured with a REQUIRED exposed filter, a form_set_error() is thrown which causes the Rules UI form to not validate.

Seems like the views_bulk_operations_views_list() should catch or clear form errors generated by view->build() or just skip Views with required exposed filters since they would be inherently ineligible.

krlucas’s picture

Status: Active » Needs review
StatusFileSize
new1006 bytes

Here's a patch for the issue described in #10. Seems kludgy to stash and reset form errors but traversing the view object to figure out if it had any required, exposed filters seemed equally gross.

Just to re-iterate the issue is that adding any VBO "Load a list" to a Rule configuration would break the drag and drop Rules UI form IF the site has any enabled Views with required, exposed filters.

To re-create:
Create a View of any type, give it an exposed filter that's required.
Create a VBO View if one does not exist.
Create a Rule set or Rules component with some non VBO actions.
Add a "Load a list of entity objects" action. Try dragging and dropping the actions to change the weight. The form save should fail silently without the weights being updated.

bojanz’s picture

Issue summary: View changes
Status: Needs review » Needs work

or just skip Views with required exposed filters since they would be inherently ineligible.

This is the way to go.

TravisJohnston’s picture

I am having a similar problem, though mine has to do when I go to create an Action Set, and click Add Action and choose the "Load a list of entity..." (either one of the 2 that show) the "please wait" toggle starts spinning then nothing happens.

Looking at the console log I see this:

Uncaught TypeError: Cannot read property 'dateformat' of undefined
Source is from VM788 line 198 typeof Drupal.settings.better_exposed_filters.datepicker_options.dateformat !== 'undefined') {

I tried updating BEF, but that didn't work.

bisonbleu’s picture

Title: "Load a list of entity objects" may freeze rule configuration » "Load a list of entity objects" freezes rule configuration
Status: Needs work » Active
StatusFileSize
new50.98 KB

I have the same issue as in #13. Rules freezes and the console shows the following error (screen capture is attached).

TypeError: Drupal.settings.better_exposed_filters.datepicker_options is undefined

Tried to apply the patch in #11...

Hunk #1 FAILED at 113.
Hunk #2 succeeded at 125 (offset 1 line).
1 out of 2 hunks FAILED

I had to apply it manually.
Nothing changes though i.e. Rules still freezes.
I've updated VBO, Rules and BEF to latest dev without success.

I'm stuck. Can anyone help?

(setting issue back to active.)

bisonbleu’s picture

Update#1

  • I somehow managed to free Rules from the BEF bind.
  • I went through all my enabled views and where Better exposed filters was set changed it back to Basic. In most cases I can live with the Basic settings.
  • I then Tested that I was able to add the action Load a list of entity objects from a VBO view. And I am : )
  • I reset one on my page displays from Basic to BEF. And I'm still able to add the above mentioned action. Strange...
  • I also reverted the patch and everything still works.

Time to eat & sleep.
I'll see tomorrow if all this still works after a night of sleep and all caches dispersed to oblivion : )

sebastix’s picture

I've run into the same issue as seen in comment #13.

Uncaught TypeError: Cannot read property 'dateformat' of undefined on this line:

typeof Drupal.settings.better_exposed_filters.datepicker_options.dateformat !== 'undefined') { ... }

It seems that the BEF (https://www.drupal.org/project/better_exposed_filters) module (7.x-3.0-beta4) is the cause of the error, because when not using this module, everything works as aspected.

I've managed to work around:

1. Make a component action set with a action which loads a VBO view (Load a list of entity objects from a VBO View.) on a Drupal project without the BEF module
2. Export this component
3. Import this component on a Drupal project with the BEF module enabled
4. Change the system name of the view you would like to load

My export / import code of the rule component

{ "rules_load_vbo_view" : {
    "LABEL" : "Load VBO view",
    "PLUGIN" : "action set",
    "OWNER" : "rules",
    "REQUIRES" : [ "views_bulk_operations" ],
    "ACTION SET" : [
      { "views_bulk_operations_action_load_list" : {
          "USING" : { "view" : "your_vbo_view|default" },
          "PROVIDE" : { "entity_list" : { "project_list" : "A list of entities" } }
        }
      }
    ]
  }
}
tomrog’s picture

I've also run into the same problem as seen in comment #13. Comment #16 helped me solve my issue.
I needed to count VBO view results, so if anyone else have the same issue, let me help you:

{ "rules_test_vbo" : {
    "LABEL" : "test vbo",
    "PLUGIN" : "reaction rule",
    "OWNER" : "rules",
    "REQUIRES" : [ "views_bulk_operations", "commerce_payment" ],
    "ON" : { "commerce_payment_order_paid_in_full" : [] },
    "IF" : [
      { "views_bulk_operations_condition_result_count" : { "view" : "your_view|default", "args" : "your_argument", "minimum" : "minimal_number_of_results" } }
    ],
    "DO" : []
  }
}
TravisJohnston’s picture

Anyone else have any luck?

I tried removing BEF and setting everything back to basic and it still doesn't work..

TravisJohnston’s picture

I got this working finally. Was banging my head on the keyboard after changing all the BEF views and uninstalled the BEF module and it was still throwing the AJAX 503 general error anytime I chose one of the VBO load Rule actions.

Ended up going through and disabling one by one every view that used VBO and would try the Rule again in between.

Turned out one of my VBO views had a broken handler in it. I wasn't using it anyways so I deleted the view and then I was able to use VBO in Rules again!