Beispiel #1
0
class GenericFormTemplate(GatewayForm):
    """ Form to generate HTML and Javascript for the add_alias_record_example workflow

    Note:
        When updating the form, remember to make the corresponding changes to the workflow pages
    """
    workflow_name = 'add_alias_record_example'
    workflow_permission = 'add_alias_record_example_page'
    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Configuration',
        required=True,
        coerce=int,
        is_disabled_on_start=False,
        on_complete=['call_view'],
        enable_dependencies={'on_complete': ['view']},
        disable_dependencies={'on_change': ['view']},
        clear_dependencies={'on_change': ['view']}
    )

    view = View(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='View',
        required=True,
        one_off=True,
        on_complete=['call_zone', 'call_linked_record_zone'],
        enable_dependencies={'on_complete': ['zone', 'linked_record_zone', 'submit']},
        disable_dependencies={'on_change': ['zone', 'linked_record_zone', 'select_one', 'submit']},
        should_cascade_disable_on_change=True,
        clear_dependencies={'on_change': ['zone', 'linked_record_zone', 'select_one']},
        should_cascade_clear_on_change=True
    )

    zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Alias Zone',
        required=True,
        enable_dependencies={'on_complete': ['name']},
        disable_dependencies={'on_change': ['name']},
        should_cascade_disable_on_change=True,
        clear_dependencies={'on_change': ['name']},
        should_cascade_clear_on_change=True
    )

    name = CustomStringField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Name',
        required=True
    )

    linked_record_zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Linked Record Zone',
        required=True,
        enable_dependencies={'on_complete': ['host_record']},
        disable_dependencies={'on_change': ['host_record']},
        should_cascade_disable_on_change=True,
        clear_dependencies={'on_change': ['host_record']},
        should_cascade_clear_on_change=True
    )

    host_record = CustomStringField(
        label='Linked Record',
        required=True
    )

    submit = SubmitField(label='Submit')
Beispiel #2
0
class GenericFormTemplate(GatewayForm):
    # When updating the form, remember to make the corresponding changes to the workflow pages
    workflow_name = 'update_text_record_example'
    workflow_permission = 'update_text_record_example_page'
    configuration = Configuration(workflow_name=workflow_name,
                                  permissions=workflow_permission,
                                  label='Configuration',
                                  required=True,
                                  coerce=int,
                                  validators=[],
                                  is_disabled_on_start=False,
                                  on_complete=['call_view'],
                                  enable_on_complete=['view'])

    view = View(workflow_name=workflow_name,
                permissions=workflow_permission,
                label='View',
                required=True,
                one_off=True,
                on_complete=[],
                enable_on_complete=['parent_zone'])

    parent_zone = Zone(workflow_name=workflow_name,
                       permissions=workflow_permission,
                       label='Zone',
                       required=True,
                       start_initialized=True,
                       inputs={
                           'zone': 'parent_zone',
                           'configuration': 'configuration',
                           'view': 'view'
                       },
                       enable_on_complete=['text_record', 'search'])

    text_record = CustomStringField(label='Text Record')

    search = CustomSearchButtonField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        default='Search',
        inputs={
            'configuration': 'configuration',
            'view': 'view',
            'parent_zone': 'parent_zone',
            'name': 'text_record'
        },
        server_side_method=get_text_records_endpoint,
        message_field='search_message',
        on_click=['populate_txt_list'],
        enable_on_complete=['txt_filter', 'txt_list'])

    plain_0 = PlainHTML('<div id="search_message"></div>')

    txt_filter = CustomStringField(label='Filter', is_disabled_on_error=True)

    txt_list = FilteredSelectField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Text',
        size=12,
        filter_field='txt_filter',
        choices=[(0, '')],
        coerce=int,
        is_disabled_on_error=True,
        on_complete=['call_name_js', 'call_text'],
        enable_on_complete=['name', 'text', 'submit'])

    plain_1 = PlainHTML('<hr>')

    name = CustomStringField(label='New Name', is_disabled_on_error=True)

    text = CustomStringField(label='New Text',
                             inputs={'text': 'txt_list'},
                             is_disabled_on_error=True)

    submit = SubmitField(label='Update', render_kw={'disabled': True})
