This commit is contained in:
@@ -193,20 +193,26 @@ public class RepoController
|
|||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/repo/{name}/stage")
|
@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
|
@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))
|
if ("Rollback Selected".equals(action))
|
||||||
gitService.rollbackFiles(name, files);
|
gitService.rollbackFiles(name, filesToProcess);
|
||||||
else
|
else
|
||||||
gitService.stageFiles(name, files);
|
gitService.stageFiles(name, filesToProcess);
|
||||||
return "redirect:/repo/" + name + "/changes";
|
return "redirect:/repo/" + name + "/changes";
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/repo/{name}/unstage")
|
@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";
|
return "redirect:/repo/" + name + "/changes";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,7 +11,7 @@
|
|||||||
<form method="post" th:action="@{/repo/{name}/stage(name=${name})}" th:if="${!#lists.isEmpty(modifiedFiles)}">
|
<form method="post" th:action="@{/repo/{name}/stage(name=${name})}" th:if="${!#lists.isEmpty(modifiedFiles)}">
|
||||||
<table border="1" cellpadding="4" cellspacing="0">
|
<table border="1" cellpadding="4" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th><input type="checkbox" name="selectAll"></th>
|
||||||
<th>File</th>
|
<th>File</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr th:each="file : ${modifiedFiles}">
|
<tr th:each="file : ${modifiedFiles}">
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
<form method="post" th:action="@{/repo/{name}/unstage(name=${name})}" th:if="${!#lists.isEmpty(stagedFiles)}">
|
<form method="post" th:action="@{/repo/{name}/unstage(name=${name})}" th:if="${!#lists.isEmpty(stagedFiles)}">
|
||||||
<table border="1" cellpadding="4" cellspacing="0">
|
<table border="1" cellpadding="4" cellspacing="0">
|
||||||
<tr>
|
<tr>
|
||||||
<th></th>
|
<th><input type="checkbox" name="selectAll"></th>
|
||||||
<th>File</th>
|
<th>File</th>
|
||||||
</tr>
|
</tr>
|
||||||
<tr th:each="file : ${stagedFiles}">
|
<tr th:each="file : ${stagedFiles}">
|
||||||
|
|||||||
Reference in New Issue
Block a user