giorgioamato-c4l opened a new pull request, #1622:
URL: https://github.com/apache/camel-karavan/pull/1622
# Feature: Integrated Git Commit Diff Viewer in Dashboard
## Overview
This PR introduces a new interactive feature to the Apache Karavan
Dashboard: a **Git Commit Diff Viewer**. Users can now click on any commit
message in the development history to inspect the actual code changes directly
within the application, eliminating the need to switch to an external Git
client for quick reviews.
---
## ✨ Key Features
* **Interactive History**: Commits in the "Recent Projects" and "History"
sections are now clickable.
* **Unified Diff Visualization**: A dedicated modal displays code changes
in the standard Unified Diff format.
* **Syntax Highlighting (GitHub Style)**: Enhanced readability with a
clean light-themed UI and line-by-line color coding:
* 🟢 **Green**: Additions
* 🔴 **Red**: Deletions
* 🔵 **Blue**: Metadata chunks (@@)
* **Async Data Fetching**: Seamless integration with a loading state
(Spinner) to handle repository access times.
---
## Technical Implementation
### Backend (Java/Quarkus)
* `GitHistoryService`: Implemented `getCommitDiff` logic using **JGit**.
The service resolves the commit ID and its parent to calculate the byte stream
difference.
* `ProjectResource`: Exposed a new REST endpoint `@GET
/api/git/commit-diff/{projectId}/{commitId}` to serve the diff data as
`text/plain`.
### Frontend (React/TypeScript)
* `KaravanApi.ts`: Added a static `getCommitDiff` method to handle
asynchronous communication with the new backend endpoint.
* `DashboardDevelopmentCardCommit`: Developed a robust React component to
manage modal states and dynamic line parsing for the diff view.
* **UI/UX**: Leveraged **PatternFly** components to maintain design
consistency across the Karavan ecosystem.
---
## Screenshots
| Feature Preview |
| :--- |
<img width="2556" height="1277" alt="image"
src="https://github.com/user-attachments/assets/fde10367-5a35-4d06-a43e-9b8d893ab8de"
/>
---
## How to Test
1. Open the **Karavan Dashboard**.
2. Locate a recent commit in the activity list.
3. Click on the **commit message**.
4. Verify that the **Modal** opens, showing the highlighted code changes
with the correct color coding.
FYI: @mgubaidullin
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]