Beispiel #3
0
class GenericFormTemplate(GatewayForm):
    """ Form to generate HTML and Javascript for the add_static_ip4_address_example workflow

    Note:
        When updating the form, remember to make the corresponding changes to the workflow pages
    """
    workflow_name = 'add_static_ip4_address_example'
    workflow_permission = 'add_static_ip4_address_example_page'
    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Configuration',
        required=True,
        coerce=int,
        clear_below_on_change=False,
        is_disabled_on_start=False,
        enable_dependencies={'on_complete': ['ip4_address']},
        disable_dependencies={'on_change': ['ip4_address']},
        clear_dependencies={
            'on_change': ['ip4_address', 'view', 'mac_address', 'description']
        })

    ip4_address = IP4Address(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Address',
        required=True,
        inputs={
            'configuration': 'configuration',
            'address': 'ip4_address'
        },
        result_decorator=filter_unallocated,
        on_complete=['call_view'],
        clear_below_on_change=False,
        should_cascade_disable_on_change=True,
        enable_dependencies={
            'on_complete': ['view', 'mac_address', 'description', 'submit']
        },
        disable_dependencies={
            'on_change': ['view', 'mac_address', 'description', 'submit']
        },
        display_message=True)

    mac_address = CustomStringField(label='MAC Address')

    description = CustomStringField(label='Description')

    view = View(workflow_name=workflow_name,
                permissions=workflow_permission,
                label='View',
                one_off=True,
                on_complete=['call_zone'],
                clear_below_on_change=False,
                should_cascade_disable_on_change=True,
                should_cascade_clear_on_change=True,
                enable_dependencies={'on_complete': ['zone']},
                disable_dependencies={'on_change': ['zone']},
                clear_dependencies={'on_change': ['zone']})

    zone = Zone(workflow_name=workflow_name,
                permissions=workflow_permission,
                label='Zone',
                clear_below_on_change=False,
                should_cascade_disable_on_change=True,
                should_cascade_clear_on_change=True,
                enable_dependencies={'on_complete': ['hostname']},
                disable_dependencies={'on_change': ['hostname']},
                clear_dependencies={'on_change': ['hostname']})

    hostname = CustomStringField(label='Hostname')

    submit = SubmitField(label='Submit')
Beispiel #4
0
class GenericFormTemplate(GatewayForm):
    """
    Generic form Template

    Note:
        When updating the form, remember to make the corresponding changes to the workflow pages
    """
    workflow_name = 'create_server_vro'
    workflow_permission = 'create_server_vro_page'
    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Configuration',
        required=True,
        coerce=int,
        clear_below_on_change=False,
        is_disabled_on_start=False,
        on_complete=['call_view'],
        enable_dependencies={'on_complete': ['view']},
        disable_dependencies={'on_change': ['view']},
        clear_dependencies={'on_change': ['view']}
    )

    view = View(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='View',
        required=True,
        one_off=True,
        on_complete=['call_zone'],
        clear_below_on_change=False,
        enable_dependencies={'on_complete': ['zone']},
        disable_dependencies={'on_change': ['zone']},
        clear_dependencies={'on_change': ['zone']},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True
    )

    zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Zone',
        required=True,
        clear_below_on_change=False,
        enable_dependencies={'on_complete': ['ip4_network']},
        disable_dependencies={'on_change': ['ip4_network']},
        clear_dependencies={'on_change': ['ip4_network']},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True
    )

    ip4_network = IP4Network(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Network',
        required=True,
        one_off=False,
        enable_dependencies={'on_complete': ['mac_address', 'hostname', 'submit']},
        disable_dependencies={'on_change': ['mac_address', 'hostname', 'submit']},
        clear_dependencies={'on_change': ['mac_address', 'hostname', 'submit']},
        is_disabled_on_start=False
    )

    mac_address = CustomStringField(
        label='MAC Address',
        required=True,
        validators=[MacAddress()]
    )

    hostname = CustomStringField(
        label='Hostname',
        required=True
    )

    submit = SubmitField(label='Submit')
