From 2ad19a714b6c28f7f6c364dc28168ab1485334f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Krela?= Date: Tue, 31 Mar 2026 08:30:34 +0200 Subject: [PATCH] Implemented filtering pull request diff files by file extension There is new button in pull request diff template, which opens dropbox containing list of all unique extensions that the diff contains. List is created with checkmarks that can be checked/unchecked to filter out files with specific extension. There is also "select all" and "deselect all" buttons. To apply the change and filter out the files user have to click on "Apply" button. If any extensions were filtered out, then button which opens the dropbox is outlined to signal some files were filtered out. --- options/locale/locale_en-US.json | 4 + templates/repo/diff/box.tmpl | 6 + .../js/components/DiffFileExtensionFilter.vue | 242 ++++++++++++++++++ .../js/features/repo-diff-extensionfilter.ts | 10 + web_src/js/features/repo-diff.ts | 2 + 5 files changed, 264 insertions(+) create mode 100644 web_src/js/components/DiffFileExtensionFilter.vue create mode 100644 web_src/js/features/repo-diff-extensionfilter.ts diff --git a/options/locale/locale_en-US.json b/options/locale/locale_en-US.json index 2ffa130751c..429ea1eda1f 100644 --- a/options/locale/locale_en-US.json +++ b/options/locale/locale_en-US.json @@ -1777,6 +1777,10 @@ "repo.pulls.select_commit_hold_shift_for_range": "Select commit. Hold Shift and click to select a range.", "repo.pulls.review_only_possible_for_full_diff": "Review is only possible when viewing the full diff", "repo.pulls.filter_changes_by_commit": "Filter by commit", + "repo.pulls.filter_by_file_extension": "Filter by file extension", + "repo.pulls.select_all_file_extensions": "Select all", + "repo.pulls.deselect_all_file_extensions": "Deselect all", + "repo.pulls.apply_file_extension_filter": "Apply", "repo.pulls.nothing_to_compare": "These branches are equal. There is no need to create a pull request.", "repo.pulls.nothing_to_compare_have_tag": "The selected branches/tags are equal.", "repo.pulls.nothing_to_compare_and_allow_empty_pr": "These branches are equal. This PR will be empty.", diff --git a/templates/repo/diff/box.tmpl b/templates/repo/diff/box.tmpl index 390e41ec340..4649f9a45a9 100644 --- a/templates/repo/diff/box.tmpl +++ b/templates/repo/diff/box.tmpl @@ -35,6 +35,12 @@ {{template "repo/diff/whitespace_dropdown" .}} {{template "repo/diff/options_dropdown" .}} {{if .PageIsPullFiles}} +
+ {{/* the following will be replaced by vue component, but this avoids any loading artifacts till the vue component is initialized */}} + +
{{/* the following will be replaced by vue component, but this avoids any loading artifacts till the vue component is initialized */}}