From 01e41dfbb7568518284862afebb7709d71e10c53 Mon Sep 17 00:00:00 2001 From: bluikko <14869000+bluikko@users.noreply.github.com> Date: Fri, 22 Dec 2023 15:38:52 +0700 Subject: [PATCH 1/4] Support CustomField UI visibility in 3.8 Add ui_editable and ui_visible parameters. --- plugins/modules/netbox_custom_field.py | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/plugins/modules/netbox_custom_field.py b/plugins/modules/netbox_custom_field.py index eadfad6d5..58bba47d5 100644 --- a/plugins/modules/netbox_custom_field.py +++ b/plugins/modules/netbox_custom_field.py @@ -106,9 +106,30 @@ required: false type: str version_added: "3.10.0" + ui_editable: + description: + - Whether the custom field is editable in the UI + required: false + choices: + - yes + - no + - hidden + type: str + version_added: "3.17.0" + ui_visible: + description: + - Whether the custom field is displayed in the UI + required: false + choices: + - always + - if-set + - hidden + type: str + version_added: "3.17.0" ui_visibility: description: - The UI visibility of the custom field + - Replaced by C(ui_visible) and C(ui_editabl)e in NetBox 3.7 required: false choices: - read-write @@ -245,6 +266,24 @@ def main(): weight=dict(required=False, type="int"), search_weight=dict(required=False, type="int"), group_name=dict(required=False, type="str"), + ui_editable=dict( + required=False, + choices=[ + "yes", + "no", + "hidden", + ], + type="str", + ), + ui_visible=dict( + required=False, + choices=[ + "always", + "if-set", + "hidden", + ], + type="str", + ), ui_visibility=dict( required=False, choices=[ From 4d9735b281fa06e2e1e1dc6dd0435390e0da1c29 Mon Sep 17 00:00:00 2001 From: bluikko <14869000+bluikko@users.noreply.github.com> Date: Fri, 22 Dec 2023 15:53:00 +0700 Subject: [PATCH 2/4] Add docs for 3.8 CustomField UI visibility --- docs/plugins/netbox_custom_field_module.rst | 92 +++++++++++++++++++++ 1 file changed, 92 insertions(+) diff --git a/docs/plugins/netbox_custom_field_module.rst b/docs/plugins/netbox_custom_field_module.rst index f8603426a..db2c34b8e 100644 --- a/docs/plugins/netbox_custom_field_module.rst +++ b/docs/plugins/netbox_custom_field_module.rst @@ -612,6 +612,98 @@ Parameters - :ansible-option-choices-entry:`"multiobject"` + .. raw:: html + + + + * - .. raw:: html + +
+
+ + .. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/ui_editable: + + .. rst-class:: ansible-option-title + + **ui_editable** + + .. raw:: html + + + + .. rst-class:: ansible-option-type-line + + :ansible-option-type:`string` + + :ansible-option-versionadded:`added in netbox.netbox 3.17.0` + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Whether the custom field is editable in the UI + + + .. rst-class:: ansible-option-line + + :ansible-option-choices:`Choices:` + + - :ansible-option-choices-entry:`"yes"` + - :ansible-option-choices-entry:`"no"` + - :ansible-option-choices-entry:`"hidden"` + + + .. raw:: html + +
+ + * - .. raw:: html + +
+
+ + .. _ansible_collections.netbox.netbox.netbox_custom_field_module__parameter-data/ui_visible: + + .. rst-class:: ansible-option-title + + **ui_visible** + + .. raw:: html + + + + .. rst-class:: ansible-option-type-line + + :ansible-option-type:`string` + + :ansible-option-versionadded:`added in netbox.netbox 3.17.0` + + + .. raw:: html + +
+ + - .. raw:: html + +
+ + Whether the custom field is displayed in the UI + + + .. rst-class:: ansible-option-line + + :ansible-option-choices:`Choices:` + + - :ansible-option-choices-entry:`"always"` + - :ansible-option-choices-entry:`"if-set"` + - :ansible-option-choices-entry:`"hidden"` + + .. raw:: html
From 0ebab1f986c3ff7298b923b2a8ae274c48adf165 Mon Sep 17 00:00:00 2001 From: bluikko <14869000+bluikko@users.noreply.github.com> Date: Mon, 25 Dec 2023 12:26:00 +0700 Subject: [PATCH 3/4] Use docs semantic markup Use docs semantic markup to refer to other options and fix a typo in markup. --- plugins/modules/netbox_custom_field.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/netbox_custom_field.py b/plugins/modules/netbox_custom_field.py index 58bba47d5..c5322c48a 100644 --- a/plugins/modules/netbox_custom_field.py +++ b/plugins/modules/netbox_custom_field.py @@ -129,7 +129,7 @@ ui_visibility: description: - The UI visibility of the custom field - - Replaced by C(ui_visible) and C(ui_editabl)e in NetBox 3.7 + - Replaced by O(ui_visible) and O(ui_editable) in NetBox 3.7 required: false choices: - read-write From ef6c25131f7d0be759f6169e8e7d05550e1e1361 Mon Sep 17 00:00:00 2001 From: bluikko <14869000+bluikko@users.noreply.github.com> Date: Wed, 27 Dec 2023 11:40:52 +0700 Subject: [PATCH 4/4] Quote ui_editable values Quote truthy looking values to treat them as strings. --- plugins/modules/netbox_custom_field.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/modules/netbox_custom_field.py b/plugins/modules/netbox_custom_field.py index c5322c48a..c5aae753d 100644 --- a/plugins/modules/netbox_custom_field.py +++ b/plugins/modules/netbox_custom_field.py @@ -111,8 +111,8 @@ - Whether the custom field is editable in the UI required: false choices: - - yes - - no + - "yes" + - "no" - hidden type: str version_added: "3.17.0"