class GenericFormTemplate(GatewayForm):
    """class used to structure all the elements on the page"""
    workflow_name = 'selective_deployment'
    workflow_permission = 'selective_deployment_page'

    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Configuration',
        required=True,
        coerce=int,
        clear_below_on_change=False,
        is_disabled_on_start=False,
        on_complete=['call_view'],
        enable_dependencies={'on_complete': ['view']},
        disable_dependencies={'on_change': ['view']},
        clear_dependencies={'on_change': ['view']})

    view = View(workflow_name=workflow_name,
                permissions=workflow_permission,
                label='View',
                required=True,
                one_off=True,
                clear_below_on_change=False,
                display_message=True,
                enable_dependencies={'on_complete': ['zone']},
                disable_dependencies={'on_change': ['zone']},
                clear_dependencies={'on_change': ['zone']},
                should_cascade_disable_on_change=True,
                should_cascade_clear_on_change=True)

    zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Zone',
        required=True,
        start_initialized=True,
        display_message=True,
        inputs={
            'zone': 'zone',
            'configuration': 'configuration',
            'view': 'view'
        },
        clear_below_on_change=False,
        enable_dependencies={'on_complete': ['search']},
        disable_dependencies={
            'on_change': ['search'],
            'on_click': ['search']
        },
        clear_dependencies={
            'on_change': ['search'],
            'on_click': ['search']
        },
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    search = CustomSearchButtonField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        default='Search Objects',
        inputs={
            'zone': 'zone',
            'view': 'view',
            'configuration': 'configuration'
        },
        server_side_method=find_objects_by_type_endpoint,
        display_message=True,
        label='SEARCH DNS',
        on_complete=['call_output_table'],
        enable_dependencies={'on_complete': ['deploy', 'output_table']},
        disable_dependencies={'on_change': ['deploy', 'output_table']},
        clear_below_on_change=False,
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    output_table = TableField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='',
        data_function=raw_table_data,
        table_features={'lengthMenu': [10, 20, 30, 40, 50, 100, 500, 1000]})

    deploy = CustomButtonField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Deploy',
        display_message=True,
    )
class GenericFormTemplate(GatewayForm):
    """class used to structure all the elements on the page"""

    workflow_name = "selective_deployment"
    workflow_permission = "selective_deployment_page"

    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Configuration",
        required=True,
        coerce=int,
        clear_below_on_change=False,
        is_disabled_on_start=False,
        on_complete=["call_view"],
        enable_dependencies={"on_complete": ["view"]},
        disable_dependencies={"on_change": ["view"]},
        clear_dependencies={"on_change": ["view"]},
    )

    view = View(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="View",
        required=True,
        one_off=True,
        clear_below_on_change=False,
        display_message=True,
        enable_dependencies={"on_complete": ["zone"]},
        disable_dependencies={"on_change": ["zone"]},
        clear_dependencies={"on_change": ["zone"]},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Zone",
        required=True,
        start_initialized=True,
        display_message=True,
        inputs={
            "zone": "zone",
            "configuration": "configuration",
            "view": "view"
        },
        clear_below_on_change=False,
        enable_dependencies={"on_complete": ["search"]},
        disable_dependencies={
            "on_change": ["search"],
            "on_click": ["search"]
        },
        clear_dependencies={
            "on_change": ["search"],
            "on_click": ["search"]
        },
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    search = CustomSearchButtonField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        default="Search Objects",
        inputs={
            "zone": "zone",
            "view": "view",
            "configuration": "configuration"
        },
        server_side_method=find_objects_by_type_endpoint,
        display_message=True,
        label="SEARCH DNS",
        on_complete=["call_output_table"],
        enable_dependencies={"on_complete": ["deploy", "output_table"]},
        disable_dependencies={"on_change": ["deploy", "output_table"]},
        clear_below_on_change=False,
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    output_table = TableField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="",
        data_function=raw_table_data,
        table_features={"lengthMenu": [10, 20, 30, 40, 50, 100, 500, 1000]},
    )

    deploy = CustomButtonField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Deploy",
        display_message=True,
    )
