Add checkmark to mark all files
All checks were successful
Deploy / build (push) Successful in 46s

This commit is contained in:
2026-02-27 19:06:00 +01:00
parent ec79a0c5cf
commit 9b1668def9
2 changed files with 13 additions and 7 deletions

View File

@@ -193,20 +193,26 @@ public class RepoController
}
@PostMapping("/repo/{name}/stage")
public String stage(@PathVariable String name, @RequestParam List<String> files,
public String stage(@PathVariable String name,
@RequestParam(required = false) List<String> files,
@RequestParam(required = false) String selectAll,
@RequestParam(defaultValue = "Stage Selected") String action) throws IOException, GitAPIException
{
List<String> filesToProcess = (selectAll != null) ? gitService.getModifiedFiles(name) : (files != null ? files : List.of());
if ("Rollback Selected".equals(action))
gitService.rollbackFiles(name, files);
gitService.rollbackFiles(name, filesToProcess);
else
gitService.stageFiles(name, files);
gitService.stageFiles(name, filesToProcess);
return "redirect:/repo/" + name + "/changes";
}
@PostMapping("/repo/{name}/unstage")
public String unstage(@PathVariable String name, @RequestParam List<String> files) throws IOException, GitAPIException
public String unstage(@PathVariable String name,
@RequestParam(required = false) List<String> files,
@RequestParam(required = false) String selectAll) throws IOException, GitAPIException
{
gitService.unstageFiles(name, files);
List<String> filesToProcess = (selectAll != null) ? gitService.getStagedFiles(name) : (files != null ? files : List.of());
gitService.unstageFiles(name, filesToProcess);
return "redirect:/repo/" + name + "/changes";
}

View File

@@ -11,7 +11,7 @@
<form method="post" th:action="@{/repo/{name}/stage(name=${name})}" th:if="${!#lists.isEmpty(modifiedFiles)}">
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<th></th>
<th><input type="checkbox" name="selectAll"></th>
<th>File</th>
</tr>
<tr th:each="file : ${modifiedFiles}">
@@ -29,7 +29,7 @@
<form method="post" th:action="@{/repo/{name}/unstage(name=${name})}" th:if="${!#lists.isEmpty(stagedFiles)}">
<table border="1" cellpadding="4" cellspacing="0">
<tr>
<th></th>
<th><input type="checkbox" name="selectAll"></th>
<th>File</th>
</tr>
<tr th:each="file : ${stagedFiles}">