wtform_fields module - Platform - BlueCat Gateway - 18.2.1

Gateway Administration Guide

prodname
BlueCat Gateway
version_custom
18.2.1

This is where all the UI Components Fields and their base classes are located.

Custom WTForm fields.

classwtform_fields.AliasRecord(label='', validators=None, result_decorator=None, **kwargs)

Bases: wtform_fields.ValidatingStringField

StringField for inputting Alias Records with client side validation and autochecks that it is available.

classwtform_fields.Configuration(label=None, validators=None, **kwargs)

Bases: wtform_fields.CustomSelectField

SelectField that is auto-populated with configuration data.

widget= <bluecat.ui_components.wtform_widgets.SuperSelect object>

classwtform_fields.CustomBooleanField(label='', validators=None, on_checked=None, on_unchecked=None, **kwargs)

Bases: wtforms.fields.core.BooleanField, wtform_fields.extended_field.ExtendedField

Custom boolean/checkbox class that extends WTForms to generate html and javascript checkbox code.

generate_call_function_js()

Generate Javascript for call function.

Returns: Javascript for call function

generate_checkbox_javascript()

Generates javascript to handle the checking/un-checking and populating of the checkbox.

Returns: Javascript code to handle changes to checkbox.

generate_event_listener_js()

Generate Javascript to call side_effect function on change.

Returns: Javascript to call side effect function on change.

generate_populate_function_js()

Generate Javascript for populate function.

Returns: Javascript for populate function.

classwtform_fields.CustomButtonField(label=None, validators=None, **kwargs)

Bases: wtforms.fields.core.BooleanField, wtform_fields.ExtendedField

A simple button object with no attached javascript.

widget= <bluecat.ui_components.wtform_widgets.SuperInput object>

classwtform_fields.CustomSearchButtonField(label=None, validators=None, message_field='', clear_below_on_change=False, **kwargs)

Bases: wtform_fields.CustomButtonField

Button implementing a remote query from input data of a single field.

generate_call_function_js

Generate Javascript for call function.

Returns: Javascript for call function.

generate_clear_below_js

Add disable all below code.

Returns: Javascript for CustomSearchButtonField.

generate_event_listener_js

Generate Javascript to call side_effect function on change.

Returns: Javascript to call side effect function on change

generate_populate_function_js

Generate Javascript for populate function. Generate empty populate function in case another js function tries to call the searchButtons populate function.

Returns: Javascript for populate function.

generate_side_effect_function_js

Generate Javascript for side effect function.

Returns: Javascript for side_effect function.

classwtform_fields.CustomSelectField(label=None, validators=None, choices_function=None, default_not_selected='1', clear_below_on_change=False, **kwargs)

Bases: wtforms.fields.core.SelectField, wtform_fields.ExtendedField

SelectField that is auto-populated with configuration data.

generate_call_function_js()

Generate Javascript for call function.

Returns: Javascript for call function.

generate_clear_below_js()

Add disable all below code.

Returns: Javascript.

generate_event_listener_js()

Generate Javascript to call side_effect function on change.

Returns: Javascript to call side effect function on change.

generate_populate_function_js

Generate Javascript for populate function.

Returns: Javascript for populate function.

generate_side_effect_function_js

Generate Javascript for side effect function.

Returns: Javascript for side_effect function.

widget= <bluecat.ui_components.wtform_widgets.SuperSelect object>

classwtform_fields.CustomStringField(label='', **kwargs)

Bases: wtforms.fields.core.StringField, wtform_fields.ExtendedField

String field which will fetch the value of another field as put it as it’s own when the call_{id} function is called.

generate_call_function_js()

Generate the call function.

Returns: Javascript for call function.

generate_populate_function_js()

Generate Javascript for populate function.

Returns: Javascript for populate function

widget= <bluecat.ui_components.wtform_widgets.SuperTextInput object>

classwtform_fields.CustomSubmitField(label='', validators=None, **kwargs)

Bases: wtforms.fields.core.SubmitField, wtform_fields.extended_field.ExtendedField

Field to render submit button.

generate_call_function_js()

Generate Javascript for call function.

Returns: Javascript for call function.

generate_populate_function_js()

Generate Javascript for populate function.

Returns: Javascript for populate function

widget= <bluecat.ui_components.wtform_widgets.SuperSubmit object>