Beispiel #7
0
class GenericFormTemplate(GatewayForm):
    """ Form to generate HTML and Javascript for the update_text_record workflow

    Note:
        When updating the form, remember to make the corresponding changes to the workflow pages
    """
    workflow_name = 'update_text_record'
    workflow_permission = 'update_text_record_page'
    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Configuration',
        required=True,
        coerce=int,
        clear_below_on_change=False,
        is_disabled_on_start=False,
        on_complete=['call_view'],
        enable_dependencies={'on_complete': ['view']},
        disable_dependencies={'on_change': ['view']},
        clear_dependencies={'on_change': ['view']})

    view = View(workflow_name=workflow_name,
                permissions=workflow_permission,
                label='View',
                required=True,
                one_off=True,
                clear_below_on_change=False,
                display_message=True,
                enable_dependencies={'on_complete': ['parent_zone']},
                disable_dependencies={'on_change': ['parent_zone']},
                clear_dependencies={'on_change': ['parent_zone']},
                should_cascade_disable_on_change=True,
                should_cascade_clear_on_change=True)

    parent_zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Zone',
        required=True,
        start_initialized=True,
        display_message=True,
        inputs={
            'zone': 'parent_zone',
            'configuration': 'configuration',
            'view': 'view'
        },
        clear_below_on_change=False,
        enable_dependencies={'on_complete': ['text_record', 'search']},
        disable_dependencies={'on_change': ['text_record', 'search']},
        clear_dependencies={'on_change': ['text_record', 'search']},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True)

    text_record = CustomStringField(label='Text Record')

    search = CustomSearchButtonField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        default='Search',
        inputs={
            'configuration': 'configuration',
            'view': 'view',
            'parent_zone': 'parent_zone',
            'name': 'text_record'
        },
        server_side_method=get_text_records_endpoint,
        display_message=True,
        on_complete=['call_txt_list'],
        enable_dependencies={'on_complete': ['txt_filter', 'txt_list']},
        disable_dependencies={
            'on_change': ['txt_filter', 'txt_list'],
            'on_click': ['txt_filter', 'txt_list']
        },
        clear_dependencies={
            'on_change': ['txt_filter', 'txt_list'],
            'on_click': ['txt_filter', 'txt_list']
        },
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True)

    txt_filter = CustomStringField(label='Filter', is_disabled_on_error=True)

    txt_list = FilteredSelectField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Text',
        size=12,
        filter_field='txt_filter',
        choices=[(0, '')],
        coerce=int,
        is_disabled_on_error=True,
        on_complete=['call_name_js', 'call_text'],
        inputs={
            'configuration': 'configuration',
            'view': 'view',
            'parent_zone': 'parent_zone',
            'name': 'text_record'
        },
        clear_dependencies={'on_change': ['name', 'text']},
        server_side_method=get_text_records_endpoint,
        enable_dependencies={'on_complete': ['name', 'text', 'submit']},
        disable_dependencies={'on_change': ['name', 'text', 'submit']},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True)

    plain_1 = PlainHTML('<hr>')

    name = CustomStringField(label='New Name', is_disabled_on_error=True)

    text = CustomStringField(label='New Text',
                             inputs={'text': 'txt_list'},
                             is_disabled_on_error=True)

    submit = CustomSubmitField(label='Update')
class GenericFormTemplate(GatewayForm):
    """Form to generate HTML and Javascript for the add_dhcp_ip4_address workflow

    Note:
        When updating the form, remember to make the corresponding changes to the workflow pages
    """

    workflow_name = "add_dhcp_ip4_address"
    workflow_permission = "add_dhcp_ip4_address_page"
    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Configuration",
        required=True,
        coerce=int,
        clear_below_on_change=False,
        is_disabled_on_start=False,
        on_complete=["call_view"],
        enable_dependencies={"on_complete": ["view"]},
        disable_dependencies={"on_change": ["view"]},
        clear_dependencies={"on_change": ["view"]},
    )

    view = View(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="View",
        required=True,
        one_off=True,
        clear_below_on_change=False,
        on_complete=["call_zone"],
        enable_dependencies={"on_complete": ["zone"]},
        disable_dependencies={"on_change": ["zone"]},
        clear_dependencies={"on_change": ["zone"]},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Zone",
        required=True,
        clear_below_on_change=False,
        enable_dependencies={"on_complete": ["ip4_address"]},
        disable_dependencies={"on_change": ["ip4_address"]},
        clear_dependencies={
            "on_change":
            ["ip4_address", "hostname", "mac_address", "description"]
        },
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    ip4_address = IP4Address(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Address",
        required=True,
        inputs={
            "configuration": "configuration",
            "address": "ip4_address"
        },
        result_decorator=filter_unallocated,
        clear_below_on_change=False,
        enable_dependencies={
            "on_complete":
            ["hostname", "mac_address", "description", "submit"]
        },
        disable_dependencies={
            "on_change": ["hostname", "mac_address", "description", "submit"]
        },
        should_cascade_disable_on_change=True,
    )

    hostname = CustomStringField(label="Hostname", required=True)

    mac_address = CustomStringField(label="MAC Address")

    description = CustomStringField(label="Description")

    submit = SubmitField(label="Submit")
class GenericFormTemplate(GatewayForm):
    """ Form to generate HTML and Javascript for the delete_host_record workflow

    Note:
        When updating the form, remember to make the corresponding changes to the workflow pages
    """
    workflow_name = 'delete_host_record'
    workflow_permission = 'delete_host_record_page'
    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Configuration',
        required=True,
        coerce=int,
        clear_below_on_change=False,
        is_disabled_on_start=False,
        on_complete=['call_view'],
        enable_dependencies={'on_complete': ['view']},
        disable_dependencies={'on_change': ['view']},
        clear_dependencies={'on_change': ['view']})

    view = View(workflow_name=workflow_name,
                permissions=workflow_permission,
                label='View',
                required=True,
                one_off=True,
                clear_below_on_change=False,
                enable_dependencies={'on_complete': ['parent_zone']},
                disable_dependencies={'on_change': ['parent_zone']},
                clear_dependencies={'on_change': ['parent_zone']},
                should_cascade_disable_on_change=True,
                should_cascade_clear_on_change=True)

    parent_zone = Zone(workflow_name=workflow_name,
                       permissions=workflow_permission,
                       label='Zone',
                       required=True,
                       start_initialized=True,
                       inputs={
                           'zone': 'parent_zone',
                           'configuration': 'configuration',
                           'view': 'view'
                       },
                       clear_below_on_change=False,
                       enable_dependencies={'on_complete': ['host_record']},
                       disable_dependencies={'on_change': ['host_record']},
                       clear_dependencies={
                           'on_change': ['host_record', 'name', 'ip4_address']
                       },
                       should_cascade_disable_on_change=True,
                       should_cascade_clear_on_change=True)

    host_record = HostRecord(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Host Record',
        required=True,
        inputs={
            'configuration': 'configuration',
            'view': 'view',
            'parent_zone': 'parent_zone',
            'host_record': 'host_record'
        },
        server_outputs={
            'on_complete': {
                'name': 'name',
                'addresses': 'ip4_address'
            }
        },
        server_side_output_method=get_host_records_endpoint,
        clear_below_on_change=False,
        enable_dependencies={
            'on_complete': ['submit', 'name', 'ip4_address', 'deploy_now']
        },
        disable_dependencies={
            'on_change': ['submit', 'name', 'ip4_address', 'deploy_now']
        })

    seperator = PlainHTML('<hr>')

    name = CustomStringField(label='Name', readonly=True)

    ip4_address = CustomStringField(label='IPv4 Address', readonly=True)

    deploy_now = CustomBooleanField(label='Deploy Now')

    submit = SubmitField(label='Delete')
Beispiel #10
0
class GenericFormTemplate(GatewayForm):
    """Form to generate HTML and Javascript for the delete_text_record workflow

    Note:
        When updating the form, remember to make the corresponding changes to the workflow pages
    """

    workflow_name = "delete_alias_record"
    workflow_permission = "delete_alias_record_page"
    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Configuration",
        required=True,
        coerce=int,
        is_disabled_on_start=False,
        on_complete=["call_view"],
        enable_dependencies={"on_complete": ["view"]},
        disable_dependencies={"on_change": ["view"]},
        clear_dependencies={"on_change": ["view"]},
    )

    view = View(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="View",
        required=True,
        one_off=True,
        on_complete=["call_zone"],
        enable_dependencies={"on_complete": ["zone"]},
        disable_dependencies={"on_change": ["zone"]},
        should_cascade_disable_on_change=True,
        clear_dependencies={"on_change": ["zone"]},
        should_cascade_clear_on_change=True,
    )

    zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Zone",
        required=True,
        enable_dependencies={"on_complete": ["alias_record"]},
        disable_dependencies={"on_change": ["alias_record"]},
        should_cascade_disable_on_change=True,
        clear_dependencies={"on_change": ["alias_record"]},
        should_cascade_clear_on_change=True,
    )

    alias_record = AliasRecord(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Alias Record",
        required=True,
        on_complete=["populate_alias_record_data"],
        enable_dependencies={
            "on_complete": ["name", "linked_record", "submit"]
        },
        disable_dependencies={
            "on_change": ["name", "linked_record", "submit"]
        },
        should_cascade_disable_on_change=True,
        clear_dependencies={"on_change": ["name", "linked_record"]},
        should_cascade_clear_on_change=True,
    )

    name = CustomStringField(label="Name", readonly=True)

    linked_record = CustomStringField(label="Linked Record", readonly=True)

    submit = SubmitField(label="Delete")
Beispiel #11
0
class GenericFormTemplate(GatewayForm):
    # When updating the form, remember to make the corresponding changes to the workflow pages
    workflow_name = 'update_alias_record_example'
    workflow_permission = 'update_alias_record_example_page'
    configuration = Configuration(workflow_name=workflow_name,
                                  permissions=workflow_permission,
                                  label='Configuration',
                                  required=True,
                                  coerce=int,
                                  validators=[],
                                  is_disabled_on_start=False,
                                  on_complete=['call_view'],
                                  enable_on_complete=['view'])

    view = View(workflow_name=workflow_name,
                permissions=workflow_permission,
                label='View',
                required=True,
                one_off=True,
                on_complete=['call_zone', 'call_linked_record_zone'],
                enable_on_complete=['zone'])

    zone = Zone(workflow_name=workflow_name,
                permissions=workflow_permission,
                label='Zone',
                required=True,
                enable_on_complete=['alias_record'])

    alias_record = AliasRecord(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Alias Record',
        required=True,
        inputs={
            'configuration': 'configuration',
            'view': 'view',
            'zone': 'zone',
            'alias_record': 'alias_record'
        },
        server_outputs={
            'alias_record_name': 'alias_name',
            'linked_record_zone': 'linked_record_zone',
            'linked_record_name': 'linked_record'
        },
        server_side_output_method=get_alias_records_endpoint,
        on_complete=['server_output_alias_record'],
        enable_on_complete=[
            'alias_name', 'linked_record_zone', 'linked_record', 'submit'
        ])

    alias_name = CustomStringField(label='New Alias Name', required=True)

    linked_record_zone = Zone(workflow_name=workflow_name,
                              permissions=workflow_permission,
                              label='Linked Record Zone',
                              required=True,
                              inputs={
                                  'configuration': 'configuration',
                                  'view': 'view',
                                  'zone': 'linked_record_zone'
                              },
                              clear_below_on_change=False)

    linked_record = CustomStringField(label='Linked Record', required=True)

    submit = SubmitField(label='Update')
class GenericFormTemplate(GatewayForm):
    """Form to generate HTML and Javascript for the update_host_record workflow

    Note:
        When updating the form, remember to make the corresponding changes to the workflow pages
    """

    workflow_name = "update_host_record"
    workflow_permission = "update_host_record_page"
    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Configuration",
        required=True,
        coerce=int,
        clear_below_on_change=False,
        is_disabled_on_start=False,
        on_complete=["call_view"],
        enable_dependencies={"on_complete": ["view"]},
        disable_dependencies={"on_change": ["view"]},
        clear_dependencies={"on_change": ["view"]},
    )

    view = View(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="View",
        required=True,
        one_off=True,
        clear_below_on_change=False,
        enable_dependencies={"on_complete": ["parent_zone"]},
        disable_dependencies={"on_change": ["parent_zone"]},
        clear_dependencies={"on_change": ["parent_zone"]},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    parent_zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Zone",
        required=True,
        start_initialized=True,
        inputs={"zone": "parent_zone", "configuration": "configuration", "view": "view"},
        clear_below_on_change=False,
        enable_dependencies={"on_complete": ["host_record"]},
        disable_dependencies={"on_change": ["host_record"]},
        clear_dependencies={"on_change": ["host_record", "name", "ip4_address"]},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    host_record = HostRecord(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Host Record",
        required=True,
        inputs={
            "configuration": "configuration",
            "view": "view",
            "parent_zone": "parent_zone",
            "host_record": "host_record",
        },
        server_outputs={"on_complete": {"name": "name", "addresses": "ip4_address"}},
        server_side_output_method=get_host_records_endpoint,
        clear_below_on_change=False,
        enable_dependencies={"on_complete": ["submit", "name", "ip4_address", "deploy_now"]},
        disable_dependencies={"on_change": ["submit", "name", "ip4_address", "deploy_now"]},
        should_cascade_disable_on_change=True,
    )

    separator = PlainHTML("<hr>")

    name = CustomStringField(label="New Host Name", required=True)

    ip4_address = CustomStringField(
        label="IPv4 Address (multiple IPv4 addresses must be separated by a comma)", required=True
    )

    deploy_now = CustomBooleanField(label="Deploy Now")

    submit = SubmitField(label="Update")
class GenericFormTemplate(GatewayForm):
    """
    Generic form Template

    Note:
        When updating the form, remember to make the corresponding changes to the workflow pages
    """
    workflow_name = 'add_next_available_dual_stack_host'
    workflow_permission = 'add_next_available_dual_stack_host_page'
    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Configuration',
        required=True,
        coerce=int,
        validators=[],
        is_disabled_on_start=False,
        on_complete=['call_view'],
        enable_on_complete=['view'],
        clear_below_on_change=False
    )

    view = View(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='View',
        required=True,
        one_off=True,
        on_complete=['call_zone'],
        clear_below_on_change=False,
        enable_dependencies={'on_complete': ['zone']},
        disable_dependencies={'on_change': ['zone']},
        clear_dependencies={'on_change': ['zone']},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True
    )

    zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Zone',
        required=True,
        clear_below_on_change=False,
        enable_dependencies={'on_complete': ['hostname', 'ip4_network', 'ip6_network']},
        disable_dependencies={'on_change': ['hostname', 'ip4_network', 'ip6_network']},
        clear_dependencies={'on_change': ['hostname', 'ip4_network', 'ip6_network']},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True
    )

    hostname = CustomStringField(
        label='Hostname',
        required=True
    )

    ip4_network = IP4Network(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='IPv4 Network',
        required=True,
        one_off=False,
        is_disabled_on_start=False
    )

    ip6_network = IP6Network(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='IPv6 Network',
        required=True,
        one_off=False,
        enable_dependencies={'on_complete': ['submit']},
        disable_dependencies={'on_change': ['submit']},
        is_disabled_on_start=False
    )

    add_device = CustomBooleanField(
        label='Add Device',
        is_disabled_on_start=False
    )

    submit = SubmitField(label='Submit')

    # Button with JS to clear the form
    clear_button = PlainHTML('<button type="button" onclick="clearForm();" class="clearForm">Clear Form</button>')
