-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Brad/exp 458 fe allow pasting in a git clone url to create project as #18534
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
Brad/exp 458 fe allow pasting in a git clone url to create project as #18534
Conversation
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.
Hey Brad, chiming in pretty early as it's still a draft, just some minor suggestions 🙏
components/dashboard/src/projects/new-project/NewProjectSearchInput.tsx
Outdated
Show resolved
Hide resolved
components/dashboard/src/projects/new-project/NewProjectCreateFromURL.tsx
Outdated
Show resolved
Hide resolved
components/dashboard/src/projects/new-project/NewProjectCreateFromURL.tsx
Outdated
Show resolved
Hide resolved
components/dashboard/src/projects/new-project/NewProjectCreateFromURL.tsx
Outdated
Show resolved
Hide resolved
components/dashboard/src/projects/new-project/NewProjectCreateFromURL.tsx
Outdated
Show resolved
Hide resolved
let slug = ""; | ||
|
||
try { | ||
// try and parse the url for owner/repo path parts |
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.
We've a util for that in server. I could make sense to pull it out to gitpod-protocol for reuse. Have a look at the special cases, some of them actually introduced for BBS:
https://github.com/gitpod-io/gitpod/blob/de09b5f828e23b8dfb6774c750c94b2db846c00d/components/server/src/repohost/repo-url.ts
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.
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.
throw new Error("No org currently selected"); | ||
} | ||
|
||
return await getGitpodService().server.createProject({ |
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.
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.
It's resolved here: 1015169
Please rebase
@selfcontained, in general this is almost perfect! Besides the other comments, I think the only issue I see is with discoverability of this feature. For testing, I didn't look too much into the FE code, but just tried to use it. Here are my thoughts in short:
I leave it up to you to decide on how far you want to take it in here, or create follow-up issues. |
…FromURL.tsx Co-authored-by: Filip Troníček <[email protected]>
c13456d
to
08429a9
Compare
@selfcontained whenever I try adding a repo from a clone URL, I seem to get an error from the GitHub API, preventing the Project success page from showing up, even though it is created in the background |
name = repo || owner; | ||
slug = (repo || owner).toLowerCase(); | ||
name = repo; | ||
slug = [repo, owner].filter(Boolean).join("-").toLowerCase(); |
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.
just to resurface: this won't work nice with personal BBS repos, e.g. https://bitbucket.gitpod-dev.com/scm/~alex/personal-repo.git
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 ended up swapping it so it's repo at the end. So in this case the slug would be scm-~alex-personal-repo
- is that a problem?
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.
It worked nicely 👍🏻
🙇🏻♂️ Awesome work!
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.
Just re-tried; works great!
/unhold |
Description
The primary aim for this PR was to allow pasting in a git clone url when creating a project, and allowing the user to create w/ that clone url if there isn't a repo that matches their search, and if the url looks like a clone url. In case there are problems loading the repositories, this provides a workaround.
Notes:
The
NewProject.tsx
file has a lot going on it, which made it quite difficult to modify some of the functionality w/o effecting the rest. There were like 8 useEffects() and several layers of nested rendering functions. I ended up refactoring most of that component and breaking it out into more manageable pieces, as well as prepping some of the queries/mutations to let us build an incremental repo search for this UI as a followup.Summary generated by Copilot
🤖 Generated by Copilot at 9a8b7a2
This pull request adds several new files with TypeScript code that implement the user interface and the data fetching logic for creating projects from GitHub repositories. It defines custom React hooks for querying and mutating GitHub-related data, and React components for rendering the different elements of the new project creation flow. It also provides a utility function for reconfiguring the GitHub app if needed.
Related Issue(s)
Fixes EXP-458
How to test
Documentation
Preview status
Gitpod was successfully deployed to your preview environment.
Build Options
Build
Run the build with werft instead of GHA
Run Leeway with
--dont-test
Publish
Installer
Add desired feature flags to the end of the line above, space separated
Preview Environment / Integration Tests
If enabled this will build
install/preview
If enabled this will create the environment on GCE infra
Valid options are
all
,workspace
,webapp
,ide
,jetbrains
,vscode
,ssh
. If enabled,with-preview
andwith-large-vm
will be enabled./hold