-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
[Feature Request] Formatting for CSV Diff #14320
Comments
Bounty available! Requirements:
Requests:
|
But if the diff is to add one column or delete one column. Then every line changed? |
In that case currently it'd show a diff of each line changing, with this ticket it would show in a similar fashion but in a nice formatted way. |
Hi, I am interested in working on this issue. However, I searched the files on your code base for |
Not sure what you mean by searching the files on my code-base, but as far as I know no one has started working on this & bounty is still available! If you're going to work on this please fork from this upstream repo, not my fork. In order to complete this issue/bounty you'll need to get a PR approved and merged to Good luck - let me know if you have any other questions. |
I meant looking for the file I forked it from this branch and will take a look. Lastly, yeah I think I will need some guidance in testing but I shall contact you then. |
How could the render/source toggle be implemented? Currently I use a |
Yeah, imo this is an issue with how gitea relies heavily on dynamic serving. I believe you will need to rely on some javascript to toggle the styling on the client side. IMO, this is a prime example of where a proper MVC framework, like Vue would be useful. One maybe not-so-elegant JS solution would be to render the content both as source and tabular and have the UI button toggle the A solution in Vue would likely have configurable template styling based on the view. |
Sure, the "render both" approach works but should not be preferred. The same problem occurs with my second (not pushed) PR for SVG diffs. |
👍 for working on SVG diffs. I started to look into that after implementing #14101, but I wasn't familiar enough with how diffs are displayed, and I got stalled.
I do think that we'd like to have toggling the diff view per file, so I think it will need some JS regardless of how it's done. I don't see a query parameter working. The two main approaches I've thought about:
For client-side rendering, the ease or difficulty of rendering could vary greatly depending on the file type and desired features. For CSV, assuming the server tells the JS what lines changed, this is probably not too complex, but I haven't dug into it. Also, certain UI responsiveness can only be achieved client-side. Switching between views may not need a remote request at all, which is usually the limiting factor. And the more that's done on the server, the harder it becomes to replace it with something client-side in the future. I'm sure you've considered this, but I want to make sure anyone reading this also takes it into account. On the other hand, for rendering server-side, I think we would need to add a route to respond with the diff between two commits, of a specific file, with the user's desired view. Maybe like a more granular version of CompareDiff() in the API. If there is any JS that needs to run to initialize the view, we'd need to make sure that runs after load. If this API endpoint doesn't exist already, it'll probably need some refactoring to implement. Despite needing another route, rendering server-side probably needs fewer changes and is in line with how gitea already does most things. Forgive me if you've considered all this already; I thought it might help some people to have it written down. Above, I've tried to be as unbiased as possible. That said, I personally feel that the main thing lacking from the client-side code in gitea is a separation between model and view. Maybe that is a conversation for another day, but I think this is what @kdumontnu is referring to with regard to Vue, and the lack of tools for model-view separation tends to discourage ambitious client-side features. |
Implements request #14320 The rendering of CSV files does match the diff style. * Moved CSV logic into base package. * Added method to create a tabular diff. * Added CSV compare context. * Added CSV diff template. * Use new table style in CSV markup. * Added file size limit for CSV rendering. * Display CSV parser errors in diff. * Lazy read single file. * Lazy read rows for full diff. * Added unit tests for various CSV changes.
Closed with #14661 |
We should apply the same styling from CSV file-view to diffs for CSVs.
It should looks something like this:
The text was updated successfully, but these errors were encountered: