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')
class GenericFormTemplate(GatewayForm): """ Generic form Template Note: When updating the form, remember to make the corresponding changes to the workflow pages """ workflow_name = 'devassign' workflow_permission = 'devassign_page' zone = CustomZone(workflow_name=workflow_name, permissions=workflow_permission, label='Zone', required=True, is_disabled_on_start=False) input_x1_button_x1_aligned_open_1 = PlainHTML( '<div class="input_x1_button_x1_aligned">') input_x1_aligned_open_1 = PlainHTML('<div class="input_x1_aligned">') ip4_network = IP4Network(workflow_name=workflow_name, permissions=workflow_permission, label='Network (Optional)', required=False, one_off=False, is_disabled_on_start=False) input_x1_aligned_close_1 = PlainHTML('</div>') get_next_available_ip4 = CustomSearchButtonField( workflow_name=workflow_name, permissions=workflow_permission, label='Get Next IPv4', server_side_method=get_next_ip4_address_endpoint, on_complete=['populate_ip4_address'], is_disabled_on_start=False, ) input_x1_button_x1_aligned_close_1 = PlainHTML('</div>') clearfix_2 = PlainHTML('<div class="clearfix"> </div>') ip4_address = CustomIP4Address(workflow_name=workflow_name, permissions=workflow_permission, label='IP Address', required=True, inputs={'address': 'ip4_address'}, result_decorator=filter_reserved, should_cascade_disable_on_change=True, is_disabled_on_start=False) hostname = CustomStringField(label='Hostname', required=True, is_disabled_on_start=False) macaddress = CustomStringField(label='MAC Address', required=True, is_disabled_on_start=False) deploy_now = CustomBooleanField(label='Deploy Now', is_disabled_on_start=False) submit = CustomSubmitField(label='Submit', is_disabled_on_start=False)
class GenericFormTemplate(GatewayForm): """ Cisco ACI form Note: When updating the form, remember to make the corresponding changes to the workflow pages """ workflow_name = 'cisco_aci' workflow_permission = 'cisco_aci_page' apic_ip = CustomStringField( label='APIC IP', required=True, default='', validators=[DataRequired()], is_disabled_on_start=False, ) apic_username = CustomStringField( label='APIC USERNAME', default='', required=True, validators=[DataRequired()], is_disabled_on_start=False, ) apic_password = CustomPasswordField( label='APIC PASSWORD', default='abc', validators=[DataRequired()], is_disabled_on_start=False, ) optional = PlainHTML( '<hr/><h4>OPTIONAL</h4><p>Import ACI Fabric only if you wish to import APIC, SPINE, and' ' LEAF devices to the selected BAM configuration.</p><br/>') import_devices_checkbox = CustomBooleanField( label='Import ACI Fabric Devices to', on_checked=['enable_configuration'], on_unchecked=['disable_configuration', 'disable_import_fabric'], is_disabled_on_start=False, ) configuration = Configuration( workflow_name=workflow_name, permissions=workflow_permission, coerce=int, label='', validators=[], enable_dependencies={'on_complete': ['import_fabric']}, disable_dependencies={'on_change': ['import_fabric']}, clear_below_on_change=False, ) import_fabric = CustomSearchButtonField( workflow_name=workflow_name, permissions=workflow_permission, label='IMPORT FABRIC', default='IMPORT', server_side_method=add_fabric, display_message=True, ) html = PlainHTML('<br/><br/><hr/>') discover = CustomSearchButtonField( workflow_name=workflow_name, permissions=workflow_permission, label='DISCOVER TENANTS', is_disabled_on_start=False, default='Search', on_complete=[ 'call_output_table', 'add_checkall_button', 'add_on_page_change_listener' ], server_side_method=get_tenants, display_message=True, ) output_table = TableField( workflow_name=workflow_name, permissions=workflow_permission, label='', table_features=raw_table_data(), is_disabled_on_start=False, ) import_tenants = SimpleButtonField( workflow_name=workflow_name, permissions=workflow_permission, label='IMPORT INFRASTRUCTURE', is_disabled_on_start=False, default='Search', )
class GenericFormTemplate(GatewayForm): """ Generic form Template Note: When updating the form, remember to make the corresponding changes to the workflow pages """ workflow_name = 'add_dual_stack_host' workflow_permission = 'add_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_dependencies={'on_complete': ['view']}, disable_dependencies={'on_change': ['view']}, clear_dependencies={'on_change': ['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', 'ip_address', 'ip6_address'] }, disable_dependencies={ 'on_change': ['hostname', 'ip_address', 'ip6_address'] }, clear_dependencies={ 'on_change': ['hostname', 'ip_address', 'ip6_address'] }, should_cascade_disable_on_change=True, should_cascade_clear_on_change=True) hostname = CustomStringField(label='Hostname', required=True) ip_address = IP4Address( workflow_name=workflow_name, permissions=workflow_permission, label='IPv4 Address', required=True, inputs={ 'configuration': 'configuration', 'address': 'ip_address' }, result_decorator=filter_reserved, enable_dependencies={'on_complete': ['submit', 'ip6_address']}, disable_dependencies={'on_change': ['submit', 'ip6_address']}, should_cascade_disable_on_change=True) ip6_address = IP6Address(workflow_name=workflow_name, permissions=workflow_permission, label='IPv6 Address', required=True, inputs={ 'configuration': 'configuration', 'ip6_address': 'ip6_address' }, result_decorator=None, disable_dependencies={ 'on_change': ['hostname', 'submit', 'ip_address'] }, enable_on_complete=['submit']) 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>' )