Closed james-strauss-uwa closed 1 month ago
This pull request implements a new feature to delete files from Git repositories (both GitHub and GitLab) within the EAGLE application. The changes include adding a "trash can" icon next to each file in the repository tab, implementing the deletion functionality on both client and server sides, and adding a user confirmation step that can be skipped using a new setting.
sequenceDiagram
participant User
participant UI
participant Eagle
participant GitHub/GitLab
participant Server
User->>UI: Click delete icon
UI->>Eagle: deleteRemoteFile()
Eagle->>User: Confirm deletion
User->>Eagle: Confirm
Eagle->>GitHub/GitLab: deleteRemoteFile()
GitHub/GitLab->>Server: HTTP POST /deleteRemoteGithubFile or /deleteRemoteGitlabFile
Server->>GitHub/GitLab API: Delete file
GitHub/GitLab API-->>Server: Response
Server-->>GitHub/GitLab: Response
GitHub/GitLab-->>Eagle: Callback
Eagle->>UI: Update repository view
Change | Details | Files |
---|---|---|
Implement file deletion functionality for GitHub repositories |
|
eagleServer/eagleServer.py |
Implement file deletion functionality for GitLab repositories |
|
eagleServer/eagleServer.py |
Add client-side file deletion functionality in the Eagle class |
|
src/Eagle.ts |
Extend Repository class to support file deletion |
|
src/Repository.ts |
Add file deletion support for GitHub and GitLab services |
|
src/GitHub.ts src/GitLab.ts |
Add new setting for file deletion confirmation |
|
src/Setting.ts |
Update UI to include delete icon for repository files |
|
static/components/repository-file.html |
Adds a "trash can" icon next to each file in the repository tab. Clicking the icon deletes the file from the repository.
There is a user confirmation step before the deletion. The confirmation step can be skipped using a new setting CONFIRM_DELETE_FILES.
Both GitLab and GitHub repositories are supported.
Once the file is deleted, we could trigger a refresh of the repository listing to visualise the change, but that is slow. So instead we just remove the file from the client-side repository file hierarchy, assuming this will exactly mirror the state of the remote repository.
Considered adding a "delete directory" button, but git directories only exist when a file exists within them. So removing all files from a directory will delete the directory from git.
Every delete results in one commit to the repository.
Summary by Sourcery
Add functionality to delete files from GitHub and GitLab repositories within EAGLE, including a user confirmation step and client-side updates to the file hierarchy.
New Features:
Enhancements: