在自定义 StyleBook 中使用 GUI 属性

Last published : Oct 06, 2026
您可以在 StyleBook 的参数部分添加 GUI 属性,以便在 NetScaler Console 上显示字段时使其更直观。

为参数添加带工具提示的标签

您可以使用 label 属性为参数添加描述性名称。使用 description 属性为此参数添加工具提示。
示例:
name: ip
label: Virtual Server IP Address
description: IP address of the virtual server that represents the load balanced application.
type: ipaddress
required: true

为参数设置可折叠窗格

如果您的参数是对象类型,您可以使用 gui 属性定义布局。
示例-1:
name: svcg-advanced
label: Advanced Application Server Settings
type: object
required: false
gui:
 collapse_pane: true
 columns: 2
在此示例中,布局是一个可折叠对象,其中字段以两列显示。
您还可以将 type: object[](对象列表)类型的参数的摘要视图显示为表格,其中内部参数表示列。要从摘要视图中包含或排除内部参数,您可以在 gui 部分中使用 summary_display 属性,如下所示:
示例-2:
name: settings
label: Settings
type: object[]
parameters:
  -
    name: name
    label: Name
    description: Name of this setting
    type: string
    gui:
      summary_display: true

将用户选项设置为单选按钮

您可以使用 layout 和 allowed-values 属性将用户选项列为单选按钮。因此,当用户创建配置包时,参数值将显示为单选按钮。
默认情况下,如果未指定 gui 属性,参数值将显示为下拉菜单。
-
    name: block-by-category-action
    label: Action
    description: Set an action if the bot is detected.
    type: string
    default: RESET
    gui:
        layout: radio
    allowed-values:
        - NONE
        - DROP
        - REDIRECT
        - RESET
        - MITIGATION
在此示例中,用于设置操作的用户选项显示为单选按钮。并且,RESET 选项默认处于选中状态。
StyleBook 单选按钮