classwtform_fields.ExtendedField(label=None, validators=None, inputs=None, enable_on_complete=None, on_complete=None, on_change=None, on_validate=None, on_click=None, classes='', required='', is_disabled_on_error=False, is_disabled_on_start=True, server_outputs=None, server_side_method=None, result_decorator=None, server_side_output_method=None, output_result_decorator=None, workflow_name='', permissions='', readonly=False, enable_dependencies=None, disable_dependencies=None, should_cascade_disable_on_change=False, clear_dependencies=None, should_cascade_clear_on_change=False, display_message=False, **kwargs)

Bases: wtforms.fields.core.Field

Generic Field with extra functionality to be inherited.

clear_component_message()

Create JS to clear a message for a ui component.

Returns: Javascript code.

clear_dependents_generator(dependents, trigger)

Generates javascript function for clearing a field’s dependent fields.

Parameter Description
dependents List of ids of the field’s dependents.
trigger Type of event needed to occur on the field to trigger the function e.g. on_change, on_complete.

Returns: Javascript function code as Python string.

clear_self_and_dependants_generator(has_dependents=False, trigger='on_change', cascade=False)

Generates javascript function for clearing a field and calling the generated function for clearing its dependent fields.

Parameter Description
has_dependents Whether the field has dependents to be cleared along with it.
trigger Type of event needed to occur on the field to trigger the function e.g. on_change, on_complete.
cascade Whether the field’s dependents should be cleared along with it. Will clear dependents if True.

Returns: Javascript function code as Python string.

enable_disable_dependents_generator(dependents, trigger, should_disable=True)

Generates javascript function for enabling or disabling a field’s dependent fields.

Parameter Description
dependents List of ids of the field’s dependents.
trigger Type of event needed to occur on the field to trigger the function e.g. on_change, on_complete.
should_disable Whether the dependents should be enabled or disabled.

Returns: Javascript function code as Python string.

enable_disable_self_and_dependants_generator(has_dependents=False, trigger='on_change', should_disable=True, cascade=False)

Generates javascript function for enabling or disabling a field and calling the generated function for disabling its dependent fields.

Parameter Description
has_dependents Whether the field has dependents to be disabled along with it.
trigger Type of event needed to occur on the field to trigger the function e.g. on_change, on_complete.
should_disable Whether the dependents should be enabled or disabled.
cascade Whether the field’s dependents should be disabled along with it. Disables dependents if True.

Returns: Javascript function code as Python string.

classmethodfill_in_missing_triggers(trigger_dict)

Check the trigger_dict to see if it is missing any of the triggers defined for the class.

Parameter Description
trigger_dict A dictionary containing the triggers to be checked.

Returns: The given trigger_dict with missing triggers added as keys in the dictionary with an empty list as the value.

generate_call_function_js()

Generate Javascript for call function

Returns: Javascript for call function.

generate_common_clear_code()

Generator used to generate field clearing code, should be used by child classes that inherit it to generate complete javascript for fields.

Returns: Generated javascript for the field.

generate_common_disable_code()

Generator used to generate field disabling code, should be used by child classes that inherit it to generate complete javascript for fields.

Returns: Generated javascript for the field.

generate_common_display_message_code()

Generator used to generate field disabling code, should be used by child classes that inherit it to generate complete javascript for fields.

Returns: Generated javascript for the field.

generate_common_enable_code()

Generator used to generate field enabling code, should be used by child classes that inherit it to generate complete javascript for fields.

Returns: Generated javascript for the field.

generate_common_server_output_code()

Generator used to generate server output code, should be used by child classes that inherit it to generate complete javascript for fields.

Returns: Generated javascript for the field.

generate_event_listener_js()

Generate Javascript to listen and execute code on events.

Returns: Javascript for event listening.

generate_populate_function_js()

Generate Javascript for populate function.

Returns: Javascript for populate function.

javascript_generator()

Generates default javascript standard for every field.

Returns: Generated javascript for the field.

populate_component_message()

Create JS to populate a message for a ui component..

Returns: Javascript code.

populate_fields_generator(outputs, trigger='on_complete')

Function for populating multiple fields from a mapping of given data to fields.

Parameter Description
outputs Mapping of data properties to which field they should go to.
trigger Type of event needed to occur on the field to trigger the function e.g. on_change, on_complete.

Returns: Javascript function output_<element_id> that handles the populating of multiple fields.

post_call_generator(output_functions=None)

Generates javascript function that makes a one-off POST call to an endpoint generated from the workflow_name and element_io with the given inputs. On successfully callback, will call a function with name “populate_<element_id>” with the returned results.

Parameter Description
output_functions List of functions to call with data returned from POST call.

Returns: Javascript function code as Python string.

server_output_javascript(outputs=None, trigger='on_complete')

