PaloAltoNetworks / panhandler

Panhandler is a tool to manage config snippets and Skillets for PAN-OS devices
Apache License 2.0
41 stars 19 forks source link

use of 'when' in variables section to allow panHandler to hide-show web form fields #118

Closed scotchoaf closed 4 years ago

scotchoaf commented 4 years ago

include the same model for a when condition in the variables section that if True shows a web form. False hides the field. If not specific, default is True to show.

The web form will dynamically update if a pulldown or field text is updated so some dynamic capability in the UI.

This additional can alleviate much of the web form clutter with unused fields and not require the use of workflows for simple skillet loading

scotchoaf commented 4 years ago

here is sample javascript code with comments. haven't tested inside cnc html template yet but looks fairly straightforward. comments added in the script and div areas where jinja bits would be used

key points: . special case class added in the div if a when is used; used to hide/show groups of fields . script block added to check a dropdown change and hide/show the fields based on class name

`

phy interface type


<!–– guessing here is a jinja conditonal in cnc html file if field.when with when added to a var statement eg. when PhyIntfType == 'static' --> the values used above in the script when var_label == value and var_label is associated field class could be set to dv_var_label where dv prefix stands for dropdown value -->

`

nembery commented 4 years ago

implemented via commit: 0222d34099869bf412c5768deb44cf0c13920b30