class GenericFormTemplate(GatewayForm):
    """ Form to generate HTML and Javascript for the update_alias_record workflow

    Note:
        When updating the form, remember to make the corresponding changes to the workflow pages
    """
    workflow_name = 'update_alias_record'
    workflow_permission = 'update_alias_record_page'
    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Configuration',
        required=True,
        coerce=int,
        is_disabled_on_start=False,
        on_complete=['call_view'],
        enable_dependencies={'on_complete': ['view']},
        disable_dependencies={'on_change': ['view']},
        clear_dependencies={'on_change': ['view']}
    )

    view = View(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='View',
        required=True,
        one_off=True,
        on_complete=['call_zone', 'call_linked_record_zone'],
        enable_dependencies={'on_complete': ['zone']},
        disable_dependencies={'on_change': ['zone']},
        should_cascade_disable_on_change=True,
        clear_dependencies={'on_change': ['zone']},
        should_cascade_clear_on_change=True
    )

    zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Zone',
        required=True,
        enable_dependencies={'on_complete': ['alias_record']},
        disable_dependencies={'on_change': ['alias_record']},
        should_cascade_disable_on_change=True,
        clear_dependencies={'on_change': ['alias_record']},
        should_cascade_clear_on_change=True
    )

    alias_record = AliasRecord(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Alias Record',
        required=True,
        inputs={'configuration': 'configuration', 'view': 'view', 'zone': 'zone', 'alias_record': 'alias_record'},
        server_outputs={'on_complete': {'alias_record_name': 'alias_name',
                                        'linked_record_zone': 'linked_record_zone',
                                        'linked_record_name': 'linked_record'}},
        server_side_output_method=get_alias_records_endpoint,
        enable_dependencies={'on_complete': ['alias_name', 'linked_record_zone', 'linked_record', 'submit']},
        disable_dependencies={'on_change': ['alias_name', 'linked_record_zone', 'linked_record', 'submit']},
        should_cascade_disable_on_change=True,
        clear_dependencies={'on_change': ['alias_name', 'linked_record_zone', 'linked_record']},
        should_cascade_clear_on_change=True
    )

    alias_name = CustomStringField(
        label='New Alias Name',
        required=True
    )

    linked_record_zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Linked Record Zone',
        required=True,
        inputs={'configuration': 'configuration', 'view': 'view', 'zone': 'linked_record_zone'},
        clear_below_on_change=False
    )

    linked_record = CustomStringField(
        label='Linked Record',
        required=True
    )

    submit = SubmitField(label='Update')
