-
Notifications
You must be signed in to change notification settings - Fork 899
feat(desktop): add New Project page with empty, clone, and template tabs #1623
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
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
c47125b
feat(desktop): add New Project page with empty, clone, and template tabs
Kitenite 0b6e2bf
feat(desktop): add New Project page with empty and clone tabs
Kitenite 845d39e
Merge remote-tracking branch 'origin' into kitenite/create-new-repo
Kitenite 548918f
Address issues
Kitenite 259be6d
Deslop
Kitenite 431b1dd
Better stylinf
Kitenite 69ea67f
Back button
Kitenite 002595b
Template
Kitenite d2a0ab3
Styling
Kitenite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
...er/routes/_authenticated/_onboarding/new-project/components/CloneRepoTab/CloneRepoTab.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| import { Button } from "@superset/ui/button"; | ||
| import { Input } from "@superset/ui/input"; | ||
| import { useState } from "react"; | ||
| import { electronTrpc } from "renderer/lib/electron-trpc"; | ||
| import { useProjectCreationHandler } from "../../hooks/useProjectCreationHandler"; | ||
|
|
||
| interface CloneRepoTabProps { | ||
| onError: (error: string) => void; | ||
| parentDir: string; | ||
| } | ||
|
|
||
| export function CloneRepoTab({ onError, parentDir }: CloneRepoTabProps) { | ||
| const [url, setUrl] = useState(""); | ||
| const cloneRepo = electronTrpc.projects.cloneRepo.useMutation(); | ||
| const { handleResult, handleError, isCreatingWorkspace } = | ||
| useProjectCreationHandler(onError); | ||
|
|
||
| const isLoading = cloneRepo.isPending || isCreatingWorkspace; | ||
|
|
||
| const handleClone = () => { | ||
| if (!url.trim()) { | ||
| onError("Please enter a repository URL"); | ||
| return; | ||
| } | ||
| if (!parentDir.trim()) { | ||
| onError("Please select a project location"); | ||
| return; | ||
| } | ||
|
|
||
| cloneRepo.mutate( | ||
| { url: url.trim(), targetDirectory: parentDir.trim() }, | ||
| { | ||
| onSuccess: (result) => handleResult(result, () => setUrl("")), | ||
| onError: handleError, | ||
| }, | ||
| ); | ||
| }; | ||
|
|
||
| return ( | ||
| <div className="flex flex-col gap-5"> | ||
| <div> | ||
| <label | ||
| htmlFor="clone-url" | ||
| className="block text-sm font-medium text-foreground mb-2" | ||
| > | ||
| Repository URL | ||
| </label> | ||
| <Input | ||
| id="clone-url" | ||
| value={url} | ||
| onChange={(e) => setUrl(e.target.value)} | ||
| placeholder="https:// or git@github.com:user/repo.git" | ||
| disabled={isLoading} | ||
| onKeyDown={(e) => { | ||
| if (e.key === "Enter" && !isLoading) { | ||
| handleClone(); | ||
| } | ||
| }} | ||
| autoFocus | ||
| /> | ||
| </div> | ||
| <div className="flex justify-end pt-2 border-t border-border/40"> | ||
| <Button onClick={handleClone} disabled={isLoading} size="sm"> | ||
| {isLoading ? "Cloning..." : "Clone"} | ||
| </Button> | ||
| </div> | ||
| </div> | ||
| ); | ||
| } |
1 change: 1 addition & 0 deletions
1
...c/renderer/routes/_authenticated/_onboarding/new-project/components/CloneRepoTab/index.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export { CloneRepoTab } from "./CloneRepoTab"; |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
createEmptyRepo: no cleanup ifupsertProjectorensureMainWorkspacethrows after a successfulinitGitRepo.The previous review addressed cleanup for
initGitRepofailure (inner try-catch +rmat lines 807–812). However, ifupsertProject(line 813) orensureMainWorkspace(line 814) throw a DB error, the outer catch at line 826 returns an error response but leaves the git-initialized directory on disk (and potentially a partial project record). On retry with the same name,existsSync(repoPath)returnstrue→ the user sees "A folder already exists" and is blocked until they manually delete the directory.🐛 Proposed fix — extend cleanup scope
🤖 Prompt for AI Agents