currently, loop exports lack don't include which variable to loop over.

Comments

fago’s picture

Status: Active » Needs review
StatusFileSize
new2.82 KB

Exactly, there were still some problems in the export. Attached patch should fix that though.

Status: Needs review » Needs work

The last submitted patch, rules_export.patch, failed testing.

fago’s picture

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

Fixed that + improved tests to cover exporting loops too. Also fixed exporting components providing variables.

fago’s picture

Status: Needs review » Fixed

Committed.

klausi’s picture

Title: Loops not exported correctly » Rule sets not imported correctly
Status: Fixed » Needs review
StatusFileSize
new372 bytes

The import of a rule set is now broken, 'RULE' is undefined and not correctly mapped. Patch attached.

fago’s picture

hm, I can't follow you in that case. The export key of a rule set is RULES not RULE, so RULE cannot be right. Also, this is cared for by the rule sets importChildren() method - which should be fine.

Also, in my tests everything worked. E.g. this export of an rule set worked fine for me:

{ "rules_testet" : {
    "LABEL" : "test",
    "PLUGIN" : "rule set",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : [],
    "RULES" : [
      {
        "DO" : [ { "user_unblock" : { "account" : [ "site:current-user" ] } } ],
        "LABEL" : "1"
      },
      { "DO" : [], "LABEL" : "2" }
    ],
    "PROVIDES VARIABLES" : []
  }
}
klausi’s picture

Here is an exported rule set with more than one rule:

{ "eq_job_service_delete" : {
    "LABEL" : "eq_job_service_delete",
    "PLUGIN" : "rule set",
    "REQUIRES" : [ "rules" ],
    "USES VARIABLES" : { "job_id" : { "type" : "integer", "label" : "Job id" } },
    "RULES" : [
      {
        "RULE" : {
          "PROVIDE" : { "entity_fetched" : { "job_node" : "Fetched entity" } },
          "DO" : [
            { "entity_fetch" : {
                "USING" : { "type" : "node", "id" : [ "job_id" ] },
                "PROVIDE" : { "entity_fetched" : { "job_node" : "Fetched entity" } }
              }
            }
          ]
        },
        "LABEL" : "unlabeled"
      },
      {
        "IF" : [
          { "data_is" : { "data" : [ "job_node:type" ], "value" : "job_per_link" } }
        ],
        "DO" : [ { "entity_delete" : { "data" : [ "job_node" ] } } ],
        "LABEL" : "unlabeled"
      }
    ]
  }
}
fago’s picture

Title: Rule sets not imported correctly » Import/export issues.
StatusFileSize
new7.45 KB

uhm, the label should not appear on that level. So obviously the export logic is still not there yet, attached patch should finally fix that though.

fago’s picture

Status: Needs review » Fixed

all green -> committed.

Status: Fixed » Closed (fixed)

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

mitchell’s picture

Component: Feature module support » Provided Module Integrations

Updated component.