Beispiel #15
0
class GenericFormTemplate(GatewayForm):
    """Form to generate HTML and Javascript for the update_text_record workflow

    Note:
        When updating the form, remember to make the corresponding changes to the workflow pages
    """

    workflow_name = "update_text_record"
    workflow_permission = "update_text_record_page"
    configuration = Configuration(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Configuration",
        required=True,
        coerce=int,
        clear_below_on_change=False,
        is_disabled_on_start=False,
        on_complete=["call_view"],
        enable_dependencies={"on_complete": ["view"]},
        disable_dependencies={"on_change": ["view"]},
        clear_dependencies={"on_change": ["view"]},
    )

    view = View(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="View",
        required=True,
        one_off=True,
        clear_below_on_change=False,
        display_message=True,
        enable_dependencies={"on_complete": ["parent_zone"]},
        disable_dependencies={"on_change": ["parent_zone"]},
        clear_dependencies={"on_change": ["parent_zone"]},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    parent_zone = Zone(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Zone",
        required=True,
        start_initialized=True,
        display_message=True,
        inputs={"zone": "parent_zone", "configuration": "configuration", "view": "view"},
        clear_below_on_change=False,
        enable_dependencies={"on_complete": ["text_record", "search"]},
        disable_dependencies={"on_change": ["text_record", "search"]},
        clear_dependencies={"on_change": ["text_record", "search"]},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    text_record = CustomStringField(label="Text Record")

    search = CustomSearchButtonField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        default="Search",
        inputs={
            "configuration": "configuration",
            "view": "view",
            "parent_zone": "parent_zone",
            "name": "text_record",
        },
        server_side_method=get_text_records_endpoint,
        display_message=True,
        on_complete=["call_txt_list"],
        enable_dependencies={"on_complete": ["txt_filter", "txt_list"]},
        disable_dependencies={
            "on_change": ["txt_filter", "txt_list"],
            "on_click": ["txt_filter", "txt_list"],
        },
        clear_dependencies={
            "on_change": ["txt_filter", "txt_list"],
            "on_click": ["txt_filter", "txt_list"],
        },
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    txt_filter = CustomStringField(label="Filter", is_disabled_on_error=True)

    txt_list = FilteredSelectField(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label="Text",
        size=12,
        filter_field="txt_filter",
        choices=[(0, "")],
        coerce=int,
        is_disabled_on_error=True,
        on_complete=["call_name_js", "call_text"],
        inputs={
            "configuration": "configuration",
            "view": "view",
            "parent_zone": "parent_zone",
            "name": "text_record",
        },
        clear_dependencies={"on_change": ["name", "text"]},
        server_side_method=get_text_records_endpoint,
        enable_dependencies={"on_complete": ["name", "text", "submit"]},
        disable_dependencies={"on_change": ["name", "text", "submit"]},
        should_cascade_disable_on_change=True,
        should_cascade_clear_on_change=True,
    )

    plain_1 = PlainHTML("<hr>")

    name = CustomStringField(label="New Name", is_disabled_on_error=True)

    text = CustomStringField(
        label="New Text", inputs={"text": "txt_list"}, is_disabled_on_error=True
    )

    submit = CustomSubmitField(label="Update")
class GenericFormTemplate(GatewayForm):
    # When updating the form, remember to make the corresponding changes to the workflow pages
    workflow_name = 'delete_host_record_example'
    workflow_permission = 'delete_host_record_example_page'
    configuration = Configuration(workflow_name=workflow_name,
                                  permissions=workflow_permission,
                                  label='Configuration',
                                  required=True,
                                  coerce=int,
                                  validators=[],
                                  is_disabled_on_start=False,
                                  on_complete=['call_view'],
                                  enable_on_complete=['view'])

    view = View(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='View',
        required=True,
        one_off=True,
        on_complete=[],
        enable_on_complete=['parent_zone'],
    )

    parent_zone = Zone(workflow_name=workflow_name,
                       permissions=workflow_permission,
                       label='Zone',
                       required=True,
                       start_initialized=True,
                       inputs={
                           'zone': 'parent_zone',
                           'configuration': 'configuration',
                           'view': 'view'
                       },
                       enable_on_complete=['host_record'])

    host_record = HostRecord(
        workflow_name=workflow_name,
        permissions=workflow_permission,
        label='Host Record',
        required=True,
        inputs={
            'configuration': 'configuration',
            'view': 'view',
            'parent_zone': 'parent_zone',
            'host_record': 'host_record'
        },
        on_complete=['server_output_host_record'],
        server_outputs={
            'name': 'name',
            'addresses': 'ip4_address'
        },
        server_side_output_method=get_host_records_endpoint,
        enable_on_complete=['submit', 'name', 'ip4_address'])

    seperator = PlainHTML('<hr>')

    name = CustomStringField(label='Name', readonly=True)

    ip4_address = CustomStringField(label='IP4 Address', readonly=True)

    submit = SubmitField(label='Delete')