custom_event#
- class predict_backend.page.elements.custom_event.AssetDownloadCustomEvent(title, asset, extension, mime_type=None, show_title=True, show_description=True)#
Bases:
CustomEvent
Creates a custom event that generates a download link to an Asset’s data/object. The download link will return the bytes of the object if it is an instance of bytes, a text file if it is an instance of str or the dill pickled bytes of the python object.
- callback(flow_metadata)#
- Return type:
Union
[str
,dict
]
- class predict_backend.page.elements.custom_event.CustomEvent(title, description, show_title=True, show_description=True, position=CustomEventPosition.RIGHT, label='', placeholder='', **kwargs)#
Bases:
InputElement
Creates a custom event element that calls the passed in function using flow_metadata when clicked.
- Parameters:
title (
str
) – The title of the custom event element.description (
str
) – A description to go with this element on the page.show_title (
bool
) – Whether or not to show the title on the page when rendered, defaults to True.show_description (
bool
) – Whether or not to show the description to the page when rendered, defaults to True.position (
CustomEventPosition
) – The position the event button should be placed, defaults to CustomEventPosition.RIGHTlabel (
str
) – The label of the element, defaults to ‘’.placeholder (
str
) – The placeholder of the element, defaults to ‘’.
- abstract callback(flow_metadata)#
- Return type:
Union
[str
,dict
]
- class predict_backend.page.elements.custom_event.CustomEventPosition(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum
- CENTER = 'center'#
- LEFT = 'left'#
- RIGHT = 'right'#
- class predict_backend.page.elements.custom_event.CustomEventType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)#
Bases:
Enum
- ASSET_DOWNLOAD = 'asset-download'#
- STANDARD = 'standard'#
- class predict_backend.page.elements.custom_event.TriggerFlowCustomEvent(title, description, flow_name, input_parameters=None, timeout=30, show_title=True, show_description=True, position=CustomEventPosition.RIGHT, **kwargs)#
Bases:
CustomEvent
Creates a custom event that triggers another flow with optional pre-supplied input parameters. Then wait for the flow to stop and return a redirect url to the last started step.
- Parameters:
title (
str
) – The title of the custom event element.description (
str
) – A description to go with this element on the page.flow_name (
str
) – the Name of the Flow to be triggeredinput_parameters (
Optional
[dict
]) – an optional dictionary describing input parameters to be passed to the triggered flowtimeout (
int
) – timeout in seconds, the amount of time to wait for the triggered flow to stop [default = 30]show_title (
bool
) – Whether or not to show the title on the page when rendered, defaults to True.show_description (
bool
) – Whether or not to show the description to the page when rendered, defaults to True.position (
CustomEventPosition
) – The position the event button should be placed, defaults to CustomEventPosition.RIGHTkwargs –
- callback(flow_metadata)#
- Return type:
Union
[str
,dict
]