Comments

itangalo’s picture

Attached patch adds this functionality in the following way (see also attached screenshots):

* Every entity parameter in every Rules component becomes available as a Views field.
* Each field can be set to display entity ID, entity label, entity bundle or entity type.

itangalo’s picture

Status: Active » Needs review
fndtn357’s picture

fago’s picture

Assigned: itangalo » klausi
Status: Needs review » Needs work

interesting approach. I'm not sure about going this way though. First off, it's really not the usual way Views works. Second, once we go that route people 'll want relationships and stuff like that. So let's better not open that can of worms....

Maybe though, I'd be a good idea to work upon an improved storage for that data. I.e. have a table that has entries like 'data_type', 'value'. That should even make relationships possible + should be much easier to port to future rules versions as there are no special classes serialized...

Note that a bit problematic are data structures being no entities and having no id - we'd still have to store them serialized.

I wonder what klausi thinks about that idea.

itangalo’s picture

Thanks for the comments! I'll keep the worm can closed for now. :-)

klausi’s picture

Fago and I talked about this: to do a proper Views support we should move the parameters of scheduled tasks to a separate table (e.g. rules_scheduler_param). We should focus on entity parameters as they are most likely a use case here (e.g. list all scheduled tasks for a node, for a user etc.). So the colums of such a table would be:

task id
param name
param type
entity id (integer, only set if the param type is an entity)
param value (serialized, only set if the param type is not an entity)

We use 2 columns for the value here because we want to index the entity id column for fast access for our actual use case. Another advantage of this approach is that we do not have serialized entity wrapper classes in the DB anymore, which eases the upgrade path to Drupal 8 where the wrappers will not exist anymore.

itangalo’s picture

This sounds cool. It would be awesome to be able to access this information – as you say, listing upcoming scheduled tasks for a node definately makes sense.

klausi’s picture

Assigned: klausi » Unassigned

Unassigning myself as I currently don't have time to work on this ... Itangalo do you want to take a stab at this?

itangalo’s picture

I'm going into a hectic phase now, which will probably last until Christmas. I'll keep an eye on this, but I can't promis anything. Sorry.

wodenx’s picture

Status: Needs work » Needs review
StatusFileSize
new10.63 KB

Had a need for this myself, and implemented part of #6. Had to do it very quickly, so the parameters are still serialized in the rules_scheduler table, but now there is also a rules_scheduler_params table which is exposed to views. Relationships are also still to do, but this lays the groundwork, I think, and includes sort/filter handlers.

SharonD214@aol.com’s picture

I'm trying to use your patch for the Learn the Rules framework screencast ( Which is great!) but I'm having problems setting up the view for scheduling front page content. When I try to add the Rules parameter: Node (node)
Data from the parameter called Node (of type node), used in component rules_publish_on_front_page. - to my table I get a missing handler error.

Any ideas?

Thanks
Sharon

itangalo’s picture

Sharon: No, sorry. It was too long since I made this, so I don't remember. And probably the code has changed quite a bit. :-/

SharonD214@aol.com’s picture

ok -
It was worth as shot, Thanks anyway!

Sharon

f2boot’s picture

Issue summary: View changes
StatusFileSize
new19.11 KB

I have spent some time upgrading this patch, expending on the relationship side.
I have also registered rules scheduler task as an entity in order to use it with VBO (Views Bulk Operations)
I did my best by please review thoroughly

Status: Needs review » Needs work

The last submitted patch, 14: rules_rules_scheduler_params_for_views.patch, failed testing. View results

f2boot’s picture

StatusFileSize
new18.91 KB

Corrected patch for incorrect filepath...

f2boot’s picture

StatusFileSize
new18.82 KB
f2boot’s picture

StatusFileSize
new17.38 KB
f2boot’s picture

StatusFileSize
new17.46 KB

Last try, hope it is the good one
With apologies for those who follow this issue and have polluted mailbox because of me...

tr’s picture

Version: 7.x-2.x-dev » 8.x-3.x-dev

Moving to 8.x-3.x.