Javascript function for a specific field that can be called to populate an arbitrary number of other fields based on server output from the specified endpoint.

Parameter Description
outputs Mapping of returned data properties to which field they should go to.
trigger The trigger for when the function should be called.

Returns: Javascript function code as Python string.

triggers= ['on_change', 'on_validate', 'on_complete', 'on_checked', 'on_unchecked']

classwtform_fields.FilteredSelectField(filter_field='', message_field='', label='', size=6, **kwargs)

Bases: wtform_fields.filtered_select_field.NoPreValidationSelectField, wtform_fields.extended_field.ExtendedField

FilteredSelectField a select field with an attached filter field that can provide hints by which to filter the results in the search field by. Provides functionality for passthrough fields as well.

generate_call_function_js()

Generate Javascript for call function.

Returns: Javascript for call function.

generate_event_listener_js()

Generate javascript to call other js functions on change event.

Returns: Javascript to call functions on change event.

generate_filter_field_js()

Generate javascript to filter the field.

Returns: Javascript for filtering the field.

generate_populate_function_js()

Generate Javascript for populate function.

Returns: Javascript for populate function.

widget= <bluecat.ui_components.wtform_widgets.SuperSelect object>

classwtform_fields.HostRecord(label='', validators=None, result_decorator=None, **kwargs

Bases: wtform_fields.ValidatingStringField

StringFIeld for inputing the host records.

classwtform_fields.IP4Address(label='', validators=None, result_decorator=None, **kwargs

Bases: wtform_fields.ValidatingStringField

StringField for inputting IPv4 addresses with client-side validation and auto-checks that it is available.

classwtform_fields.NoPreValidationSelectField(label=None, validators=None, coerce=<type 'unicode'>, choices=None, **kwargs)

Bases: wtforms.fields.core.SelectField

SelectField with no pre-validation of field value against possible choices. Useful if choices are dynamically populated.

pre_validate(form)

Pre-validate method being overwritten to no longer perform validation.

classwtform_fields.PlainHTML(plain_html='', **kwargs)

Bases: wtforms.fields.core.Field

Field to render plain HTML.

widget= <bluecat.ui_components.wtform_widgets.HTMLWidget object>

classwtform_fields.SimpleAutocompleteField(label=None, validators=None, one_off=False, source=None, start_initialized=False, clear_below_on_change=False, **kwargs)

Bases: wtforms.fields.core.StringField, wtform_fields.ExtendedField

Generic auto-complete enabled Field.

generate_call_function_js()

Override default JS for call function.

Returns: Javascript function snippet.

generate_clear_below_js()

Add disable all below code.

Returns: Javascript for CustomSearchButtonField.

generate_populate_function_js()

Override default JS for populate function :return: javascript function snippet.

widget= <bluecat.ui_components.wtform_widgets.SuperTextInput object>

classwtform_fields.TableField(label=None, data_function=None, table_features=None, **kwargs

Bases: wtform_fields.ExtendedField

Field to render Table data.()

generate_call_function_js()

Call function JS.

generate_common_clear_code()

Override the default clear code generation with Table specific logic.

generate_global_scope_js()

Global JS components.

generate_parse_data_function_js()

Parse data JS function.

generate_populate_function_js()

Populate function JS.

widget= <bluecat.ui_components.wtform_widgets.SuperTableWidget object>

classwtform_fields.ValidatingStringField(label='', validators=None, client_side_validator='', clear_below_on_change=False, **kwargs)

Bases: wtforms.fields.core.StringField, wtform_fields.ExtendedField

StringField with server side validation that can be attached to it, will show green when validated and red when not.

generate_call_function_js()

generate_clear_below_js

Add disable all below code.

Returns: Javascript for CustomSearchButtonField.

generate_client_and_server_validator()

Adds client and server side validation to a field. Listener for the field must be added separately and should call “populate_<element_id>” when it wants to validate the input. :return: Javascript function code as Python string.

generate_populate_function_js

generate_user_input_delay

Generates generic javascript function for adding delay on input. :return: The generated javascript as a Python string.

widget= <bluecat.ui_components.wtform_widgets.SuperTextInput object>

classwtform_fields.View(label='', validators=None, result_decorator=None, **kwargs)

Bases: wtform_fields.SimpleAutocompleteField

Autocomplete enabled field for View entities.

classwtform_fields.Zone(label='', validators=None, result_decorator=None, **kwargs)

Bases: wtform_fields.SimpleAutocompleteField

Autocomplete enabled field for Zone entities.