From 8697732932f3e87ee8e7517465445843ae3bce6b Mon Sep 17 00:00:00 2001 From: Sanjay Bhangar Date: Sat, 2 Sep 2023 12:52:27 +0530 Subject: [PATCH] Refs #756 - allow dropdown text for unlisted choice to be configurable --- kubespawner/spawner.py | 2 ++ kubespawner/templates/form.html | 8 +++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/kubespawner/spawner.py b/kubespawner/spawner.py index d4b52b97..096e042d 100644 --- a/kubespawner/spawner.py +++ b/kubespawner/spawner.py @@ -1543,6 +1543,7 @@ def _validate_image_pull_secrets(self, proposal): selected "Other" as a choice: - `enabled`: Boolean, whether the free form input should be enabled - `display_name`: String, label for input field + - `other_text`: Optional, text to show in Select Dropdown for Other option - `validation_regex`: Optional, regex that the free form input should match - eg. ^pangeo/.*$ - `validation_message`: Optional, validation message for the regex. Should describe the required input format in a human-readable way. @@ -1604,6 +1605,7 @@ def _validate_image_pull_secrets(self, proposal): }, 'unlisted_choice': { 'enabled': True, + 'other_text': 'Enter image manually', 'display_name': 'Other image', 'validation_regex': '^jupyter/.+:.+$', 'validation_message': 'Must be an image matching ^jupyter/:$', diff --git a/kubespawner/templates/form.html b/kubespawner/templates/form.html index fccfa2f9..762a5c21 100644 --- a/kubespawner/templates/form.html +++ b/kubespawner/templates/form.html @@ -27,7 +27,13 @@

{{ profile.display_name }}

{%- endfor %} {%- if option['unlisted_choice'] and option['unlisted_choice']['enabled'] %} - + {%- endif %}