(self, project: dict|None)
| 64 | return projects.load_edit_project_data(name) |
| 65 | |
| 66 | def clone_project(self, project: dict|None): |
| 67 | if project is None: |
| 68 | raise Exception("Project data is required") |
| 69 | git_url = project.get("git_url", "") |
| 70 | git_token = project.get("git_token", "") |
| 71 | if not git_url: |
| 72 | raise Exception("Git URL is required") |
| 73 | |
| 74 | # Progress notification |
| 75 | notification = NotificationManager.send_notification( |
| 76 | NotificationType.PROGRESS, |
| 77 | NotificationPriority.NORMAL, |
| 78 | f"Cloning repository...", |
| 79 | "Git Clone", |
| 80 | display_time=999, |
| 81 | group="git_clone" |
| 82 | ) |
| 83 | |
| 84 | try: |
| 85 | data = projects.BasicProjectData(**project) |
| 86 | name = projects.clone_git_project(project["name"], git_url, git_token, data) |
| 87 | |
| 88 | # Success notification |
| 89 | NotificationManager.send_notification( |
| 90 | NotificationType.SUCCESS, |
| 91 | NotificationPriority.NORMAL, |
| 92 | f"Repository cloned successfully", |
| 93 | "Git Clone", |
| 94 | display_time=3, |
| 95 | group="git_clone" |
| 96 | ) |
| 97 | return projects.load_edit_project_data(name) |
| 98 | except Exception as e: |
| 99 | # Error notification |
| 100 | NotificationManager.send_notification( |
| 101 | NotificationType.ERROR, |
| 102 | NotificationPriority.HIGH, |
| 103 | f"Clone failed: {str(e)}", |
| 104 | "Git Clone", |
| 105 | display_time=5, |
| 106 | group="git_clone" |
| 107 | ) |
| 108 | raise |
| 109 | |
| 110 | def load_project(self, name: str|None): |
| 111 | if name is None: |
no test coverage detected