-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow end user to select a choice different from list of available choices in profile_list #735
Conversation
- Creates an option called 'allow_other' - If allow_other, show an extra option for Other in the dropdown - If Other is selected, show an input field for user to type free text. TODO: handle POSTing of "other" input on the backend
Ooooh great to see you work towards this @batpad!!! Reflection on config namingI think With a free-form input field, front-end validation of the input is probably going to end up being another feature. I don't think we need to think about implementing that as part of this PR, but I'm considering it already when thinking on what configuration to provide. For example Hmmm hmmm, I'm currently leaning towards a flat structure to configure this, like Wdyt about renaming |
@consideRatio I think @yuvipanda had a good idea for how this config should be structured, making it an object, that also contained a regex to use to validate the user input. Let's wait for him to weigh in on the structure for options - sorry, he had pasted that to me somewhere, but I can't find it :-/ . |
Hmm, this is an interesting one - yea, I do think this should allow for multiple "sub-options" like the regex to validate input, so either prefixing with |
Thanks for your comments, @consideRatio! I left a comment in batpad@cc0037b#r111675499 earlier, which I will repro here. Let's expand this a little bit. How about something like: freeform:
enabled: true
match_regex: (optional regex to match)
kubespawner_override:
some_config_key: some_value-with-{value}-substituted-with-what-user-wrote So for an image where we only want to allow pangeo images, it would be something like freeform:
enabled: true
match_regex: ^pangeo/.*$
kubespawner_override:
image: "{value}" kubespawner/kubespawner/spawner.py Line 3016 in ff8dcf1
kubespawner/kubespawner/spawner.py Line 3091 in ff8dcf1
|
With respect to nested vs flat, @consideRatio, I think nested is better here! Because we already will have three things:
Given this, I'd suggest the nested config structure. |
To add:
|
Re: nested config, I also opened #736 to help us mitigate the complexity of validation in the nested config in the future. Does not need to block this PR though. I would like us to make sure we get frontend validation in here with this though. |
…th configurable regex
Pushed a commit using your suggestion for the config @yuvipanda (not a problem if we want to change it, just wanted to get a sense of if the validation, etc. works, which it seems to). So now, instead of In the frontend form, just using html form validation with a On the frontend part of this work:
@consideRatio would be great to get your thoughts on the config structure and naming here, happy to make any changes. This should now POST a field with a name like I'll start to take a look at the backend integration for this, though may have limited availability after this week for the next ~2 weeks, so if someone else is able to take on the backend integration, please do :-) |
Hey folks, just checking in here. There's a demo on June 29th that Aimee will be doing and I'm wondering if maybe this work could be wrapped up and exposed on |
Starting to look at the backend integration for this. Just pasting over @yuvipanda's comments from elsewhere about where this needs to happen to have it easy to refer to: kubespawner/kubespawner/spawner.py Line 3016 in ff8dcf1
kubespawner/kubespawner/spawner.py Line 3091 in ff8dcf1
I'll start familiarizing myself here and then lean on you @yuvipanda to get through the actual implementation. |
…the POST, based on if the user has selected Other
…gex in the backend + add test
@yuvipanda @consideRatio there's probably some discussion to be had around details of the implementation here, but this is now "complete" and ready for review:
Overall, I think there's some ideas on how we could do this whole thing a bit better, but that might be a bit of a larger refactor, that hopefully we can discuss separately. I'll give this whole thing another good look tomorrow, but do let me know anything that pops out / that should definitely be fixed. (thanks again @yuvipanda for helping me figure out most of the backend integration code) |
I think its the right call to hardcode this specific choice for a given profile, and "other" seems like a fine choice but also one that could risk collide with other choices. I think either we should make the name a bit more obscure, like |
Speaking to @yuvipanda a bit here -- have gone with naming the form field with It would also be good to have comprehensive validation of the config via JSON schema or similar, and then we can just prohibit |
Co-authored-by: Georgiana <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believed this should be merged, after https://github.com/batpad/kubespawner/pull/2 gets merged as well! 🚀
Co-authored-by: Georgiana <[email protected]>
Co-authored-by: Georgiana <[email protected]>
This was slightly hidden state, making reasoning about what was happening to profiles a little more difficult. Instead, we just call the function to set defaults as necessary wherever it is used.
Co-authored-by: Georgiana <[email protected]>
Co-authored-by: Georgiana <[email protected]>
Co-authored-by: Georgiana <[email protected]>
@GeorgianaElena ok this is ready to go now i think! After this, I think it'd be useful to do a refactor to move all the profile handling code into a separate file. But I don't want to make this PR too much longer... |
@yuvipanda, I agree! But for now, let's merge this! 🚀 Many thanks to everyone for all the thought and effort that went into this PR! 🎉 |
With KubeSpawner's profileList, users may use different images when starting their servers. Measuring and displaying this helps admins know which images are popular, and help support users more. This becomes more relevant with jupyterhub/kubespawner#735, as end users can now specify arbitrary images. Added some docs along with this!
With KubeSpawner's profileList, users may use different images when starting their servers. Measuring and displaying this helps admins know which images are popular, and help support users more. This becomes more relevant with jupyterhub/kubespawner#735, as end users can now specify arbitrary images. Added some docs along with this! Query thanks to @pnasrat, from 2i2c-org/infrastructure#2582 (comment) Co-authored-by: Pris Nasrat <[email protected]>
With KubeSpawner's profileList, users may use different images when starting their servers. Measuring and displaying this helps admins know which images are popular, and help support users more. This becomes more relevant with jupyterhub/kubespawner#735, as end users can now specify arbitrary images. Added some docs along with this! Query thanks to @pnasrat, from 2i2c-org/infrastructure#2582 (comment) Co-authored-by: Pris Nasrat <[email protected]>
Fixes #699 .
This should eventually:
allow_other
, but I think @yuvipanda had some ideas to make that a bit nicer.allow_other
is true, show an additional option called "Other" in the dropdown and handle showing a text input when Other is selectedCurrently, have added a simple
allow_other
option and handling it just on the frontend.@yuvipanda hopefully this is a good starting point for us to work together on implementing handling the value on the backend and improve the semantics of the options.
cc @consideRatio