-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for advanced yaml constructors #150
Comments
This probably also necessitates that we provide a set of builtins that administrators can access immediately, as in the case of the list above. User list, document list by form name, and group list are probably all important. Relationship lists and relationship type lists are probably also important. |
It may make sense to externalize the constructor factory to a separate script so that we can do more complex things without bloating the pydantic script. For example, we can create some logic to ingest custom logic from end users this way... as well as to test this logic at app startup. Importantly, custom user logic should not be changeable from the UI, though it perhaps can be permitted to be changed at runtime without daemon restarts... It's this assumption (custom logic not changeable from UI) that makes it questionable whether we want plotly (#247) to be managed through this same system, or if we want to give users much more restricted ways to build plotly visualizations... |
We've added the basic functionality - quite a bit of complexity, but worthwhile, I think. This is very basic, though. To make these internal lookups useful, we need to add a handful of other form field parameters. For example: # a list of string fields (if the field doesn't exist, then just ignore them) to show as options.
form_display_fields: str | List[str] | None,
# if a str, then this should do a lookup and render the form in an iframe. Note this only really
# works for radio or select fields.
links_to_form: str | None,
# if True and config.OTHER_PROFILES_ENABLED=True, then render the other user's profile as
# a clickable badge. Note this works for radio or select fields, as well as for checkboxes.
links_to_user: bool, I think we should also add some way to limit the users by group. So, instead of running |
I think we've determined that visualizations are out of scope for this and should be handled separately. As we implement the items above, we should also add hooks for end users to add their own plugins. |
Add support for custom plugins from abc import ABC, abstractmethod
class Plugin(ABC):
def __init__(self):
pass
@abstractmethod
def setup(self):
"""
Setup the plugin with the application config.
This method needs to be implemented by all plugin subclasses.
"""
pass
@abstractmethod
def execute(self, data):
"""
Execute the plugin functionality.
This method needs to be implemented by all plugin subclasses.
"""
pass That we store in libreforms_fastapi/utils/plugins.py, and then an app config PLUGIN_PATH that, when set, imports the custom plugin library using sys. We need to think through this a little more. |
Add support for form_display_fields: str | List[str] | None, This should be a list of string fields (if the field doesn't exist, then just ignore them) to show as options instead of the (admittedly not very user friendly) document ID. |
Add support for links_to_form: str | None, If a str, then this should do a lookup and render the form in an iframe. Note this only really works for radio or select fields. Multiselect fields will struggle with it. |
Add support for links_to_user: bool, If True and config.OTHER_PROFILES_ENABLED=True, then render the other user's profile as a clickable badge. Note this works for radio or select fields, as well as for checkboxes. |
[bug] write_form_config_yaml allows unsupported constructors |
Originally posted by @signebedi in #37 (comment)
The text was updated successfully, but these errors were encountered: