Support for select and its options on actions parameters
thomasWajs opened this issue · 4 comments
It seems that you don't support the "select" fieldType for the parameters of an action.
There is no way to specify an option list, and the dictionnary returned by BaseActions.get_all_actions does not handle this case.
Also, the fork at https://github.com/venmo/business-rules-ui would fail with correct data, because of this line : https://github.com/venmo/business-rules-ui/blob/master/lib/business-rules/actions-builder.js#L115 as the "field" var does not exists.
The most challenging part of the implementation would be the definition of the option list. Maybe a rework of the param dictionnary would be needed.
@thomasWajs You can give an example of what you're trying to accomplish? You can pass in options to the select type like this:
@select_rule_variable(options=[1,2,3])
def some_number(self):
return 2
Also - if you found a bug in business-rules-ui, we'd appreciate a pull request for a bug fix!
It's not about select type for rule variables for conditions, it's about select parameter for actions :
@rule_action(params={"target_folder": FIELD_SELECT})
def classify(self, target_folder):
target_folder.add_document(self.document)
In business-rules-ui, this case were handled in the original project, but not in your fork anymore. Before submitting any pull-request for the UI, it would be necessary to enable this feature in business-rules.
Ah I see. Do you wanna take a stab at implementing it?
I could take the time to contribute, but I'm concerned about the way to pass around these options.
The original business-rules-ui expected a dictionnary in the form
{'fields': [{label: "Email Template", name: "template", fieldType: "select", options: [
{label: "Welcome Email", name: "welcomeEmail"},
{label: "Followup Email", name: "followupEmail"},
...
]}
Which is not possible anymore since you modified the expected format to
'params': {'template': 'select'}}],
Which is way more restrictive. There's no way to specify distinct name/label, and there is no way to specify the options.
Any thought on reverting back to the original format ?