-
Notifications
You must be signed in to change notification settings - Fork 6
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
Add repo validation, enable branch selection #68
Conversation
for more information, see https://pre-commit.ci
@oliverroick this looks really good to me and seems to work well! I guess my only question is that since we will plan on adding more Providers down the line, do you think it might add too much complexity to do the repo validation and branch name fetching for each one? The branch-picker drop-down is nice - I wonder if users might ever want to just put a Git Sha or so instead of a branch name? Since I think currently that accepts anything that's a valid |
@@ -12,7 +12,6 @@ | |||
}, | |||
"dependencies": { | |||
"@jupyterhub/binderhub-client": "0.4.0", | |||
"configurable-http-proxy": "^4.6.1", |
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.
Did you mean to remove this @oliverroick ?
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.
Weird, I thought this wasn't part of the dependencies, but it looks like it is. I'll revert the change.
Noticed a couple things:
|
I don’t think so. I envisage this as separate components for each provider, which encapsulates the form-field generation and validation, with separate hook implementations for each of those. There will be some repetition but I think it’s fine because they are all different concepts.
I thought about doing that a fair bit but decided against it. I usually try to avoid changing user input because there could be weird consequences. Like when do you change the value? When they stop typing, when the repository is validated? I left it where it is as to not introduce more complexity to the user interface. We’re doing the normalisation in the background. The normalised value is stored in
Let me have a look into that. We can also get the tags and compose a list of both branches and tags. There’s no major difference, just one more HTTP request to the GitHub API.
If we want to support Git SHAs too, then I’d revert to a text field. We could add validation, and check the GitHub API if the branch/tag/sha exists. Should we do that or do the branch/tag approach for now? |
Let's do branch / tag for now!
Sounds good, thank you for thinking this through - I agree. From testing locally, it seemed like it was trying to use the full |
Thanks for the fixes @oliverroick ! I think I feel okay about merging this - shall I go ahead? |
Not yet @batpad, still need to build the tag select |
for more information, see https://pre-commit.ci
@batpad I've added the tag selection, can you give this another spin? |
Looks good to me! Very minor quibble: If I say, paste the repository URL into the repository field and then without leaving focus from the field, click the "Build Image" button, the behaviour is slightly strange - i.e. it will then show the branch field. I think this is okay. The other option I can think of, that may make this slightly better: always render the Branch / Tag field, but keep it disabled until the user has entered the repository field, so that it's clear that there is one more field to fill up before one can submit. Am fine with merging as is though - would leave this to be your call @oliverroick . Thanks again for this, it's looking really good! |
@oliverroick the updates look really good to me. |
Contributes to #66: Extends the build-image form, so users can select a repository and branch, and add stronger validation for inputs.
Changes
org/repo
orgithub.com/org/repo
orhttps://github.com/org/repo
. Other inputs should be rejected with an error.HEAD
request to verify if the repository exists and if it is public.